Validating national FHIR profiles on HAPI FHIR
Validating national FHIR profiles on HAPI FHIR means checking incoming FHIR resources against the structure, terminology and constraints defined by a country's implementation guide, so that a health authority or data exchange operator can accept or reject data before it is stored and shared. Teams need this when data senders must conform to a national guide for exchange, reporting or registry submission, and when the operator cannot rely on each sender's own checks. The HAPI FHIR JPA server is a Java-based, Apache Software License 2.0 licensed server that covers FHIR R4 and R5, and validation is one of its documented areas alongside terminology services and partitioning. That gives the operator a validation capability inside an open-source server, but it does not give the operator a finished national profile set.
The operator still has to assemble the guide and everything it depends on. A national implementation guide usually references core FHIR StructureDefinitions, other base guides and value sets, so the team must identify the exact guide version, install its package and resolve each dependency at the version the guide expects. Terminology is the usual gap: code systems and value sets named in the guide must be loaded on the server or the validator will report errors that are really missing content. Confirm with the publishing authority which FHIR version, package versions and terminology sources the guide requires, and record them so that validation results can be reproduced in every environment.
Once the profiles run, plan how results reach data senders. Decide which issues block a submission and which are warnings, map each issue to the element and profile it breaks, and return an OperationOutcome that a sender's developers can act on without access to your server logs. Test the rules with a representative set of valid and invalid samples from each sender, and agree a process for guide upgrades, since a new guide version can change what passes. Ask your team or partner to document the validation policy, the package versions in use and the sample set, because those records are what a compliance or assurance reviewer will ask for first.
Choosing where validation runs
Validation at the request boundary checks each resource in an incoming HTTP payload before the server accepts it. Senders get an immediate OperationOutcome when a resource fails, which makes this the position that gives the fastest feedback to a system that is still open. The cost is that every write carries validation work, so the design has to account for latency on busy interfaces.
- Immediate rejection: A non-conforming resource is refused in the same call, so the sender can correct and resend without a later reconciliation step.
- Blind to bypass paths: Data written through other channels, such as direct database loads, bulk imports or tools that skip the interceptor, is never checked at this position.
- Per-write cost: Validating every payload adds work to each transaction, and the effect grows with bundle size and profile complexity.
- Sender dependency: Errors are only useful if the sending system surfaces them to its operators, so the sender's error handling needs to be confirmed in advance.
- Configuration scope: Which profiles are enforced at this point depends on the interceptor configuration in your environment, which should be confirmed against the HAPI FHIR documentation for your version.
Before choosing this position, confirm with each sender whether it can receive and act on OperationOutcome responses on every write path.
Repository validation checks what is stored, whatever route it arrived by. It is the position that answers the question of whether the data at rest conforms to the profile, and it is the right basis for a claim about the repository as a whole. Its limitation is that a failure is found after the data has been accepted, so correction depends on a process that someone runs and owns.
- Coverage of all writes: Resources arriving through any interface or internal load are subject to the same check, which closes the gaps left by request-only checks.
- Late discovery: Non-conforming data may already be used by downstream consumers before it is flagged, so the window between write and detection matters.
- Legacy data: Resources stored before a profile was enforced will fail, and the team needs a plan for them rather than a single rejection event.
- Write-time impact: Enforcing validation on every stored resource affects the performance of the write path, and the impact should be measured on your data volumes.
- Ownership of fixes: Someone must decide whether a failing resource is corrected, quarantined or left in place, and that decision is operational rather than technical.
Confirm how your team will report and remediate stored failures before you enable repository-level enforcement.
A batch check runs outside the server's write path. Received files, such as bundles delivered by a sender on a schedule or through a file exchange, are validated as a set, and the results are returned to the sender as a report. This position suits organizations that receive data in files, want to avoid per-write cost, and need an artifact that can be shared with a data sender.
- Sender-facing report: The output is a document listing failures by file and resource, which fits a workflow where senders correct and resubmit.
- Separate from storage: Files that fail can be held back from the repository, so the stored data stays clean, but the team must decide what happens to the held files.
- Timing gap: Errors are found after delivery, so the reporting cycle sets how long a non-conforming file can wait before someone acts.
- Coverage limits: A batch run only sees what is delivered as files, so direct API writes and other channels need their own check.
- Operational load: The validation job, its schedule, its storage for reports and its alerting become systems the team must run and monitor.
Confirm the expected file volume, delivery schedule and the sender's ability to act on a report before you commit to this model.
Most deployments combine positions rather than picking one. A common pattern pairs a request-level check for interfaces that can respond immediately with a batch report for file-based senders, and it adds a repository-level check to catch whatever the other two miss. The right mix depends on which channels feed the server and how much latency the sending systems can tolerate.
- Map the write paths: List every interface, load job and tool that writes resources, since each one determines which positions are needed.
- Match position to sender: Real-time senders suit request-level feedback, while file-based senders suit batch reports with a clear correction cycle.
- Set a latency budget: Agree with the platform team how much validation overhead each interface can absorb before choosing the request-level scope.
- Keep the profile version aligned: Each position must validate against the same implementation guide version, or the results will disagree between checks.
- Plan the tie-breaker: When a resource passes one check and fails another, the team needs a rule for which result governs.
Confirm the combined design with the owners of each write path before enabling enforcement in any environment.
Configuration options and when each fits
This table compares the main configuration choices for validating national FHIR profiles on a HAPI FHIR server, including IG package source, FHIR version, terminology supply, validation timing and how outcomes are returned. Read each row for the condition that favors it and the effort it adds, then confirm the details against your own IG set and environment.
| Decision | When it fits | Effort and trade-off |
|---|---|---|
| IG package source | Upload a package you have reviewed when your environment is restricted; install from the public package registry when your server can reach it and versions are pinned | Uploaded packages need a manual refresh for each IG release; registry installs depend on network rules and need a version-change review |
| FHIR version setting | Match the server configuration to the version your national IG targets, such as R4 or R5, before loading any profile | Changing versions later usually means reloading profiles and retesting every rule; confirm the target version in the IG itself |
| Local code systems | Load national code systems and value sets locally when the server must validate codes without external calls | Someone must load, version and update each code system; large sets add storage and reload time |
| External terminology service | Point validation at an external terminology server when your national authority publishes codes centrally and reachability is assured | Adds a runtime dependency and latency to every check; outages can stop validation, so plan fallback behavior |
| Validate on write | Use when invalid data must never be stored, such as for a national exchange feed with strict acceptance rules | Every write pays validation cost; throughput tests are needed before go-live |
| Batch validation | Use for large existing datasets or legacy records that predate the profile and must be assessed without blocking intake | Requires a scheduled job, a report process and a decision on how failing records are handled |
| OperationOutcome reporting | Return detailed issues to senders during development and integration testing, then reduce detail where sender feedback is a concern | Detailed outcomes help data senders fix errors but may expose profile internals; agree the message level with the exchange owner |
Setup sequence for a national profile on HAPI FHIR
This sequence takes a team from a national implementation guide on paper to a HAPI FHIR JPA server that validates sample data against that guide's profiles. Each step closes with a check so the team knows whether to move on.
Confirm the national guide and its version
Name the implementation guide, its exact version, and the FHIR version it targets (R4, R4B or R5 are the usual candidates, and the guide states which one). Record the canonical URLs of the profiles your senders will use, and list every IG the guide depends on, such as US Core or a terminology IG. Ask the national authority or the guide's publisher which version is current for your exchange and whether a newer version is planned. Done when you have a one-page list of guide name, version, FHIR version, profile canonicals and dependencies, signed off by the team that owns the exchange.
Match the HAPI FHIR release to the guide
Choose the HAPI FHIR release that supports the FHIR version your guide targets and check its Java requirement in the HAPI FHIR versions documentation. HAPI FHIR 8.2.0 requires JDK 17, so confirm the JDK on every build and runtime host before you install anything. Check the upgrade notes for any release you plan to use, because package handling and validator behavior change between releases. Done when the chosen release, JDK version and FHIR version are written down in one place and the JDK runs on the build agents and the server.
Install the IG package and its dependencies
Install the national guide package and every dependency package into the server's package set, using the same versions you recorded in the first step. The mechanics (uploads, installing from the public package registry, runtime $install in the starter, and the ID change introduced in 8.6) are covered in the sibling topic on installing implementation guide packages on HAPI FHIR, so follow that for the commands. Done when a GET request for each StructureDefinition canonical returns the expected version, and the dependency packages appear in the installed list.
Load the terminology the profiles require
Identify the value sets and code systems that the profiles bind to with required strength, including national code systems and any SNOMED CT, LOINC or ICD-10 bindings. Load the CodeSystem and ValueSet resources, or the terminology source your licensing allows, into the server's terminology services before validating. Confirm which bindings are required and which are only preferred, because a missing required code system causes failures that look like data errors. Done when a $validate-code or $expand call against a required value set returns a known code and rejects an unknown one.
Configure the validator and its support chain
Configure the Instance Validator so it loads the installed IG packages and the terminology support you just loaded, and set the FHIR version to match the guide. Decide whether validation runs on incoming requests, on stored repository data, or both, using the sibling topic on request versus repository validation as your guide. Record the exact configuration keys and the validation mode in version control so the setup can be reproduced in other environments. Done when a test resource that references a profile is validated against that profile and the validator reports the profile name in its output.
Test with known valid and invalid samples
Build a small set of sample resources from the guide's examples, plus deliberately broken variants: a missing mandatory element, a value outside a required binding, an unknown profile, and a wrong data type. Submit each sample to the validator and record the outcome and the issue codes for each one. Confirm that valid samples pass with no errors and that each broken sample fails for the reason you designed it to fail. Done when the expected results are written as a fixed test suite that runs in your pipeline and produces the same results on repeat runs.
Report results and hand over the setup
Turn the validator output into a format the data senders can act on: the profile name, the element path, the issue severity and the message, with a link to the failing rule in the guide. Document the IG and terminology versions, the JDK and HAPI FHIR versions, and the configuration, and set a rule that these are updated together when any of them changes. Agree with the senders which issues block submission and which are warnings. Done when a sender can reproduce one of the sample failures from your report alone, and the version record is stored with the configuration.
How a sender's data flows through national validation
A submission starts in the sender's network and crosses a trust boundary into the operator's infrastructure, where the HAPI FHIR JPA server receives it. The server checks the resource against the installed implementation guide packages and resolves codes through its terminology services before returning an OperationOutcome to the sender. Check where the boundary sits in your design, and confirm that the validation outcome is what gets stored or rejected, since the rejection path is what senders see first.
Sender submissions crossing into the operator's HAPI FHIR server for validation.
Security and operational considerations for validation
HAPI FHIR does not ship a single security layer, so the controls around national profile validation are decisions the operator makes and documents. The five risks below cover where IG packages come from, who can change them, what gets logged, how versions stay aligned, and who can read validation output that may contain patient data.
Restrict where packages come from
Validation depends on IG packages that the server downloads or accepts, so each package source is a trust decision. Restrict package download URLs to an approved allow list so the server cannot be pointed at arbitrary or internal addresses, which is a server-side request forgery risk. Check which private network ranges and redirect behavior your configuration permits, and document the approved sources for your security review.
HAPI FHIR security docsControl who changes IG packages
Installing or replacing an implementation guide changes what every later write is validated against, so it is a change to production behavior. Decide which roles may upload packages, trigger runtime installs, or alter validation settings, and separate those roles from those that send data. Record each install with who requested it, the package version, and the environment it was applied to.
Log validation outcomes for audit
An auditor or data sender will ask what was accepted, what was rejected, and under which profile version. Combine the BALP audit logging building block with your own interceptor records that capture the resource type, profile URL, validation result, and time of each decision. Confirm with your compliance team how long these records are kept and who can query them, because the audit trail is only useful if it is complete and protected.
Keep IG versions aligned
A profile that passes in test but is a different version in production produces results nobody can reproduce. Pin the implementation guide version in each environment, promote the same package through development, test, and production, and compare the installed versions before each release. Note any change in package identifiers between HAPI FHIR releases so a server upgrade does not silently switch the profile set.
HAPI FHIR versionsProtect validation reports
Operation outcomes and error reports often quote the failing element, and that element can contain a patient identifier, a diagnosis, or a name. Decide who may see these reports, return only the detail the sender needs, and keep the full reports inside the access boundary you run. Check that logs and monitoring tools do not copy report bodies into systems with broader access than the source data.
Reporting validation results to data senders
The point of validation reporting is that a sender can fix a rejected resource without asking your team what went wrong. On a HAPI FHIR server, the raw material is the OperationOutcome the server returns when the validator rejects a write, with one issue entry per finding. Each entry carries a severity, a code, a diagnostics message and an expression or location that points into the resource. Your first job is to standardize how these are read: agree which severities block a write and which only warn, and check that the sender-facing message text is consistent across the profiles you enforce. Confirm the exact issue format, the expression syntax and how the message text is produced in the HAPI FHIR version you run, since these details change between releases and depend on the validation support modules you have configured.
Each expression should be traced back to the element in the national profile that the rule came from. Use the StructureDefinition for the profile to map a path such as Patient.identifier or Observation.value[x] to its constraint, cardinality, binding or required slice, and record that mapping in a table that your support staff and the sender's integration team can both read. Where the message alone is ambiguous, the mapping tells the sender which rule failed and why. Document the conformance statement for senders as well: the profile canonical URLs and versions the server enforces, the implementation guide version and the terminology value sets it expects, and any extensions your country guide allows or forbids. Keep this statement in the same version control as your package list so that it cannot drift from what the server actually loads. Ask your IG authors or national agency whether a sender-facing conformance template already exists.
Close the loop with a retest path. Give senders a documented way to resubmit corrected resources to a test endpoint or a dedicated test partition, and confirm the response with the same OperationOutcome format used in production, so a fix can be verified before it reaches live data. Track which rules fail most often and feed that back into sender guidance and, where a rule is ambiguous, into the profile or your local constraints. Ask your team to confirm how sender reports are generated and delivered in your environment, and whether any reporting tooling sits outside HAPI FHIR, since the server itself returns outcomes but does not decide how your organization communicates them.
Limits to confirm in your environment
A national guide can look straightforward on paper and still fail in a specific network, toolchain or data set. The cards below list the checks that most often change the design, so they can be settled before the validation rules go live on a server that receives real submissions.
Offline dependency resolution
A national guide usually depends on other packages, such as core FHIR and base profiles, that the validator must load. In an air-gapped network, the server cannot fetch them from a public registry at runtime. Confirm that every dependency in the guide's dependency tree can be staged in advance, uploaded to the server, and resolved without outbound access. Test this on a host with no internet route, not on a build machine that has one.
Terminology licensing and size
Value sets in national guides often reference SNOMED CT, LOINC or ICD-10 codes, and some of these code systems require a license from their owner. Confirm who holds the license for each code system, whether your national terminology distribution is permitted in your environment, and how much database and memory the loaded content needs. Ask for the list of code systems the guide binds to before you size the terminology store.
Cost of validating every write
Validating each stored resource against a full national profile set adds processing time to every create and update. The cost grows with the number of profiles, the size of the bundles and the terminology checks involved. Measure write latency with realistic sender payloads in a staging environment before you choose between request validation and repository validation. Ask your team to record baseline latency so any later increase can be traced to a specific rule.
Guide and release compatibility
A national guide is published against specific FHIR versions and may depend on a specific IG version of the core specification. Check that the guide version, its dependencies and the HAPI FHIR release you plan to run all target the same FHIR version. Confirm the Java requirement for your chosen release as well. HAPI FHIR 8.2.0 requires JDK 17, and your upgrade plan should cover that requirement alongside the guide version.
HAPI FHIR versionsRules beyond the validator
Some national rules, such as cross-resource consistency, business rules tied to a national registry or checks that depend on external lookups, may not be expressible as standard StructureDefinitions and invariants. Review each rule in the guide and sort it into what the validator checks, what needs a custom validation support module or interceptor, and what must stay in the sender's or the receiver's process. Ask your team to document that split before committing to a validation design.
Questions teams ask before validating a national profile
How much effort does a national profile rollout on HAPI FHIR take?
Effort depends mainly on how many profiles the implementation guide contains, how many resource types your senders actually use, and how much existing data already has to conform. Most of the work is not installing the validator. It is agreeing which profiles are mandatory, resolving the dependencies each guide pulls in, and deciding how failures are handled. Ask any partner to break the quote into profile analysis, server configuration, terminology setup, sender reporting and retesting, and to state which of those depend on the number of sender systems you have. No duration figure is given here because none was supplied for this topic; confirm estimates against your own profile list.
Can our own team validate national profiles without a partner?
Yes, if your team has working FHIR knowledge and can own the server, the packages and the validation rules after go-live. The HAPI FHIR server is Apache Software License 2.0 licensed, so there is no software fee for the core, but you still pay in staff time for profile analysis, configuration, testing and upgrades. Teams with no prior FHIR profiling experience usually find the learning curve is in reading StructureDefinitions and terminology bindings, not in the Java build. A partner makes sense when you need the rollout faster than your team can learn it or when you want an independent review of the result.
What does the work require from our team?
The work needs three groups of people to be available. First, FHIR expertise: someone who can read profiles, slices and extensions and explain why a sender's payload fails. Second, terminology owners: people who can confirm which code systems and value sets the guide expects and who maintain them after launch. Third, sender contacts: named technical contacts at each organization that submits data, who can fix payloads and test retries. Ask a quote to name which of these roles it assumes you supply and which it provides, because gaps in sender contacts are the most common cause of delay.
How long does a national profile rollout take, and what sets that?
Timing is set by the number of senders still moving to the new profile, the state of their current data, and how quickly terminology decisions are made. A rollout that validates new submissions only can move faster than one that also requires historical data to conform. Plan for the implementation guide version and its dependencies to be fixed before the build starts, since changing versions mid-project resets analysis work. Ask for a written schedule with milestones for sender onboarding and a clear statement of which dates depend on your organization's decisions.
How does terminology licensing affect the plan?
Some code systems that national guides reference, such as SNOMED CT, LOINC and ICD-10 variants, come with their own license terms, and those terms decide what you may load into a terminology service and who may use it. Software licensing for HAPI FHIR does not cover these. Confirm with your national terminology authority or licensing body which code systems your guide needs, whether your organization holds the required licenses, and how updates are distributed. Validation can fail for reasons that have nothing to do with the profile if a required value set is missing, so confirm terminology access before you commit to a go-live date.
What should we request in a quote for this work?
Ask for a written scope that lists the implementation guide name and version, every profile and value set in scope, the dependencies the guide pulls in, and the sender systems covered. The quote should separate one-time work (analysis, configuration, testing, sender documentation) from recurring work (guide version updates, terminology refreshes, upgrades of the HAPI FHIR server, and monitoring). Request the acceptance criteria for validation results, the format of the reports sent to data senders, and how retesting is billed if a sender fails. DeployOpen plans these engagements as fixed scope agreed in writing before work starts.
Which HAPI FHIR version should we target for national profile validation?
Pick a version your team can run and upgrade on a schedule, and confirm it supports the Java runtime you operate. HAPI FHIR 8.2.0 requires JDK 17, and the most recent release supplied for this topic is v8.8.2, released on 25 September 2026. Check the versions page before you fix the target, because the implementation guide you need may depend on a particular release of the server or its validation support. Record the chosen version in your change plan so that sender testing and production run against the same build.
How DeployOpen scopes national profile validation
DeployOpen scopes national profile validation in writing before any build starts, because the most expensive mistakes in this work are made in the first conversation: the wrong guide version, an unmapped dependency, or an unclear owner for rejected data. The first step is confirming which implementation guide applies, which version your national program or data exchange requires, and which FHIR version the guide targets. Those answers decide which packages load, which terminology bindings are enforced, and whether the server must support the DSTU2, DSTU3, R4, R4B or R5 resources your senders use. The second step is mapping the guide's dependencies, such as core specification packages and any other guides it references, along with the code systems and value sets it binds to. Each of these must be traced to a source your organization is allowed to load on a server it controls.
The written scope then covers configuration on a self-hosted HAPI FHIR JPA server running in your cloud accounts, data centers or air-gapped network. DeployOpen works with your team to define the database, the deployment method, the package install path, and the validation setting that decides whether non-conforming writes are rejected or only reported. Testing uses sample data agreed in advance, including valid resources, resources that should fail, and resources that exercise each binding, so that the expected result of every case is recorded before go-live. The handover covers the validation report format, the operational steps for rejected data, and a documented process for returning reports to senders. DeployOpen prepares systems, controls and evidence for compliance assessments, but it does not issue audit reports or certifications; independent auditors and certification bodies do that work. Ongoing guide upgrades, dependency changes and retesting can be covered under a retainer, and the scope document should state which of these are included at signature.

