Research-Grade · Local-First · Provenance-Tracked

From Sketch to Statistically Sound Clinical Decision Support for Polypharmacy

A complete, locally-runnable CDSS that fuses drug-interaction screening, Bayesian PK/PD modeling, kinetic GFR and quantitative imaging into a joint posterior state — delivering ≤ 3 prioritized, provenance-audited recommendations per patient, never an avalanche of alerts.

Run the Workflow Demo Professional Services
2,855,310Drug–Drug Interactions
5,701Adverse Drug Reactions
4,566Drugs in Knowledge Base
≤ 3Alerts / Patient / Day
100%Local · No Cloud Required

Module 1 · Pharmacological BedrockMechanism-Based DDI/ADR Detection

Beyond binary interaction flags: a three-tiered pipeline that detects known interactions deterministically, mines novel signals from spontaneous reports, and upgrades statistical signals toward causal evidence — all conditioned on the patient's live physiology.

Tier 1 · Curated Rule Engine

Deterministic Mechanism Queries

Queries the 2.85M-interaction knowledge base (DrugBank + PrimeKG) for known pharmacokinetic mechanisms — CYP3A4 / P-gp inhibitors, inducers and substrates.

  • Clarithromycin + simvastatin → severe rhabdomyolysis risk
  • Directional DDI mining from FAERS informs severity, not just flags
Tier 2 · EBGM Signal Mining

Novel Association Discovery

DuMouchel's gamma-Poisson shrinkage over FAERS performs disproportionality analysis — detecting events reported significantly above background rate while resisting low-count false positives.

  • Higher-order (beyond pairwise) interaction analysis
  • Shrinkage-stabilized reporting ratios
Tier 3 · SCCS Causal Validation

Within-Person Causal Inference

Self-Controlled Case Series compares event rates during exposure vs. control periods within the same patient — controlling all time-invariant confounders (genetics, chronic comorbidity).

  • Statistical signal → causal evidence upgrade
  • Dechallenge N-of-1 confirmation (M3)

Conditional reasoning — risk is not a lookup. QT-prolongation risk starts from the baseline QTc extracted by M4 (echo ±5% error model), adds the cumulative QT liability of every drug on the list, and is potentiated by hypokalemia detected in M3. The same amiodarone + clarithromycin pair scores high at K⁺ 3.3 and lower at K⁺ 4.2 — try it in the demo below.

Clinical Workflow DemonstrationInteractive Decision-Support Walkthrough

Select a medication list, set the patient's potassium, and run the advisor. Interactions are screened, ranked by expected utility, and the knapsack alert budget surfaces only the top three — exactly as the production system behaves.

1 · Medication list

2 · Live lab covariate (M3)

Configure the regimen and press Run Decision Support

Illustrative sample knowledge base for demonstration. The production system screens 2,855,310 interactions, 5,701 ADRs and 4,566 drugs entirely on local hardware (SQLite, no external APIs).

The Analytical EnginesModules M2 – M4: From Data to Physiology

Each module contributes evidence to the blackboard as log-likelihood ratios with strict provenance — never as overconfident binary statements.

M2 · Bayesian PK/PD

Personalized Dosing Engine

  • Hierarchical NLME prior with allometric scaling (CL ∝ WT⁰·⁷⁵, GFR exponent)
  • MAP estimation + Metropolis–Hastings MCMC full posterior over CL and V
  • Bootstrap particle filter tracks non-stationary ICU clearance
  • Profile-likelihood identifiability check — the system refuses to dose on unidentifiable parameters
P(AUC > target) > 0.90  ∧  P(Cmax > toxic) < 0.10
M3 · Analysis Lab

Labs as a Continuous Sensor Network

  • Kinetic GFR (keGFR) mass-balance model detects falling GFR days before creatinine thresholds
  • BOCPD (Adams & MacKay) outputs graded change-point probabilities, not binary flags
  • Child-Pugh posterior PMF {A,B,C} → weighted dose adjustment
  • Dechallenge N-of-1 causal analysis anchors BOCPD at drug-stop dates
