Validating FHIR (Care Connect)

(Kev Mayfield) #1

It is possible to validate FHIR resources and bundles using a NHS Digital service.

The service can be used with tools such as postman by POSTing the resource (xml or json) to

http://data.developer.nhs.uk/ccri-fhir/STU3/{resource}/$validate

Replace {resource} with the type of resource you wish to validate. So if you want to validate a FHIR Document (as used with transfer of care), you would post your Bundle to

http://data.developer.nhs.uk/ccri-fhir/STU3/Bundle/$validate

Alternatively you can use a web app which does the same. This is available here:

FHIR Explorer

Both return a FHIR OperationOutcome with a list of issues (if any!).

The validation service currently doesn’t validate codes (see note below). The errors can be a bit cryptic but feel free to post here and I’m sure someone will post replies.

For more details on validation see https://www.hl7.org/fhir/validation.html#op
This service currently doesn’t support the profile parameter, if you wish the validate a resource against a specific CareConnect profile you will need to include it the profile section of the meta tag. e.g. In the sample below, the CareConnect-Condition-1 profile is specified.

{
"resourceType": "Condition",
"id": "1",
"meta": {
    "profile": [
        "https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-Condition-1"
    ]
},

This is not the same validator used in transfer of care, both are based on HAPI and use the official HL7 validation engine.

A newer version of this validation software which can be built from the (open source) code here CCRI 3.8 version. This is currently being worked on and is likely to include SNOMED code + ValueSet validation and message validation.

(Tim Coates) #2

Not working for me Kevin, getting: Failed conversion to FHIR Resource. (Check resource type matches validation endpoint) This is despite having a payload that I am receiving and processing using HAPI RESTful server. Any debugging / diagnosis tips?

Does it accept and respect (and validate against) profiles stated in the meta element?

(Kev Mayfield) #3

The client can’t detect the resource type you validating, so you need to select it (drop down box is at the top of the page).
Other reasons would be formatting issues in the json or xml.

(Kev Mayfield) #4

Yes it respects the profile in the meta tag (you would be very familiar with the CareConnectValidationSupport class )

(Kev Mayfield) #5

This conversation is related https://chat.fhir.org/#narrow/stream/179166-implementers/topic/Error.20message.20from.20FHIR.20validator

(Tim Coates) #6

Yeah, that was the classic problem I got - HAPI makes the input into a typed resource before validating it. So if there’s a problem with the input it sometimes strips the problem off before validating, or sometimes it can’t validate it (so can’t say what’s wrong).

(Kev Mayfield) #7

Validating against terminology server is bringing in some new problems with profiles.

Trying to validate a ITK Medication e.g.

<Medication>
<id value="46c1a1b6-c2a5-44bc-a0df-80db5d4fb423"/>
<meta>
<profile value="https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-ITK-Medication-1"/>
</meta>
<code>
<coding>
<system value="http://snomed.info/sct"/>
<code value="117111000001108"/>
<display value="Fresubin Energy Fibre liquid unflavoured (Fresenius Kabi Ltd)"/>
</coding>
</code>
<form>
<coding>
<system value="http://snomed.info/sct"/>
<code value="35367711000001100"/>
<display value="Gastroenteral liquid"/>
</coding>
</form>
</Medication>

Results in this from the ontology server.

<issue>
        <severity value="warning"/>
        <code value="processing"/>
        <diagnostics value="Error HTTP 422 : [157778bb-610d-4ea2-9ae1-80b1ae9922d4]: The expansion of value set http://snomed.info/sct/999000031000000106/version/20180321?fhir_vs=ecl/(^999000541000001108 |National Health Service dictionary of medicines and devices actual medicinal product simple reference set| OR ^999000551000001106 |National Health Service dictionary of medicines and devices actual medicinal product pack simple reference set| OR ^999000561000001109 |National Health Service dictionary of medicines and devices virtual medicinal product simple reference set| OR ^999000571000001104 |National Health Service dictionary of medicines and devices virtual medicinal product pack simple reference set| OR ^999000581000001102 |National Health Service dictionary of medicines and devices virtual therapeutic moiety simple reference set|) was too costly. validating CodeableConcept"/>
        <location value="Medication.code"/>
    </issue>

The expansion was too costly. Anyone know of a better ecl statement?? (I think the solution is to remove the valueSet from the profile though)