PATIENT TRAJECTORY MATCHING · ROADMAP

What exists and what comes next

As of 22 November 2026. This is a research codebase, not a product: the completion register records full-product completion as false, and nothing here is a clinical claim. Scale evidence is synthetic data on one machine. Each item names the decisions (D-numbers in docs/decisions/engine-increment-log.md) or documents behind it.

← all mockups · results and evidence · plain-language summary: docs/decisions/briefing-2026-11.md

✓ Built → Next ○ Later, only if needed ? Needs a decision from the project
1,000,000synthetic patients built and verified in one store, under a 4 GB database limit
9.30 s95th-percentile query at 300,000 patients, 14 workers, paired confirmation at the engine's default search budget (target 10 s, set in advance)
668,862MIMIC-IV demo chart rows ingested and every one checked, 0 mismatches
1,241contract checks run on every push

✓ Built

Working code with tests and committed evidence.

Trajectory matching engine

A trajectory is steps plus timing constraints, as a sequence, a tree or a graph. Every patient gets a result, and the kinds stay apart: exact, possible, relaxed, unresolved, none and not comparable. Relaxations are priced within budgets, each event has one time, and an event can be marked as ending strictly after it starts. "First" and "last" are sound when the records leave their order uncertain: decided on the times the true first (or last) can take where that is exact, unresolved otherwise, and checked against every choice of times on small cases.

D13, D21, D24, D30 · docs/trajectory-graph-profile.md · mockup: Define a trajectory

Patient-first similarity

Start from one patient's history and rank others. Concept similarity offers simGIC (the default), ancestor-Jaccard and best-match Resnik, with a selector.

mockup: B · Start from a patient

SULO source adapter

Turns bounded, patient-local and claim sources into the engine's input and checks every answer against the source's own time network. Shared source times are kept exactly. What it cannot represent it refuses, rather than guessing.

D8, D9, D22, D24 · docs/trajectory-graph-sulo-adapter.md

Execution store

DuckDB writing immutable Parquet snapshots. A snapshot is identified by a digest of its rows, and every build is verified by content. Patients stream in, so memory stays bounded. Candidates are pruned on stored time summaries before events are loaded, and matching runs in parallel worker processes, in Python.

D4–D7, D19–D26 · docs/execution-store.md · results

MIMIC-IV demo pipeline

The open demo's input events go through the full graph route. Chart events are built in bulk from the importer's claim identity, with every row and every store also checked on the demo. Rows that cannot be admitted are kept as excluded records, so the store says not comparable rather than a false none. Committed reports carry aggregate counts only.

D11, D14–D18, D27 · docs/execution-store.md

Packaging

The engine and store install as a Python wheel, and installed code reads the same files as a checkout. Not published.

D1–D3

Research workspace

A bounded research workspace runs an integrated synthetic research journey. Against the full specification it is partial: the completion audit records 10 requirements supported, 64 partial, 4 blocked and 26 specification-only.

app/ · docs/status.md · docs/completion.md

Queries on measurement values

A step can carry a condition such as "heart rate above 120 per minute" or "MAP below 65 mmHg", matched exactly on the stored values with the unit matched literally. Relaxing a threshold only ever adds patients, and excluded rows of the same item make a result not comparable. The matching engine itself is unchanged; the store compiles each condition into a tag for that query.

D28 (chartevents stage 2) · docs/execution-store.md

Store query page (stage 1 of the mockups on the store)

