Inferensys

Glossary

FHIR Validator

A software tool, available as a Java library or command-line interface, that checks FHIR resources and profiles for conformance against the base specification and defined implementation guides.
Developer demonstrating multi-agent tool use, agent tool selection interface on laptop, casual tech demo moment.
CONFORMANCE TESTING

What is a FHIR Validator?

A FHIR validator is a software tool that programmatically checks HL7 FHIR resources and profiles for syntactic, structural, and semantic conformance against the base FHIR specification and any applicable implementation guides.

A FHIR Validator is a conformance testing engine, typically available as a Java library or command-line interface, that parses a StructureDefinition and verifies that a given resource instance satisfies all defined constraints. It checks cardinality, data types, binding strength to ValueSet terminologies, and invariant rules expressed in FHIRPath, ensuring syntactic correctness and semantic alignment with profiles like the US Core Implementation Guide.

Validation operates at multiple levels: base specification validation against the core FHIR schema, profile validation against derived StructureDefinition rules, and terminology validation to confirm coded elements belong to the bound CodeSystem. For federated learning architectures, a FHIR validator ensures that clinical data extracted from heterogeneous EHR systems conforms to a shared profile before being used for decentralized model training, preventing schema drift across institutions.

CONFORMANCE ENGINE

Core Capabilities of a FHIR Validator

A FHIR validator is a software tool that checks healthcare data for structural and semantic correctness against the base FHIR specification and specific implementation guides. It ensures that exchanged clinical information is machine-computable and clinically safe.

01

StructureDefinition Conformance

The validator parses a StructureDefinition—the blueprint for a profiled resource—and checks that every element in the instance matches the defined cardinality, data type, and mustSupport rules. It verifies that required fields are present and that no prohibited elements are included.

  • Validates against base FHIR resources (e.g., Patient, Observation)
  • Enforces constraints from US Core, mCODE, or custom profiles
  • Flags missing mandatory elements like Patient.name or Observation.subject
02

Terminology Binding Validation

The validator enforces binding strength defined in a profile, ensuring coded elements use values from the correct ValueSet. It checks if a supplied code is valid within the bound CodeSystem and whether the binding is required (must use this code) or extensible (use this code or a local equivalent).

  • Validates SNOMED CT, LOINC, ICD-10, and RxNorm codes
  • Resolves ValueSet expansions to check membership
  • Rejects invalid display names that don't match the code
03

FHIRPath Expression Evaluation

Complex constraints written in FHIRPath are evaluated against the resource instance. The validator executes these expressions to check co-occurrence rules, conditional logic, and mathematical invariants that can't be expressed in simple StructureDefinitions.

  • Evaluates rules like 'if status is final, then value must be present'
  • Checks cross-element constraints (e.g., Observation.value vs Observation.dataAbsentReason)
  • Supports custom invariants defined in the profile's constraint element
04

Implementation Guide Packaging

The validator ingests an entire ImplementationGuide resource, which acts as a manifest bundling all related artifacts—profiles, extensions, value sets, and examples—into a single conformance package. It resolves all internal dependencies to create a complete validation context.

  • Loads all StructureDefinition, ValueSet, and CodeSystem resources
  • Resolves canonical URL references across the IG
  • Validates example instances against the IG's own profiles
05

Instance Validation Modes

Validators operate in multiple modes to support different workflows. JSON/YAML/XML parsing checks syntax first, then structural validation verifies the profile, and terminology validation checks codes. Some validators also support FHIRPath-only evaluation for custom rule testing.

  • CLI mode for CI/CD pipelines (e.g., validator_cli.jar)
  • RESTful API mode for real-time validation in EHR integrations
  • Batch mode for validating thousands of resources in bulk data exports
06

Error Severity Classification

Validation outcomes are categorized by severity to distinguish blocking issues from warnings. Errors indicate a violation of a mandatory constraint (cardinality, required binding). Warnings flag best-practice violations or extensible binding mismatches. Information messages provide guidance on optional improvements.

  • error: Resource is non-conformant and must be fixed
  • warning: Resource is conformant but may have quality issues
  • information: Advisory notes for implementers
FHIR VALIDATION

Frequently Asked Questions

Clear, technically precise answers to the most common questions about FHIR validation, conformance testing, and the tools that ensure healthcare data interoperability.

A FHIR Validator is a software tool that programmatically checks a FHIR resource instance for conformance against the base FHIR specification and any applicable ImplementationGuide or StructureDefinition profiles. It operates by parsing the resource (in JSON or XML), resolving all referenced ValueSet and CodeSystem artifacts, and executing a multi-phase validation engine. The primary phases include: schema/schematron validation against the core XML/JSON definitions, cardinality and invariant constraint checking (evaluating min, max, and constraint elements), terminology binding verification (ensuring coded elements use valid codes from the bound ValueSet with the correct binding strength like required or extensible), and cross-resource reference integrity validation. The reference implementation is the org.hl7.fhir.validator Java library, which can be invoked via a command-line interface (CLI) or integrated into build pipelines using tools like the HAPI FHIR validator.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.