Portfolio  ›  Projects  ›  Clinical Decision Support
Python Clinical Rules Streamlit

Clinical Decision Support,
Rebuilt From Scratch

The original source was unrecoverable, so this is a new build. Six published clinical scoring rules implemented as a transparent calculator — one that never returns a number without the criteria, the arithmetic, the citation and the limits that produced it.

◆ Local Prototype · rebuilt 2026-08-18, 63/63 checks
Context: Rebuild after failed recovery  ·  Role: Sole author
Original: 0 bytes on disk, 0 bytes in the Feb 2026 backup — nothing recoverable
This build: Written 2026-08-18 · no clinical logic invented · every rule cited
6Published rules
63/63Checks passing
0Rules invented
0Third-party deps in engine
⚠️ Read the Safety Framing 📁 Why It Was Rebuilt
Safety

Not a medical device

🚫 What this is not

This is an educational / research prototype. It is not a medical device, is not clinically validated, has no regulatory approval, and is not for use in patient care.

It does not diagnose. It does not recommend treatment. It does not replace clinical judgement or local protocol. It is a calculator that adds up published criteria and shows its working.

That disclaimer is not confined to this page. It renders before any input field, on every run of the application — not tucked into a footer where a screenshot could omit it.

⚖️ The distinction that governs the whole project

The underlying rules are validated in the peer-reviewed literature. This implementation of them has been tested for arithmetic correctness only. Those are different claims, and conflating them is how a calculator starts being mistaken for a clinical instrument.

Origin

Rebuilt, not recovered

This project entered the recovery pass as the one genuinely unrecoverable item. The evidence was conclusive:

AI_Pipelined_Projects/clinical-decision-support-system-main/app copy.py

    Length             0
    CompressedLength   2
    LastWriteTime      2026-02-11

The single surviving file was already 0 bytes when the February 2026 backup was taken. A search across all 40+ archives in the repository, plus every filename and file content, found no source, documentation, dataset, screenshot or log. There was no earlier state to restore from.

❌ Nothing here reproduces the original

Everything in the project directory apart from the recovery note and the original 0-byte file was written from scratch on 2026-08-18. It does not reproduce, approximate or stand in for the original implementation — because nothing is known about the original beyond its name.

The status label on this page says rebuilt, dated to when it was written. Presenting new code as recovered original work would be fabrication, and in a medical domain it would carry implied clinical claims that no evidence supports.

What "rebuild" had to mean here

The temptation

Write a plausible clinical decision support system — a diagnosis engine, a symptom checker, a treatment recommender — and let it fill the gap. It would look impressive and be entirely unfalsifiable, since there is nothing to compare it against.

The problem

Every one of those requires clinical logic, training data or validation this project does not have. Inventing them would mean inventing medicine.

What was built instead

A calculator over published, citable clinical rules. Implementing the Wells score correctly is engineering. Inventing a scoring rule would be something else entirely. Every criterion, weight and threshold here is transcribed from a named paper, and none has been tuned, fitted or modified.

Implemented Rules

Six rules, six citations

RuleQuestion it answersSource
Wells DVTHow likely is DVT before imaging?Wells PS et al., NEJM 349(13):1227-1235, 2003
Wells PEHow likely is PE before imaging?Wells PS et al., Thromb Haemost 83(3):416-420, 2000
CHA₂DS₂-VAScAnnual stroke risk in non-valvular AFLip GYH et al., Chest 137(2):263-272, 2010
CURB-65Pneumonia severity and site of careLim WS et al., Thorax 58(5):377-382, 2003
qSOFARisk of poor outcome from sepsisSinger M et al., JAMA 315(8):801-810, 2016
Centor / McIsaacLikelihood of strep pharyngitisMcIsaac WJ et al., CMAJ 158(1):75-83, 1998

Each rule also carries its own limitations list in code — population it was validated in, what it does not establish, and where local guidance overrides it. The test suite asserts every rule has at least two.

Design

A score alone is an oracle

The governing design constraint: never return a number without the reasoning that produced it. A bare score invites trust it has not earned. A score with its criteria, arithmetic, citation and limits is something a clinician can check and disagree with.

🧮 Real output — 78-year-old woman with hypertension and diabetes, in AF

