Ecosystem
fhir-test-data is one of two tools in the dnlbox FHIR toolchain. They are designed to complement each other in a typical FHIR development workflow.
dnlbox FHIR toolchain
| Tool | What it does |
|---|---|
| fhir-test-data (this) | Generate valid FHIR test resources with country-aware identifiers |
| fhir-resource-diff | Diff, validate, and inspect FHIR resources |
Natural workflow
# 1. Generate test fixtures
fhir-test-data generate bundle --locale uk --seed 1 --output ./fixtures/
# 2. Validate the generated output
fhir-resource-diff validate ./fixtures/Bundle-0001.json --fhir-version R4
# 3. Compare against a baseline after a library upgrade
fhir-resource-diff compare ./fixtures/Bundle-0001.json ./baseline/Bundle-0001.jsonTypeScript FHIR ecosystem
How fhir-test-data fits relative to other tools in the TypeScript/JavaScript FHIR ecosystem:
| Tool | Purpose | Locale support | Deterministic | TypeScript-native | Browser-safe |
|---|---|---|---|---|---|
| fhir-test-data | Test data generation | 14 locales | Yes (seeded) | Yes | Yes |
| Synthea | Clinically realistic patient simulation | US only | Partial | No (Java) | No |
| @types/fhir | FHIR TypeScript types only | — | — | Yes | Yes |
| @medplum/core | FHIR client + utilities | — | — | Yes | Partial |
| fhirclient | SMART on FHIR client | — | — | Yes | Yes |
When to use fhir-test-data
- You need TypeScript-native test data generation (no Java runtime, no CLI wrapper)
- You need internationally correct identifiers across 14 locales (NHS numbers, BSNs, Aadhaar, CPF, RRN, and more)
- You need deterministic fixtures — the same seed gives the same data across CI runs
- You need clinically meaningful codes — LOINC observations with HL7-consistent units, SNOMED CT conditions
- You need a pipe-friendly CLI for generating fixture files without writing code, or for feeding data into other tools
- You need a browser-safe library for testing in non-Node environments
When to use Synthea
Synthea is a great open-source project that has contributed enormously to the healthcare simulation and research community. It generates clinically realistic longitudinal patient histories — disease progression, care pathways, medication histories — that model real epidemiology over time. If that level of clinical realism is what your use case requires, Synthea is the right tool.
fhir-test-data serves a different set of needs: fast, deterministic, internationally correct fixtures for developer testing workflows, without a Java runtime or a long generation step.
HL7 FHIR specification
This library generates resources conformant with:
- FHIR R4 — https://hl7.org/fhir/R4/
- FHIR R4B — https://hl7.org/fhir/R4B/
- FHIR R5 — https://hl7.org/fhir/R5/
For full schema validation and profile conformance checking, use the HL7 FHIR Validator. fhir-test-data generates structurally valid resources; it is not a conformance validator.