dC/dt = G/V − GFR·C/V
M4 · Quantitative Imaging

Imaging as a Measurement Instrument

  • Errors-in-variables: Echo LVEF ±5%, POCUS ±8%, Cardiac MRI ±3% — variance carried forward
  • Monte Carlo dose integration over N(52, √4.0) lean-mass → credible intervals, not point estimates
  • Temperature scaling for cross-site recalibration
  • Conformal prediction guarantees 95% coverage, distribution-free
PyRadiomics · Deming regression · O-RAW workflow

Core InnovationProbabilistic Blackboard with Provenance Tracking

A shared, auditable joint posterior over latent physiological states (GFR, EF, lean mass). Every contribution is a log-likelihood ratio; every piece of raw data is used exactly once — a duplicate provenance_id raises a ProvenanceError, defeating the "echo problem" that inflates confidence in naive multi-module systems.

Independent Evidence

Precision-Weighted Fusion

Optimal combination of conditionally independent scalar estimates — tighter, more precise posterior.

μ_fused = Σ(μᵢ/σ²) / Σ(1/σᵢ²)
Correlated Evidence · Gold Standard

Generalized Least Squares Fusion

M2 and M3 share renal-physiology assumptions; GLS uses the covariance matrix Σ to down-weight redundant information — a wider, more honest confidence interval.

θ̂_GLS = (1ᵀΣ⁻¹1)⁻¹ 1ᵀΣ⁻¹y

Executive LayerThe Decision-Theoretic Advisor

Not heuristics — formal decision theory. Actions are selected by expected utility; the alert list is a constrained optimization, and the whole engine self-audits in production.

Expected Utility

Utility-Maximizing Actions

Every candidate action (hold, reduce, monitor) is scored against expert-defined utilities; the maximum wins.

EU(a) = P(harm)·U_harm(a) + (1−P(harm))·U_noharm(a)
Knapsack Alert Budget

Alert-Fatigue Control

Each alert carries net benefit and attention cost; the knapsack selects the near-optimal subset within a budget of 3 alerts/patient/day — suppressing 50–70% of raw alerts in ward simulations.

Self-Auditing

DCA + CUSUM Monitoring

Clinical utility measured by Decision Curve Analysis (net benefit vs. treat-all/treat-none), while CUSUM charts watch calibration drift and trigger automatic recalibration.

Deployment BlueprintLocal-First, Production-Ready Architecture

FastAPI microservices, a Streamlit clinical dashboard, optional Redis event bus, SQLite knowledge base — containerized with Docker for identical laptop-to-hospital deployment.

Streamlit Dashboardlocalhost:8501 · "type drugs, see alerts"
FastAPI Microserviceslocalhost:8000 · RESTful · EHR-integrable
M1 · DDI/ADR2.85M DB
M2 · PK/PDMCMC
M3 · LabskinGFR
M4 · ImagingEF / CT
Probabilistic Blackboardjoint posterior · provenance tracking · GLS fusion → The Advisor expected utility + knapsack · max 3 alerts
SQLite Knowledge Basedatabase/rezpharma.db · 2,855,310 DDIs | 5,701 ADRs | 4,566 Drugs

Stack: FastAPI · Streamlit · PyMC/MCMC · Bootstrap Particle Filter · BOCPD · PyRadiomics · Conformal Prediction · CUSUM · Decision Curve Analysis · SQLite · Redis Event Bus · Docker

Evidence in ActionCase Studies for Clinical Review

Anonymized trajectories from the 20-patient synthetic ward validation (stable, AKI, cardiogenic shock, high-polypharmacy phenotypes).

Case 1 — AKI Detected Before the Creatinine Threshold

  • Profile: 68 y, ICU · serial creatinine 1.1 → 1.6 mg/dL over 24 h.
  • Risk: Static eGFR still read 61 mL/min; M3 kinetic GFR computed 38 mL/min — a falling GFR invisible to steady-state equations.
  • Intervention: Blackboard fused keGFR with M2's clearance posterior via GLS; M2 re-optimized dosing under chance constraints.
  • Outcome: Nephrotoxic exposure avoided days earlier than conventional thresholds.

