What I've Been Working On
February was heads-down on a project I've been looking forward to for a while: building a CDS Hooks service from scratch. Alongside that, TypeScript strict mode taught me a few humbling lessons, and I finally finished a book on healthcare interoperability that's been on my shelf too long.
Building a CDS Hooks Service
CDS Hooks is an HL7 standard that lets external services inject clinical decision support into EHR workflows at specific trigger points — called "hooks" — like patient-view or order-sign. The EHR sends a JSON payload to your service, and you respond with "cards" that surface recommendations to the clinician.
The core request/response cycle is straightforward once you get past the spec:
// Minimal CDS Hooks response
interface CDSResponse {
cards: Card[];
}
interface Card {
summary: string;
indicator: "info" | "warning" | "critical";
source: { label: string; url?: string };
suggestions?: Suggestion[];
}
A few things I ran into during the build:
- Prefetch bundles can get large fast — be selective about which FHIR resources you request in the service definition
- The
fhirAuthorizationobject is optional in the spec but effectively required if your cards need to fetch additional patient data - SMART on FHIR scopes need to be declared upfront; the EHR won't grant anything you didn't ask for
The service is running in a staging environment now. Next step is wiring up real drug-interaction logic.
TypeScript Strict Mode Lessons
Enabling "strict": true in an existing codebase is always an adventure. The two errors that showed up most often were implicit any on untyped callback parameters and non-null assertions hiding potential runtime crashes. The fix is usually straightforward — add a type, use optional chaining — but it forces you to think carefully about every assumption you've been quietly making.
The payoff is real though. Strict mode caught two places where I was accessing a property on a value that could have been undefined at runtime. Better to find that in the compiler than in a production incident report.
Reading: Achieving Healthcare Interoperability
I finally worked through Achieving Healthcare Interoperability by Grahame Grieve and colleagues. It's dense but worth it if you're building anything in the FHIR ecosystem. The chapters on resource design philosophy and the tension between clinical flexibility and machine-readable structure are particularly good. Recommended for anyone who wants to understand why FHIR looks the way it does, not just how to use it.
That's February. March is shaping up to be more CDS Hooks work plus some exploration of SMART App Launch 2.0. More soon.