Production-grade access is free with an account. · Synthetic demo · no account needed

FinchNode

Patient-authorized EHR integration

Fetch patient data with a FHIR API: Patient, labs, conditions, and medications.

A practical TypeScript pattern for reading common patient resources without assuming that every FHIR server behaves identically.

Updated: 2026-08-25 · 11 min read

The bottom line

Read the Patient resource first, then issue patient-scoped searches for the clinical resources your app is authorized to access. Follow the server’s Bundle `next` links verbatim, retain provenance, and distinguish an empty search from a failed search.

Key takeaways

  • A successful FHIR search returns a `searchset` Bundle, including when it contains zero matching resources.
  • Follow the server-provided `next` URL rather than constructing page numbers yourself.
  • Do not assume MedicationRequest alone represents every medication list returned by every source.

Evidence boundary: Examples follow FHIR R4 REST and Bundle semantics and use fictional URLs and patient identifiers.

Author: FinchNode Engineering

Start with an explicit request plan

Common patient data categories and representative FHIR R4 resources
Product categoryFHIR resources to evaluateImportant fields
DemographicsPatientname, birthDate, gender, address, telecom
Labs and vitalsObservation, DiagnosticReportstatus, category, code, value, effective date, reference range
ConditionsConditionclinicalStatus, verificationStatus, code, onset
MedicationsMedicationRequest, MedicationStatementstatus, intent, medication, authoredOn

Representative patient-scoped searches

Search support is advertised by a server’s CapabilityStatement and implementation guide. Treat these URLs as patterns, not a promise that every source accepts every parameter.

GET {fhirBase}/Patient/{patientId}
GET {fhirBase}/Observation?patient={patientId}&category=laboratory&_count=100
GET {fhirBase}/Condition?patient={patientId}&_count=100
GET {fhirBase}/MedicationRequest?patient={patientId}&_count=100

Accept: application/fhir+json
Authorization: Bearer {accessToken}

Normalize after preserving the source

  • Store the FHIR base, resource type, logical ID, business identifiers, and `meta.lastUpdated`.
  • Keep coding systems alongside display text; do not collapse different code systems into an unlabeled string.
  • Represent missing values as unavailable instead of inventing defaults.
  • Deduplicate only with source-aware identifiers and domain-specific rules.
  • Keep the raw source resource or an integrity-protected reference when your policy permits it.

Primary sources

More FinchNode interoperability guides

Frequently asked questions

What does an empty FHIR search return?

A successful search normally returns a Bundle of type `searchset` with zero entries. That is different from a failed search, which should return an error status and typically an OperationOutcome.

How do I paginate through FHIR results?

Follow the Bundle link whose relation is `next`. Do not infer or rewrite the continuation URL because servers can use opaque paging state.

Which FHIR resource contains lab results?

Individual laboratory results are commonly represented as Observation resources, often with related DiagnosticReport resources. The exact profiles and search support depend on the server.

Can I fetch every patient record with one request?

Some servers support Patient `$everything`, but its content, parameters, size, and paging behavior vary. Resource-specific searches are often easier to operate and troubleshoot.