Case 2 — Conditional QT-Prolongation Alert

  • Profile: Patient on amiodarone prescribed clarithromycin · K⁺ 3.3 mEq/L.
  • Risk: M1 fused baseline QTc (M4 echo, ±5%), cumulative drug QT liability and hypokalemia potentiation → high posterior harm probability.
  • Intervention: Expected-utility maximization chose "hold clarithromycin, replete K⁺, repeat ECG" over watchful waiting.
  • Outcome: Identical pair at K⁺ 4.2 yielded a lower-priority alert — risk conditioned on physiology, not a static flag.

Case 3 — Alert Fatigue Controlled by the Knapsack

  • Profile: 14-drug regimen generating 9 raw alerts.
  • Risk: Unfiltered alerting overwhelms the clinician — the documented driver of suppressed warnings and error.
  • Intervention: Knapsack kept the 3 highest net-benefit alerts (CYP3A4 contraindication, bleeding combination, hyperkalemia pair); 6 suppressed.
  • Outcome: Critical risk surfaced, cognitive load contained — validated by Decision Curve Analysis, not AUROC.

Professional Services & CollaborationWorking With RezpharmaCDSS

Beyond the research implementation, the following engagement tracks are available for hospitals, research groups and health-technology teams.

Track 1

Institutional Deployment

Docker-containerized, local-first installation on hospital servers — identical to the validated research environment. No patient data ever leaves your network.

  • docker-compose orchestration (API :8000 · dashboard :8501)
  • Identical laptop-to-hospital environments
  • Zero cloud dependency after setup
Track 2

EHR / FHIR Integration

Decoupled FastAPI microservices expose clean RESTful endpoints designed for EHR connectivity, with FHIR-simulator interoperability testing on the roadmap.

  • Modular, independently scalable engines
  • Event-driven mode via Redis message bus
  • Standards-oriented integration path
Track 3

Local Calibration & Validation

Site-specific recalibration and continuous safety monitoring on your patient population — the statistical guarantees travel with the deployment.

  • Temperature scaling for domain shift
  • Conformal prediction coverage guarantees
  • CUSUM drift monitoring + Decision Curve Analysis
Track 4

Training & Research Collaboration

Workshops for clinical pharmacology and informatics teams on statistically sound CDSS design, plus joint research projects and publications.

  • Bayesian inference & decision theory for clinicians
  • Provenance-aware fusion architecture
  • Co-authored validation studies

Development Roadmap

PhaseStatusScope
Phase 1CompleteLocal research implementation; 20-patient ward simulation; GLS fusion validation; alert-budget and provenance-safety testing.
Phase 2CurrentPublic platform (this site) with interactive demonstration; remote demo deployment on Railway.app for evaluation access.
Phase 3PlannedFHIR-simulator interoperability testing; pilot EHR integration with partner institutions.
Phase 4PlannedFormal clinical validation study measuring impact on patient outcomes via Decision Curve Analysis and logged bandit evaluation.

About the ProjectReza Ghiyasifar

RezpharmaCDSS is an independent research implementation of the architectural blueprint "From Sketch to Statistically Sound Code" — a complete, locally-runnable polypharmacy CDSS built and validated end-to-end on standard hardware, with no cloud services or external APIs after setup.

The system embodies provenance-tracking probabilistic fusion, hierarchical Bayesian PK/PD, kinetic GFR, quantitative imaging covariates and decision-theoretic alert budgeting — evaluated by simulation-based ward studies and Decision Curve Analysis.

Educational & research use only. This software is not a substitute for professional clinical judgment and requires formal clinical validation before use in patient care.

Get in TouchContact & Inquiries

For institutional deployment, research collaboration, or speaking and media requests. Replies within 48 hours.

Reza Ghiyasifar

Polypharmacy CDSS — Research & Implementation

  • Email: ghiyasifarreza@gmail.com
  • Web: rezpharmacdss.me
  • Include your organization and role
  • Describe the intended use case (deployment, research, training)