FHIR $validate-operation (Validate FHIR Bundle)
Fhir supports the $validate operation, which allows clients to verify that a resource conforms to expected structure, profiles, and implementation rules without actually storing or processing the resource.
Purpose
This endpoint can be used to check whether a request would succeed before performing the actual operation. A FHIR OperationOutcome is returned to the client with warnings or errors related to the Bundle.
The resource is not persisted or processed further when using $validate.
Endpoint
POST <baseurl>/R4/fhir/Bundle/$validate
The supported content type is application/fhir+json
Request
Submit the FHIR Resource to validate in the request body.
POST <baseurl>/R4/fhir/Bundle/$validate
Content-Type: application/fhir+json
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"resource": {
"resourceType": "DocumentReference"
}
}
]
}
Response
The endpoint returns a FHIR OperationOutcome resource describing the validation result, including the location of the issues within the Resource structure.
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "warning",
"code": "invalid",
"diagnostics": "Unknown OID for Organization identifier",
"location": [
"Bundle.entry[3].resource[0]"
]
}
]
}
Supported Validation
Validation currently includes:
- FHIR structural validation
- Validation against relevant IHE MHD profiles
- Identifier and OID format checks
- Implementation-specific validation rules
Example Workflow
Typical usage:
- Client submits a bundle using
$validate - Server returns validation results
- Client fixes any issues
- Client submits the bundle normally
POST /Bundle/$validate
↓
OperationOutcome
↓
POST /Bundle
Validated elements
⚠️ Note!
If the value of a CodeSystem is not known, it is treated as a Warning
If the CodeSystem is known, but the Value is not, it is treated as Error
| Outcome Issue Level |
Category | Allowed Values |
|---|---|---|
| Warning | Organization OIDs | 2.16.578.1.12.4.1.4.101 (Brønnøysundregistrene organization number)2.16.578.1.12.4.1.4.102 (RESH – Register for organizational units in specialist healthcare) |
| Warning | Practitioner OIDs | 2.16.578.1.12.4.1.4.1 (FNR – Norwegian national identity number)2.16.578.1.12.4.1.4.4 (HPR – Health Personnel Register ID) |
| Warning | Patient OIDs | 2.16.578.1.12.4.1.4.1 (FNR)2.16.578.1.12.4.1.4.2 (DNR – D-number)2.16.578.1.12.4.1.4.3 (HNR – Help number / temporary healthcare identifier)2.16.578.1.12.4.5.100.<xx>.<yy> (Current HomeCommunityId) |
| Warning | Facility Types | 2.16.578.1.12.4.1.1.1303 (Volven CodeSystem) |
| Warning | Facility Types | 2.16.578.1.12.4.1.1.1305 (Volven CodeSystem) |
| Warning | Practice Settings | 2.16.578.1.12.4.1.1.8663 (Volven CodeSystem) |
| Warning | Type Codes | 2.16.578.1.12.4.1.1.9602 (Volven CodeSystem) |
| Warning | Category Codes | 2.16.578.1.12.4.1.1.9602 (Volven CodeSystem) |
| Warning | Confidentiality Codes | 2.16.578.1.12.4.1.1.9603 (Volven CodeSystem)http://terminology.hl7.org/CodeSystem/v3-Confidentiality |
| Warning | Format Codes | http://www.kith.no/xmlstds/epikrise/2012-02-15formatCodes |
| Error | Attachment Location | 2.16.578.1.12.4.5.100.<xx>.<yy> (Current HomeCommunityId) |
| Error | Unknown Values of known CodeSystems | If the CodeSystem is known, but the value isn't, this is treated as an ErrorA00-9 (Invalid value for CodeSystem 2.16.578.1.12.4.1.1.9602)86.103 (Invalid value for CodeSystem 2.16.578.1.12.4.1.1.1303) |