A tool for validating FHIR R4 Observation and DiagnosticReport resources. It checks structure, terminology, references, and laboratory-specific rules. You can run it in the browser or use the validation logic without the UI (e.g. from Node, scripts, or CI).
- Development:
npm start— serves athttp://localhost:4200/ - Production build:
npm run build— output indist/ - GitHub Pages: The app is deployed via GitHub Actions to https://jan92.github.io/Data_Curation_Checker/ when you push to
mainormaster.
- FHIR JSON Bundle (e.g.
type: "collection"withentry[]) containing Observation and/or DiagnosticReport - JSON array of Observation and/or DiagnosticReport resources
- NDJSON (one JSON resource per line)
- Single Observation or DiagnosticReport (JSON object)
- Observation: Structure, required fields (
status,code),value[x]vsdataAbsentReason, organizer rules; CodeableConcepts, references, dates, URLs. - DiagnosticReport: Required
status,code; recommendedcategory,subject,effective/issued,performer,result(Observation references); reference and CodeableConcept checks. See FHIR DiagnosticReport. - Laboratory (Observation, LOINC-coded): Parameter-specific rules for many common lab parameters (e.g. glucose, creatinine, HbA1c, CBC, liver, cardiac, thyroid, coagulation, tumor markers, urine, hormones, vitamins):
- UCUM units and reference ranges, critical low/high
- Specimen, method, timing, interpretation; panel/component, reflex, delta checks; status workflow, performer, device, dataAbsentReason
- Structure: Bundle format, resource relationships, reference integrity.
The validation logic lives in a plain TypeScript module with no Angular dependency. You can:
- Import and call it from any Node or TypeScript project.
- Run the CLI to validate files or stdin and get a JSON report.
Import and call:
import { validateFhirObservations } from './src/app/checks/fhir-observation-checks';
const report = validateFhirObservations(content, {
source: 'File', // optional: 'File' | 'Text' | 'stdin' | 'Input'
sourceDetail: 'path.json' // optional: file path or other detail
});Signature:
validateFhirObservations(
content: string,
options?: { source?: string; sourceDetail?: string }
): ValidationReportValidationReport:
{
parseResult: {
ok: boolean;
type: string; // e.g. 'JSON Object', 'NDJSON', 'JSON Array'
resources: Observation[];
diagnosticReports: DiagnosticReport[];
error?: string; // set when ok is false
};
issues: CheckIssue[]; // { severity, label, detail, location }
checkResults: CheckResult[]; // { label, status, statusLabel, detail }
}Types are exported from ./src/app/checks/fhir-observation-checks and ./src/app/checks/types.
The CLI reads from a file or stdin and prints a ValidationReport as JSON.
From a file:
npm run check:cli -- --file ./observations.jsonFrom stdin:
cat observations.json | npm run check:cliRequirements: ts-node is used as a dev dependency. Run npm install first.
src/app/checks/— Validation logic (framework-agnostic):fhir-observation-checks.ts—FhirObservationChecker,validateFhirObservationstypes.ts—CheckStatus,CheckResult,CheckIssue,ParseResult,ValidationReport,ValidateOptions
src/app/models/fhir.types.ts— FHIR R4 type definitions used by the checksscripts/run-checks-cli.ts— CLI entry pointtsconfig.cli.json— tsconfig for the CLI (Node, CommonJS)
See repository for license information.