CHA2DS2-VASc (stroke risk in non-valvular AF)  =  5

  [ ]     .  C — Congestive heart failure / LV dysfunction
  [x]    +1  H — Hypertension (or on treatment)
  [x]    +2  A2 — Age >=75 years
  [x]    +1  D — Diabetes mellitus
  [ ]     .  S2 — Prior stroke, TIA or thromboembolism
  [ ]     .  V — Vascular disease
  [ ]     .  A — Age 65-74 years
  [x]    +1  Sc — Sex category female

  TOTAL: 5
  BAND:  High risk — Oral anticoagulation generally recommended unless
         contraindicated. Assess bleeding risk alongside (e.g. HAS-BLED).

  NOT SUPPLIED (counted as absent — score may be an underestimate):
    - C — Congestive heart failure / LV dysfunction
    - S2 — Prior stroke, TIA or thromboembolism
    ...

  Source: Lip GYH et al. (2010). Chest 137(2):263-272. doi:10.1378/chest.09-1584

Safety behaviours built into the engine

"Not asked" ≠ "absent"

  • Unticked criteria count as absent for arithmetic
  • But are reported by name as not supplied
  • With a warning the score may be an underestimate
🛑

Typos cannot lower a score

  • Unrecognised finding keys raise
  • Rather than being silently ignored
  • A misspelled criterion can't quietly vanish
⚖️

Impossible inputs rejected

  • CHA₂DS₂-VASc age bands are exclusive
  • Setting both would give an impossible 10
  • Raises instead — same for Centor
Verification

63 checks, aimed at one specific failure

🎯 What the suite is actually for

Not coverage. The failure mode that matters here is a transcription error in a criteria table — a wrong point value produces a plausible-looking number that is silently incorrect and impossible to spot from the output.

So expected totals are hard-coded from the source papers, not from this implementation's own output, and the boundaries are tested specifically:

BoundaryWhy it is easy to get wrong
Wells PE: score 6 is moderateThe high band starts above 6, not at it
Wells DVT: two-tier vs three-tier"Likely" starts at 2; "high" starts at 3 — different cutoffs
CHA₂DS₂-VASc max is 9, not 10The two age bands are mutually exclusive
CURB-65: score 1 is still lowModerate starts at 2
qSOFA: score 1 is not metPositive starts at 2
Centor minimum is −1Age ≥45 subtracts a point

🐛 Two defects the suite caught during the build

CHA₂DS₂-VASc and Centor/McIsaac both lacked an explicit statement that they do not diagnose. A blanket assertion across all six rules failed, and the fix was to the rules, not to the test. Both now carry one.

That is the kind of omission that matters more in this domain than in most: a scoring rule presented without its scope invites being read as a diagnostic verdict.

CheckResult
Validation suite63 / 63 pass
Streamlit bootsHTTP 200, /_stcore/health → ok
Every rule carries a citationPass
Every rule declares ≥2 limitationsPass
Every rule states it does not diagnosePass
Unrecognised finding key rejectedPass
Mutually exclusive age bands rejectedPass

💻 Run it

python -m venv .venv && .venv\Scripts\activate
pip install -r requirements.txt

streamlit run app.py         # http://localhost:8501
python -m tests.test_rules   # 63 checks

The rule engine has no third-party dependencies — only the UI needs Streamlit, and the test suite runs on a bare Python install.

Limitations

What is deliberately missing

💊

No drug logic

  • No interaction checking
  • No dosing, no allergy checking
  • Would need clinical datasets this project does not have
📋

No guideline tracking

  • Thresholds differ between ESC, AHA/ACC and NICE
  • Bands reflect the cited papers
  • Which are not always current practice
👤

No patient context

  • No records, no persistence
  • No authentication, no audit log
  • It is a calculator

Those omissions are the point rather than an oversight. Each one would require clinical data or validation the project does not have, and building them on guesswork is precisely what this rebuild was written to avoid.

Engine
Python 3.12dataclassesZero dependencies
Interface
Streamlit
Practice
63-check suiteCitation per ruleLimitations per ruleMissing-input tracking

The honest version of an unrecoverable project

The original is gone and stays gone. What replaced it implements published medicine correctly rather than inventing plausible medicine — and says clearly, on every screen, that it is not a medical device.