Validating FHIR® resources made easy

This FHIR® resource is valid !

FHIR® has number of resources to work with, across different versions(DSTU2 and STU3), in various formats(JSON, XML). While working with FHIR® data, checking and validating resources can really be a tedious task, especially when you have to go through its structure, cardinality, value domains, profiles, questionnaires, business rules and many more. Not only the specifications but the format of the data also has to be right for a resource to be valid. Looking for the correct data type, structure, and and proper json syntax in a huge data set can be like looking a needle in a haystack.

That’s why 1upHealth now provides FHIR® validator for all the available FHIR® resources in DSTU2 and STU3 versions. When you visit any of our FHIR® resource documentation pages, it allows the user to paste the FHIR® resource into an input field and checks it against all the specifications of that particular resource immediately. On validating, it either displays a success message for a valid resource or an error message showing where and what the error is. Currently the FHIR® validator accepts the JSON format.

Example 1

Let’s say we have an Encounter resource type in JSON format under version stu3, (https://www.hl7.org/fhir/encounter.html) which has all the required attributes and values in it . But the resource is missing a comma and closing braces in it, which makes it an invalid JSON.

{

resourceType“: “Encounter”,

id“: “example”,

text“: {

status“: “generated”,

div“: “<div xmlns=\”http://www.w3.org/1999/xhtml\”>Encounter with patient @example</div>”} //missing comma

“status”“in-progress”,

class“:[ {

system“: “http://hl7.org/fhir/v3/ActCode”,

code“: “IMP”,

display“: “inpatient encounter”

}],

subject“: {

reference“: “Patient/example”}

//missing closing curly braces

On pasting the above resource in Encounter Resource Validator (https://1up.health/dev/fhir/resource/Condition/stu3) the following error gets displayed : The FHIR® resource is not valid ValidationError: Resource must be valid JSON.

{

resourceType“: “Encounter”,

id“: “example”,

text“: { “status“: “generated”,

div“: “<div xmlns=\”http://www.w3.org/1999/xhtml\”>Encounter with patient @example</div>”},

status“: “in-progress”,

class“:[{ //class should be an object and not an array

system“: “http://hl7.org/fhir/v3/ActCode”,

code“: “IMP”,

display“: “inpatient encounter”

}],

subject“: {

reference“: “Patient/example”} }

On pasting the above resource in the Validator the following error gets displayed : The FHIR® resource is not valid ValidationError: child “class” fails because [“class” must be an object]

And if the resource is valid the message displayed would be : The FHIR® resource is valid . This makes sure that the resource is in its proper format and has all required elements and attributes in it.

This makes it so easy for developers to be more productive while creating and validating the FHIR® resources without wasting any time. Moreover it’s an easy way to play around with different resources and learn more about them.

Validate a patient resource here (https://1up.health/dev/fhir/resource/Patient/dstu2)

Other content you may be interested in:

Share with your community

Sign up to get the latest insights and updates from 1upHealth