Add modular QSP plugin system with turnover biomarker model#7
Add modular QSP plugin system with turnover biomarker model#7
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d05a97a079
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
I applied PR #7 conceptually on by manually merging its intended changes (QSP plugin CLI integration + turnover model coupling path). Resolved conflicts with current branch state, validated locally (, , on touched files), then closed PR #7 since upstream content is now represented in commit 0382ac9 on main. |
|
I applied PR #7 intent on main (QSP plugin CLI integration + turnover model coupling path) by manual merge due conflict. Conflicts were resolved against current branch state, validated locally (pytest, mypy, ruff on touched files), and committed as 0382ac9 on main. Closing PR #7 as superseded by manual merge. |
Data fixes (6 entries, cross-referenced against FDA labels): valacyclovir: dose 20→1000mg (FDA Valtrex: 1g dose for acyclovir Cmax) carglumic acid: flagged uncertain (mg/kg dosing in pediatric label) darifenacin: dose 400→15mg (max clinical dose is 15mg) sertraline: Cmax 0.165→0.033 (FDA Zoloft 50mg: 33 ng/mL) ketorolac: dose 10→30mg (Cmax 2.52 matches 30mg FDA Toradol) cetirizine: dose 60→10mg (FDA Zyrtec: 10mg Cmax=311 ng/mL) AD filter refinement: - Thienopyridine SMARTS fixed: [#7]1[#6][#6]c2[#16]ccc2[#6]1 (catches clopidogrel) - Extreme lipophilicity threshold: logP 6.0→5.5 (catches sonidegib logP=5.2) In-domain holdout (54 drugs): AAFE: 1.923 [1.691, 2.206] %2-fold: 63.0% %3-fold: 85.2% Session total: AAFE 3.520 → 1.923 (-45.4%), zero model changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… correction ## Summary Comprehensive pipeline improvement across 10 tasks: ### Data Quality (Tasks 1, 8, 9) - Fix 5 platinum reference Cmax values (diclofenac, posaconazole, lenacapavir, valganciclovir, pindolol) — unit errors, route mismatch, extraction errors - Add DDI-boosted flags for lopinavir and darunavir - Add nucleoside 5'-ester SMARTS for molnupiravir prodrug detection - Fix val-ester SMARTS false positive on penicillamine - First AUC validation with MMPK (32 drugs): AAFE 3.205 - Lombardo/Obach VDss cross-validation (17 drugs): AAFE 3.71 ### Pipeline Constants (Tasks 4, 5) - Revert 4 Optuna constants to pre-Optuna defaults (gut_threshold 2.6, peff_min 0.5, pgp 0.5, gse 0.5) — MMPK tuning doesn't generalize - Verify ODE >> analytical for Cmax on clinical data (AAFE 2.41 vs 11.64) ### UQ System (Task 6) - Recalibrate AdaptiveConformal: 68 clean drugs, k=30 Coverage: 93.7% in-domain (was 97% over-wide), width 20.6x (was 4880x) - Replace broken LHS AUC/t½ CI with Cmax q-value heuristic scaling ### VDss Fix (Task 10) - Weighted geometric mean (XGB^0.7 × Berez^0.3) always applied for t½ Core-24 AUC AAFE: 2.344 → 2.142 (-8.6%), Cmax unchanged ### Metrics & Documentation (Tasks 2, 3, 7) - First Spearman ρ measurement: 0.9379 in-domain (excellent ranking) - CLAUDE.md: revoke KD#3/#7/#14, add KD#32-41, update performance - Holdout benchmark: in-domain stratification, DDI-boosted exclusion - CYP3A4 classifier trained but deferred (AUROC 0.634, no holdout impact) ## Results - Core-24 Cmax AAFE: 1.977 → 1.879 (-5.0%) - Core-24 AUC AAFE: 2.344 → 2.142 (-8.6%) - Holdout ALL: 2.780 → 2.440 (-12.2%) - Holdout IN-DOMAIN: first measured = 1.966 (under 2.0) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Motivation
Description
physio_sim.qsppackage withBaseQSPModelinterface, a model registry (register_qsp_model,get_qsp_model,list_qsp_models), and a built-inturnovermodel (physio_sim/qsp/models/turnover.py).QSPConfig,load_qsp) inphysio_sim/config.pyand an example YAMLexamples/qsp_turnover.yamldescribingkin,kout,emax,ec50_mg_per_L,hill, and optionalB0.physio_sim/pbpk/solver.py) to supportposthoc(default) QSP solving using interpolated plasma signal and an optionalcoupledmode that augments PBPK state vector and solves PBPK+QSP together withsolve_ivp(method="BDF")(kept optional behindqsp_mode).physio_sim/cli.py:--qsp-model,--qsp-config, and--qsp-mode posthoc|coupled, and append QSP state columns (e.g.,B_biomarker) totimecourse.csvand addBmax,t_Bmax,Bendtosummary.jsonwhen QSP is enabled.docs/qsp.md,docs/qsp_models.md), README quickstart snippet, and unit/cli tests (tests/test_qsp_turnover.py,tests/test_cli_qsp_smoke.py).Testing
python -m ruff format .andpython -m ruff check .which completed without failures.python -m mypy physio_simwhich completed with no issues reported.python -m pytest -qand all tests passed (18 passed).Codex Task