Part of the FHIR operations toolkit

Valid FHIR test resources,
on demand.

Generate country-aware identifiers, realistic clinical codes, and deterministic seed-based bundles. Built for CI pipelines, testing suites, and AI agents.

$ pnpm add fhir-test-data
bash — fhir-test-data demo
CLI v0.1.3
$ fhir-test-data generate patient --locale uk --seed 42 | jq '.identifier[0]'
{
  "use": "official",
  "type": {
    "coding": [
      {
        "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
        "code": "NI",
        "display": "National Insurance Number"
      }
    ]
  },
  "system": "https://fhir.nhs.uk/Id/nhs-number",
  "value": "4857773456"
}
$ fhir-test-data generate bundle --locale au --seed 1 --output ./fixtures/
Generated 1 Bundle with 12 resources.
Output written to ./fixtures/Bundle-001.json
- Patient/Patient-001 (IHI: 8003608833567824)
- Practitioner/Practitioner-001 (HPI-I: 8003619944778811)
- Organization/Organization-001 (HPI-O: 8003621122334455)
- Observation/Observation-001-LOINC-8302-2 (Height: 176 cm)
- Observation/Observation-002-LOINC-29463-7 (Weight: 78.4 kg)
- Condition/Condition-001-SNOMED-44054006 (Type 2 diabetes)
Done.
$ import { createPatientBuilder, createBundleBuilder } from 'fhir-test-data';
import { createPatientBuilder, createBundleBuilder } from "fhir-test-data";

// Deterministic — same seed always produces identical 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();

Engineered for Robust Integration

No server, no Java runtime, and zero external downloads. Lightweight core libraries that fit directly into pipelines.

14 Locales Support

Generates country-appropriate identifiers, addresses, and names for: US, UK, Australia, Canada, Germany, France, Netherlands, India, Japan, South Korea, Singapore, Brazil, Mexico, South Africa.

Check-Digit Validated

Every identifier passes its country's official validation: NHS Modulus 11 (UK), Australian IHI Luhn, Aadhaar Verhoeff (India), BSN 11-proef (NL), French NIR Modulus 97, and more.

Clinically Meaningful Codes

Observations use real LOINC codes with values in plausible clinical ranges and HL7-consistent units. Conditions use SNOMED CT codes that make sense to clinicians.

Seeded & Deterministic

Passing the same seed always produces the exact same output, on any machine. Reliable for snapshot tests, golden file comparison, and repeatable CI regression fixtures.

Multi-Version FHIR

All builders target R4 (default), R4B, or R5. R5 structural adaptations — like MedicationUsage and CodeableConcept changes — are handled automatically.

Browser-Safe Core

The core engine carries no Node.js imports. Use it in browsers (React/Vite), Cloudflare Workers, Deno, or inside CI/CD build pipelines with zero configuration.

The FHIR Operations Toolkit

A suite of independent CLI engines that compose together seamlessly for development, CI/CD, and agentic workflows.