Skip to content

Epic

  • Register a backend app through Epic’s developer programme, using SMART Backend Services with a JWT signed by a key in your JWKS. system/*.read-style scopes.
  • Each health system runs its own Epic instance with its own FHIR endpoint, and must activate your app in its environment. Your app working at one health system says nothing about the next.
  • The token URL can be derived from the FHIR base: replace /api/FHIR/R4 with /oauth2/token.
  • Epic’s sandbox has a small, documented set of test patients — useful for proving the flow, not for volume testing.

Patient-level search. Bulk $export needs a patient Group that the health system builds for you, so in practice most quality-reporting integrations start from a patient list:

  1. Match each patient with Patient?given=&family=&birthdate=, adding address-postalcode when you have a ZIP to tie-break.
  2. Search the clinical resources for that patient, for example Observation?patient=<id>&code=<comma-separated LOINCs>&date=<period>.
  3. Follow link.next — do not assume one page holds everything.

Epic rejects an Encounter search that filters only by date: it returns HTTP 400 unless the request also names a patient or an _id. You cannot ask for “all encounters in the measurement period” with patient-level search; the cohort has to come from a patient list, a Group export, or another source.

When bulk access was enabled on an existing app registration, token requests began failing with invalid_client until the registration was corrected. If you change an app’s capabilities, re-test authentication immediately.

PHQ results may not be structured Observations. They can appear only inside clinical notes (DocumentReference with an HTML attachment), which then has to be parsed.

Intermittent failures on Patient search are common enough that a few retries with a short pause are worth building in.