Profiles & validation
Make a patient pass AU Core
A worked example: take a Synthea patient that fails AU Core and fix it, error by error, until it passes.
This is the core of Drill 3. Doing it once teaches you more about profiles than reading the IG end to end.
Pull out a patient#
cd ~/fhir-lab/validator
f=$(ls ../synthea/output/fhir/*.json | grep -v Information | head -1)
jq '.entry[] | select(.resource.resourceType=="Patient") | .resource' "$f" > drill-patient.jsonValidate against AU Core Patient#
./validate drill-patient.json -profile http://hl7.org.au/fhir/core/StructureDefinition/au-core-patientReal output from this lab:
*FAILURE*: 2 errors, 1 warnings, 15 notes
Error @ Patient.extension[5]: The extension .../synthea/disability-adjusted-life-years could not be found so is not allowed here
Error @ Patient.extension[6]: The extension .../synthea/quality-adjusted-life-years could not be found so is not allowed here
Warning @ Patient.communication[0].language: None of the codings provided are in the value set 'Languages' (codes = urn:ietf:bcp:47#en-US)Remove what doesn't belong#
The validator can't resolve extensions that no loaded package defines, so they're errors. Remove the Synthea and US Core extensions, the US profile claim and the SSN, driver's licence and passport identifiers:
jq 'del(.meta) | del(.text)
| .extension = [.extension[]? | select(.url | test("synthea|us-core") | not)]
| if (.extension | length) == 0 then del(.extension) else . end
| .identifier = [.identifier[] | select(.type.coding[0].code == "MR")]' drill-patient.json > step1.jsonMake it Australian#
Add an IHI (the 16-digit Individual Healthcare Identifier, with the AU Base au-ihi identifier format), an Australian address with a state code, and an Australian language tag:
"identifier": [{
"type": { "coding": [{ "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "NI" }], "text": "IHI" },
"system": "http://ns.electronichealth.net.au/id/hi/ihi/1.0",
"value": "8003608833357361"
}],
"address": [{ "use": "home", "line": ["12 Example Street"], "city": "Brisbane", "state": "QLD", "postalCode": "4000", "country": "AU" }],
"communication": [{ "language": { "coding": [{ "system": "urn:ietf:bcp:47", "code": "en-AU" }] } }]The validator checks the IHI's format and check digit. Use a test IHI (they start 800360) rather than making one up.
Validate again#
Success: 0 errors, 3 warnings, 0 notes
Warning @ Patient.identifier[0]: Found multiple matching profiles among 2 choices: .../au-ihi, .../Identifier
Warning @ Patient.address[0]: Found multiple matching profiles among 2 choices: .../au-address, .../Address
Warning @ Patient: Constraint failed: dom-6: 'A resource should have narrative for robust management'That's a pass. The first two warnings are informational: the validator noticed your identifier and address match AU Base formats. dom-6 is a best-practice nudge to include a text narrative.
AU identifiers you'll need#
| Identifier | system |
type code (v2-0203) |
|---|---|---|
| IHI (person) | http://ns.electronichealth.net.au/id/hi/ihi/1.0 |
NI |
| Medicare card number | http://ns.electronichealth.net.au/id/medicare-number |
MC |
| DVA number | http://ns.electronichealth.net.au/id/dva |
DVA |
| HPI-I (practitioner) | http://ns.electronichealth.net.au/id/hi/hpii/1.0 |
NPI |
| HPI-O (organisation) | http://ns.electronichealth.net.au/id/hi/hpio/1.0 |
NOI |
Check each against the AU Base identifier profiles for the exact type coding and format rules before you rely on it in a test.
Go further
Repeat the exercise for an Encounter, a Condition and a vital-signs Observation against their AU Core profiles. Each one teaches a different lesson: references, clinical status codes, and LOINC plus UCUM.