A mockup page builds trajectories on the MIMIC-IV demo's item classes, with value conditions and relaxations, and runs them in the execution store on the server. The server sends back aggregate counts only and refuses any snapshot that is not the open demo; tests check both. The server checks that the store holds the open demo's own patients, not just its label. Counts alone are not disclosure control, so it serves only the open demo. On the synthetic cohort, built by the converter itself emitting measurement values (D32), the store and the trajectory page agree on 555 of 672 patient results over fourteen trajectories, four of them with Nth occurrences and counts; each of the other 117 has a named cause from a closed list (letter mentions, merged records, medication courses, unitless measurements, uncertain first or last targets, the store's coverage rule, and, for Nth and counts, the store's envelope and its exact count timing against the page's record ranked N and its runs).

D29 · demos/mockups/README.md · mockup: Store query

The store answers the trajectory page

The trajectory page asks the execution store for its answers by default. The store takes in what the page can ask for: Nth occurrences, counts, gene steps and measurement values. It refuses the rest by name, and the page then matches in the browser, labelled "in-browser fallback" with the reason. On the synthetic cohort the page and the store agree on most results, and every difference has a named cause.

D37 to D44b · demos/mockups/README.md · mockup: Define a trajectory

"Coded records only" is the default

Under this setting nothing reads clinical notes, in the store or in the page's own search. All five page templates are answered by the store. The evidence options now read "Coded records only", "Coded records + findings stated in clinical notes" and "Coded records + uncertain findings in clinical notes". The owner chose this default after a readiness check found it sound and useful.

D45, D49, D53

No page uses the synthetic truth

The page no longer reads the generator's hidden truth to group records into events or to place index periods. It uses a stated grouping rule, reconcile_v1, and records it cannot place are listed rather than guessed. Its timeline, inspector, own search and the patient-first page follow the same rule.

D46, D47

Uncertain anchor dates are accounted for

The index anchor, such as the first seizure, is now a hidden step of the query. The server narrows each window to the hull of the dates the records allow, then simplifies the hidden step. At 300,000 patients the 95th-percentile time is 7.8 s for Event frequency and 8.5 s for Blank, against a 10 s target. Shapes it cannot rewrite keep a point window, with a note. Trade-off under findings stated in notes: Sequence, Tree and Graph are mostly unresolved, while Blank becomes mostly exact.

D52, D52b, D52c, D52d

No unresolved searches in the benchmark

A search that has spent 1,000 steps checks once whether its steps' time ranges admit any choice at all, and stops complete when they do not. Every search that decided before decides as it did. At the default budget the benchmark has no unresolved result at scale.

D48b (D48 first)

Hosting on ids3, built but not deployed

A plan and draft manifests are written for the ids3 cluster. Sign-in uses Keycloak, with the owner approving each new account. Access is per dataset: synthetic data public, the MIMIC demo for approved users, and full MIMIC-IV refused for now. The design went through three review rounds and was hardened for security. Nothing is deployed.

D50 · docs/hosting-plan.md · deploy/ids3/ptm/dev/

Letter dates read from the letter's wording

An option, off by default, times a letter mention from the wording of its own sentence ("at 8 months", "last week") instead of from birth to the letter. Under findings stated in notes, Blank's exact results go from 1 to 168 of 1,102. It is sound on the generator's own wording only, so it needs a held-out wording test before it could become the default.

E0, E0b

Measurement protocol

Speed changes are judged with control-normalised timing, so slow drift across a session does not count as a change. Count requests are judged by the median over pairs, which a follow-up check found settles the Nth and count slowdown question as no slowdown. When two committed rules conflict, the record says which one governs, and the older report is frozen as historical.

D44, D51, D48b, D53

Faster builds and checks

Writing canonical rows a column at a time cut the 1,000,000-patient build by 12.0% and its content check by 38%, with identical content digests (snapshot identifiers change with the builder), under a rule set before measuring.

A change to matching alone no longer forces the scaling report's 1,000,000-patient build: each build records every repository file it loaded or read, and a later run may reuse the kept snapshots when a small probe build records the same (D34; first used at scale by D35, again by D36: 1,740 s each, against 9,197 s). The engine was split so that a build loads no matching code, with results unchanged.

D26, D28, D34, D35, D36

Realistic search budgets in the benchmark

Every benchmark query now runs at the engine's default search budget (40,000, what the pages send), with its shape unchanged; the old drawn budgets (1, 40, 300) are kept apart as a labelled stress test. "Unresolved at scale" was a benchmark artefact: 38 at 1,000 patients and 363 at 10,000 become 0 and 1 (one patient whose search still stops at 40,000), every moved result going from undecided to decided. The latency target still holds at 14 workers (p95 9.30 s); seed 19's searches, which used to stop at once, are now the p95.

That one patient is now decided too (D48b): a search that has spent 1,000 steps checks once whether its steps' time ranges admit any choice at all, and stops complete when they do not. Every search that decided before decides as it did, binding for binding; at the default budget "unresolved" at scale is now 0.

D35, D40, D41, D48, D48b

→ Next

Listed as next steps in the design documents; not started.

Richer measurements

Textual and unitless measurements (most of the 518,809 demo chart rows excluded today are one or both), unit equivalence, and reviewed item mappings.

D27 stage 3

Selection "as known at" a date

Records carry when they became available, but selection uses the latest version today. Applying availability would let a study see only what was known at its index date. The typed record fields of store 3.0 are what this needs.

D26 · docs/execution-store.md, "Deliberately not done"

Incremental appends

Adding patients without rebuilding the whole store: per-bucket digests, so an append rehashes only what it touches, with a per-patient (Merkle) input digest wired in at that point.

D23, D27

Fewer "not comparable" answers

The exclusion rule reads only a query's scope. Reading its anchor relations too would turn fewer results incomparable, once differential tests cover it.

docs/execution-store.md, "Next"

More source shapes

Sources whose time constraints link events to each other, beyond what per-event bounds express. These need the engine to take constraints between events.

D22

Text extraction and linking

Reading clinical text and linking each mention to the coded record it restates, so that stated findings stop counting twice. This is the extraction study's next piece.

E0b follow-ups · extraction study

The generator reuses truth ids

The synthetic generator gives one truth id to two events in places. Scorers have to work around it by concept; fixing the generator removes the workaround.

E0b

One course's stop grouped differently

For patient C026's prednisolone course the page and the store group the stop record differently, under every setting. Making them agree is queued.

D53

The count tool's subset defect

The count-latency tool crashes after its timed runs when it is given a subset of requests, and loses its report. The fix needs the bar to apply only when its request runs, and results to be written as the run goes.

D51

Interface mockups A and C

Sketching a trajectory directly, and a live cohort funnel.

mockups

○ Later, only if needed

Deliberately deferred, each with the condition that would bring it back.

A Rust matching engine

Built only if Python misses the latency target and algorithmic work cannot recover it. Python meets it at 300,000 patients with 14 workers, so none was built. D30's sound first and last cost time (p95 9.46 s against 10 s). D31 replaced a repeat search for coupled first and last steps by one envelope search; a first attempt was reverted when run-to-run drift swamped the measurement, and a second, judged by a new paired protocol (both codes back to back, alternating order), kept it: p95 at 14 workers 8.49 s against main's 9.45 s in the same session: p95 12–20% lower in every pair, almost entirely one query (seed 26); total time per run unchanged (0.97–1.02); the slowest query unchanged. At 8 workers it is still missed (10.17 s). D32 (Nth occurrences and counts) left the path unchanged: paired p95 ratios 1.001 to 1.010 against main at 14 workers, p95 8.10 s (replication 8.51 s); at 8 workers about 10 s, on the line. A Rust engine would be a second implementation over the same snapshots, with the Python path as its reference.

D7, D21, D30, D31, D32

Embeddings and a nearest-neighbour index

Added only if recall at full scale needs it. Concept information content comes from the stored counts.

D7

Postgres

Kept for jobs, results and audit, not for the patient store.

D7 · FR-060, FR-061, FR-081

? Needs a decision from the project

Not engineering choices; these need the project's owners or reviewers.

Hosting and deployment

The plan and manifests are built. We are waiting on the owner to name a backup Keycloak admin and to give the go-ahead to open the services-repo PR. The admin's Keycloak and Vault steps follow. Retiring the trajectory page's browser path (stage 3) waits for deployment.

D50

Stated findings with uncertain anchors

Keep the new behaviour (Sequence, Tree and Graph mostly unresolved, Blank mostly exact), or return to point windows.

D52 to D52d

Clinical review

The MIMIC store indexes the source's own item classes, not clinical concepts. Clinical mappings wait for a qualified reviewer.

Full MIMIC-IV

Conditions accepted on 2026-11-20: each user's PhysioNet credentialing is verified and recorded, a storage and backup review comes first, and credentialed users see per-patient results. It is still not hosted; reports commit aggregate counts only.

D17, D50

Publishing

Whether and when to publish the package, and its import name before that.

D1–D3