The following is based on a talk given by Flexpa Co-founder and CTO Joshua Kelly at the FHIR DevDays 2024 in Minneapolis in January 2024: Syncing Resources Between Distributed FHIR Servers a talk on Flexpa's experience building patient record retrieval at scale in the CMS 9115 network.
If you're starting on this problem today, Flexpa provides a real-world conformance service. See more at E2E Interoperability Testing with Flexpa for CMS-9115 and CMS-0057
The challenge seems deceptively simple: build an agent that can connect to any patient access API on a FHIR server and discover all available resources for a patient. However, when you're dealing with hundreds of different implementations, the complexity quickly compounds.
To keep this discussion focused, we'll set aside several related challenges:
Instead, we'll concentrate on three core issues:
Let's dive into the nine specific challenges we encountered.
The FHIR specification provides what seems like the perfect solution: the patient $everything operation. One request should return all patient data. Unfortunately, we discovered in our latest State of the Patient Access API Report that fewer than a third of payers actually support this operation - it wasn't considered in the IG development for payer patient access APIs in the US.
Even when supported, we encountered several issues:
FHIR allows batch transactions with read and search operations, which seems like another elegant solution. However, this feature is rarely supported by patient access APIs. It's another example of a theoretically perfect solution that proves impractical in the real world.
When falling back to individual search operations, we discovered that capability statements aren't always trustworthy. They can:
Connecting to hundreds of FHIR servers reveals a world of non-spec requirements. Some implementations need extra headers or have unique connectivity requirements that aren't part of the standard specification.
When processing returned resources, you need to resolve references (like an encounter referencing an organization). This creates several challenges:
Rate limiting presents its own set of challenges:
FHIR's use of strings as logical identifiers creates unique challenges when aggregating data from multiple sources:
When dealing with hundreds of FHIR servers, perfect validation becomes impractical. Following Postel's Law becomes essential: be liberal in what you accept and conservative in what you send. Sometimes you'll need to rewrite data to meet specific profile requirements.
The final challenge comes with storing potentially tens of thousands of resources for patients with long health histories. Our recommendations:
Building a system to sync FHIR resources at scale has taught us several key lessons:
The variance in FHIR implementations across different organizations creates a complex landscape for developers. Success requires a pragmatic approach that combines theoretical best practices with practical fallback solutions.
At Flexpa, we've navigated these challenges to build a robust network connecting hundreds of payer APIs. As the healthcare API ecosystem around patient access continues to evolve, we hope sharing these experiences helps others building similar systems.
At JPM this year? Join us in person in San Francisco on January 15, 2025 for Medplum & Flexpa: Devtools for research, commercialization and more in life sciences. We'll show you how to build specialized healthcare applications in life sciences. Register for an invite and let us know that you want to come to this engineering focused event.