OTTEHR TRACK TASK
You are Cedric (Codex), worker #3: the OTTEHR TRACK. Andrew wants the SAME demo shown two ways, built in parallel: - Way 1 (the other worker): a custom .NET 10 / EF Core / Vue pipeline that integrates WITH an EHR. Already built. - Way 2 (you): the same patients and the same predictive-medicine risk rules built ON the open-source EHR, Ottehr (github.com/masslight/ottehr), running on Oystehr (the headless FHIR backend). This is the platform Innovare is migrating to: Allscripts → Ottehr → their own EMR.
You touch ONLY ehr-track/ and docs/ottehr-track.md. Never edit src/, web/, tests/, infra/, forge-studio/.
Steps:
1. Read the Ottehr README/setup docs and docs.oystehr.com (getting started, M2M auth, Zambdas, FHIR API). Write a short, accurate summary in docs/ottehr-track.md:
- how Ottehr runs locally
- what it needs (an Oystehr project, M2M client, env files)
- Node version
- the commands
- the FHIR base URL
Cite each fact with its URL. Do not guess.
2. Pin Ottehr. Add Ottehr as a pinned clone (a git submodule at a specific commit, or a scripted clone at a recorded SHA) under ehr-track/ottehr. Do not vendor its node_modules.
3. Setup scripts (PowerShell, in ehr-track/scripts/):
- setup.ps1: checks Node, installs deps, and writes Ottehr's env files from env vars OYSTEHR_CLIENT_ID, OYSTEHR_CLIENT_SECRET and OYSTEHR_PROJECT_ID. It never writes secrets into git-tracked files, and adds a .gitignore for the env files.
- seed.ps1: loads the SAME synthetic patients (the 10 Synthea fixtures in data/fixtures + the Ottehr samples) into the Oystehr project. Dry-run by default, printing the planned writes; it writes only with -Apply AND OYSTEHR_SEED_CONFIRM=I_OWN_THIS_PROJECT.
- run.ps1: starts the Ottehr EHR app locally.
- NEVER run -Apply or any write to Oystehr yourself. There are no credentials on this machine; that's expected.
4. Predictive medicine ON the platform. Implement the SAME risk rules (A1c range/trend, repeated elevated BP from the same panel, flu-gap care gap, and ASCVD only with explicit inputs) as an Oystehr Zambda (serverless function; TypeScript is fine here because that is the platform's language, so record the deviation in docs). It returns CDS-Hooks-style cards with cited FHIR ids, matching Way 1's output shape.
- Add a deploy script (dry-run by default).
- Unit-test the rules against the SAME fixture patients, and assert the SAME flags as Way 1. Port the expectations from tests/FhirDemo.Tests/RiskTests.cs; read it, don't edit it.
- Show the cards in Ottehr's EHR UI if there's a clean extension point (a patient chart panel). Otherwise write exact instructions on where they'd mount, and make a small standalone page in ehr-track/ that calls the Zambda and renders the cards.
5. Parity proof: a script ehr-track/scripts/parity.ps1 that runs Way 1's risk engine (dotnet CLI) and Way 2's rules (node) on the same fixtures and diffs the flags. It must report identical flags per patient, or list the differences with reasons.
6. docs/ottehr-track.md:
- a 60-second demo script ("same patient, same flags, two ways")
- a table: Way 1 vs Way 2 (who owns the UI, data store, auth, where the rules run, deploy model, cost, lock-in, when you'd choose each)
- what was verified vs what needs Andrew's Oystehr credentials
DONE: - Unit tests for the Zambda rules pass. - parity.ps1 shows the flag diff (expected: identical). - setup.ps1 runs in dry-run without credentials and reports exactly what's missing.
Put the REAL outputs in docs/ottehr-track.md under "Verification". Commit per step with git -c user.name="Andrew Jones" -c user.email="andrewjonesdev1@gmail.com" commit and the Co-Authored-By trailers for Cedric (Codex) and Claude Opus 5.5. Then git push origin HEAD.