Every branch is built from the 2026 AHA/ASA guideline, CSBPR 2022 and its 2025 EVT update, and the Thrombosis Canada guide — with a verbatim citation, page number, and grade behind every recommendation. Free-text input is turned into a typed patient state with TypeSafe, then evaluated by the same engine that runs inside CodeStrokeApp.
The AHA/ASA and Canadian (CSBPR) stroke guidelines run to hundreds of pages combined, and they don't always agree with each other. A team standing at the bedside needs a fast, specific, defensible answer — and needs to know exactly which page of which guideline that answer came from.
TypeSafeStroke pairs a small language model (TypeSafe) that turns free text — an EMS handover, a history, a medication list — into typed, confidence-scored inputs, with a decision tree authored directly from the guidelines, node by node. The tree's design draws directly on TypeSafe's System One primitives — typed Choice judgments, code owning the workflow while the model supplies the judgment, uncertainty tracked rather than collapsed into a guess — even though the tree itself never calls a model to decide. Within the bounded space of the guidelines, a decision framework can be deduced — not a clinician's judgment, only what the cited recommendations say. Nothing is inferred silently: unknown is never read as no. When the tree is missing something it needs, it stops and says exactly what. Run it yourself, or browse the 50 case scenarios that gate every change to it.
A second, experimental track asks a different question: instead of walking the authored tree, can a language model make the same calls directly? TypeSafe's System One models, including Jev, return typed judgments and probabilities rather than generated text. A separate evaluation (TypeSafeWorkJev) tested this live against Jev itself, using its own 42-case set — 24 hand-written plus 18 generated boundary cases, a different subset and approach from the 50 scenarios above. Asked for the final grade in one shot, it isn't usable — 42% accurate. Decomposed into small sub-questions and synthesized by this same deterministic engine, it reaches 95%, with one confirmed, narrow gap. See the method and results, or the 42 eval cases themselves, tree and Jev verdicts side by side.
EMS handover, chart history, med list — whatever's on hand, unstructured.
TypeSafe infers structured fields with asymmetric confidence thresholds; anything uncertain stays unconfirmed rather than guessed.
A three-valued tree — true, false, unknown — walks phase-ordered modules and stops rather than assumes.
Every recommendation carries its source, section, page, and grade — ready to check against the guideline itself.
This tree runs in Swift inside CodeStrokeApp and in JavaScript on this page — two independent implementations of the same semantics, checked against each other on every one of the 50 test scenarios below. It's slated to replace CodeStrokeApp's current hard-coded EligibilityEngine, whose rules already differ from the sources in places this project corrects.
Swift and JavaScript engines are parity-tested against the same scenario suite on every rebuild.
A missing input halts a decision and records what's needed — it never falls through to a false branch.
Every open question is tracked in the open below — nothing here is presented as finished.
Load a case, or build one field at a time, and see the outcomes and citations the tree produces — the exact same artifact this project ships.
Pediatric occlusions, basilar strokes, DOACs without a level, malignant edema, incomplete histories — grouped by theme, each running live.