Skip to content

fhir-test-data

Generate valid FHIR R4/R4B/R5 test resources with country-aware identifiers — pipe-friendly, AI-friendly, and ready for any test workflow.

fhir-test-data is a TypeScript library and CLI for generating valid FHIR test resources — without copying production data or hardcoding US-centric identifiers.

Supports FHIR R4, R4B, and R5. Generates Patient, Practitioner, Organization, Observation, Condition, AllergyIntolerance, MedicationStatement, and Bundle resources across 14 locales.

bash
# Install
pnpm add fhir-test-data

# Pipe into jq
fhir-test-data generate patient --locale uk --seed 42 | jq '.identifier[0]'

# Generate a full bundle with wired references
fhir-test-data generate bundle --locale au --seed 1 --output ./fixtures/
typescript
import { createPatientBuilder, createBundleBuilder } from "fhir-test-data";

// Deterministic — same seed always produces the same patient
const [patient] = createPatientBuilder().locale("nl").seed(99).build();

// Full bundle with automatic reference wiring
const [bundle] = createBundleBuilder().locale("us").seed(42).type("transaction").build();

Released under the MIT License.