Neuropharmacology-Sandbox

A transparent, reproducible pharmacology calculation environment.

Overview

Neuropharmacology-Sandbox is a local-first scientific computing application designed to make pharmacological calculations more transparent, reproducible, and auditable.

Pharmacokinetic and pharmacodynamic calculations often involve multiple assumptions, mathematical models, experimental observations, and external data sources. When these elements are hidden behind a single result, it becomes difficult to understand how a value was obtained, reproduce an analysis, or identify limitations.

This project addresses that problem by providing an interactive environment where users can explore pharmacological models, manage experimental datasets, inspect calculation steps, and preserve the provenance of scientific data.

The application is intended for educational and exploratory scientific use. It is not a clinical decision-support system, diagnostic tool, or substitute for professional medical judgment.

What It Does

1. Pharmacokinetic and Pharmacodynamic Modeling

The application implements several explicit mathematical models, including:

  • First-order, one-compartment elimination.
  • Single-site receptor occupancy.
  • Hill/Emax dose-response relationships.
  • Dynamic two-compartment intravenous pharmacokinetic simulation.
  • Optional effect-site equilibration and receptor occupancy modeling.

Users can modify model parameters and observe how the resulting curves and calculated quantities change.

2. Experimental Data Analysis

Users can import experimental datasets and perform exploratory pharmacokinetic analyses.

Supported capabilities include:

  • Non-compartmental analysis (NCA).
  • Cmax, Tmax, AUC, terminal elimination rate constant, and half-life estimation.
  • Repeated-dose interval AUC and steady-state analysis.
  • Observed interval exposure metrics.
  • Sampling coverage diagnostics.
  • Model fitting, diagnostics, and model comparison.
  • Explicit handling of below-quantification-limit (BLQ) observations.

The application distinguishes actual measurements from censored observations. A quantification limit is never silently treated as a measured concentration.

3. Data Provenance and Reproducibility

Scientific results should be traceable to their inputs and assumptions.

Neuropharmacology-Sandbox provides:

  • Calculation traces showing formulas, substituted inputs, intermediate steps, assumptions, and warnings.
  • Drug-library records with source provenance.
  • On-demand data retrieval from PubChem and ChEMBL.
  • Import and export of experimental datasets.
  • Portable project and recovery backup formats.
  • Validation of imported data and persistent records.

The application does not invent missing pharmacological parameters or silently substitute unsupported values.

4. Visualization and Data Management

Interactive charts are used to visualize pharmacokinetic and pharmacodynamic behavior.

The application also supports local data management through IndexedDB, with no account system, backend database, or cloud synchronization requirement.

Engineering and Design Principles

The project follows several core principles:

Transparency: Every calculation should expose the mathematical steps and assumptions behind its result.

Reproducibility: Inputs, experimental observations, and data provenance should remain accessible and exportable.

Scientific restraint: Unsupported values should not be invented, and analytical limitations should be explicitly communicated.

Local-first architecture: User data remains in local browser storage unless the user explicitly requests an external data-source query.

Data integrity: Imported records, persistent storage, and recovery operations are validated rather than blindly trusted.

Technology Stack

  • TypeScript
  • React 19
  • Vite
  • Zustand
  • Dexie.js and IndexedDB
  • Plotly.js
  • Decimal.js
  • Zod
  • Tailwind CSS
  • Vitest
  • Playwright
  • Node.js
  • Cloudflare Pages

The project uses automated unit tests, schema validation, end-to-end testing, accessibility checks, crash-durability testing, static analysis, and CI workflows.

Development During the Hackathon

Neuropharmacology-Sandbox existed before the hackathon. Rather than presenting the entire application as a newly created project, this submission documents the continued development undertaken during the event.

During the hackathon development period, I worked on extending its experimental pharmacokinetics capabilities, including:

  • Repeated-dose analysis: Added interval AUC and steady-state non-compartmental analysis.
  • Exposure metrics: Introduced observed interval exposure measurements and related diagnostics.
  • Sampling diagnostics: Added sampling coverage analysis, including repeated sampling times, adjacent sampling gaps, and boundary observations.
  • BLQ data support: Introduced explicit below-quantification-limit observations, preserving their original representation and preventing quantification limits from being mistaken for measured concentrations.
  • Data integrity: Strengthened schema invariants, import/export validation, repository boundaries, and regression coverage.
  • Performance and reliability: Improved recovery-related validation performance and expanded regression tests.

These changes are documented in the public GitHub commit history and project development records.

Use of AI

I used DSH and DeepSeek V4.1 Flash as AI-assisted development tools.

They supported technical problem-solving, implementation, code refinement, and debugging during development.

The application itself does not integrate an LLM or use AI to generate pharmacological recommendations. Its scientific calculations are based on explicit mathematical models and user-provided or traceable data sources.

AI was used as a development aid, not as part of the scientific calculation pipeline. The implementation, testing, validation, and responsibility for the resulting project remain with the developer.

Challenges and What I Learned

One of the main challenges was maintaining scientific correctness while expanding the application's analytical capabilities.

For example, below-quantification-limit observations cannot simply be converted into zero or replaced with their quantification limits. Doing so would introduce misleading information into downstream calculations.

Addressing this required changes across the data model, import pipeline, analytical boundaries, visualization, persistence, and testing layers.

This reinforced an important engineering lesson: scientific software requires more than implementing formulas. It also requires careful treatment of uncertainty, data semantics, assumptions, and failure conditions.

Another challenge was ensuring that local data remained recoverable and internally consistent as the application's data model evolved.

Limitations and Future Work

This project is an evolving scientific computing environment, not a validated clinical or pharmaceutical development platform.

Future work may include:

  • More pharmacokinetic and pharmacodynamic models.
  • Expanded experimental dataset analysis.
  • Additional model diagnostics and uncertainty reporting.
  • More comprehensive scientific data-source integration.
  • Further improvements to reproducibility and interoperability.

Built With

Share this project:

Updates

Submission history