SPEX for quick FHIR patient queries

TLDR: Use SPEX to view raw JSON results for FHIR queries against production and test servers. It’s a simple, static, open source web app. Your health data stays on your device, not mine. I hope you find it useful!

The Why

It seems like every few months I end up working on FHIR apps for some reason. And every time I do, I need to spelunk around health record JSON to figure out what the heck is going on because, as they say, healthcare data sucks.

I also spend a lot of time testing with my own health data, because while everybody loves fhirdaisy and wilmasmart, and Synthea is super-cool — the really weird stuff only happens in real life, with real docs and nurses treating real problems in real time.

But it turns out that just getting your data in FHIR format is kind of a hassle. And while I’m sure ten minutes from now somebody will point me at their app that does the same thing, I’ve looked around a lot without success. So Claude and I spent a few hours putting together a super-simple, super-basic tool to query SMART on FHIR servers. More importantly, we registered it with Epic (it’ll work for other EHRs too) so you can use it to access real records. Woot!

The What

Easy peasy. Search for an institution, enter your credentials and approve the app, and run some queries. Currently the list includes most Epic sites and the Epic, Cerner and SMART sandboxes. I’m happy to add production sites for other EHRs if there’s demand.

If you’re building your own patient app, use SPEX as a development tool by entering your own public client id, server URL and data scopes in the “custom server” area. To make this work, remember to configure https://fhirspex.z5.web.core.windows.net/ as a redirect URL for your client (or just run the app yourself).

As a bonus, SPEX is a really easy way to narrow down auth problems between the EHR and your code — if the client is set up and propagated correctly, SPEX will work.

The tiny download icon in the top-right of the content area lets you download results.

And just to reiterate because it’s important, SPEX is a static, client-side-only app. Any health information you download goes from the FHIR server to your device and stays there unless YOU do something else with it. I am not skimming your immunization record!

And that’s all she wrote. I may add features as I need them, and happy to take requests, but it’s already been super-handy to have as a quick assist, especially when debugging data issues in already-in-production code.

The How

The code is all up on github at https://github.com/seanno/spex. It’s MIT-licensed, so copy it, make it your own, whatever you like.

To run it yourself, clone the repository, npm install, then npm run dev. You’ll be up and running on https://localhost:3001. npm run build will give you a “dist” directory that contains the app as a static website.

Really not much else to it. Go nuts!