FHIR Chat · Validation on datatype invariants · implementers

Stream: implementers

Topic: Validation on datatype invariants


view this post on Zulip Kailash (Aug 30 2021 at 13:09):

Hello, I wanted to add invariant over Quantity datatype to say system should be(warning) an UCUM system(http://unitsofmeasure.org) and created a datatype profile over Quantity, now this profile referenced at MedicationStatement.dosage.doseAndRate.dose[x] for quantity type.

While validating the medication statement instance(updated HL7 medication statement sample to mentioned quantity system other then UCUM ) against medication statement profile using latest Java validator which got success instead of expected warning.

Quantity.system invariant -
<severity value="warning"/>
<expression value="system.exists() implies system='http://unitsofmeasure.org'"/>

instance snippet - assume all other need data are there including meta {
"resourceType": "MedicationStatement",
"dosage": [
{
"doseAndRate": [
{
"doseQuantity": {
"value": 1,
"unit" : "Dosage",
"system": "http://snomed.info/sct",
"code": "260911001"
}
}
]
}
]
}

I think validator should give a warning as per invariant on datatype, but it is not giving any warning.
Let me know if I am missing anything here, thanks

view this post on Zulip Lloyd McKenzie (Aug 30 2021 at 16:04):

Can you post both your data type and MedicationStatement profile here as well as your instance and how you're invoking the validator?

view this post on Zulip Kailash (Aug 31 2021 at 06:57):

@Lloyd McKenzie ,, thanks for reply, please find the attachment. DataTypeInvariantValidation.zip

view this post on Zulip Lloyd McKenzie (Aug 31 2021 at 13:46):

The location of your invariant is incorrect. It's being declared on 'system', but the invariant is <expression value="system.exists() implies system='http://unitsofmeasure.org'" />
That means "if system.system exists, then system.system needs to be http://unitsofmeasure.org". Move your extension up to be declared on Quantity and try again

view this post on Zulip Kailash (Sep 01 2021 at 09:22):

Thanks @Lloyd McKenzie for finding, on first hand testing its working!!


Last updated: Apr 12 2022 at 19:14 UTC