AuDigitalHealth / ci-fhir-stu3

Working drafts of HL7™ FHIR® Release 3 (STU) artefacts authored and maintained by the Clinical Informatics team at the Australian Digital Health Agency.
Other
11 stars 0 forks source link

Advance Care Planning Document Reference profile has bug in invariant for AuthorRole extension #58

Closed robeastwood-agency closed 4 years ago

robeastwood-agency commented 4 years ago

Prerequisites

The bug

In the Advance Care Planning Document Reference profile (documentreference-acp-1), the invariant on the optional extension DocumentReference.extension:AuthorRole has a faulty FHIRPath expression. The consequence of which is that acceptable content for this element always fails to be valid against these invariants.

The invariant is iinv-dh-docref-03: "A practitioner role shall conform to PractitionerRole with Practitioner with Mandatory Identifier" with the FHIRPath expression of

DocumentReference.extension('http://hl7.org.au/fhir/StructureDefinition/author-role').resolve().conformsTo('http://ns.electronichealth.net.au/ci/fhir/3.0/StructureDefinition/practitionerrole-withpractitionerident-1')

What I expected to happen

Acceptable content for this element shall be valid against these invariants. Unacceptable content for this element shall not be valid against these invariants.

The fix

The correct (and simplified) FHIRPath is:

valueReference.reference.resolve().conformsTo('http://ns.electronichealth.net.au/ci/fhir/3.0/StructureDefinition/practitionerrole-withpractitionerident-1')

Screenshots

N/A

Workarounds

N/A

QA.html excerpt

N/A

Desktop (please complete the following information):

N/A

Additional context

N/A

dbojicic-agency commented 4 years ago

Work is in progress to fix this invariant FHIRPath expression. The existing invariant will be merged with an invariant to add missing constraints on the type of Reference and placed on the root DocumentReference level.

dbojicic-agency commented 4 years ago

Existing invariant description and the FHIRPath expression have been updated to include constraint on the type of Reference, and moved to the DocumentReference root level: inv-dh-docref-05: If present, an authoring role shall at least have a reference that conforms to PractitionerRole with Practitioner with Mandatory Identifier or an identifier with at least a system and a value (: extension('http://hl7.org.au/fhir/StructureDefinition/author-role').exists() implies extension('http://hl7.org.au/fhir/StructureDefinition/author-role').valueReference.reference.resolve().conformsTo('http://ns.electronichealth.net.au/ci/fhir/3.0/StructureDefinition/practitionerrole-withpractitionerident-1') or extension('http://hl7.org.au/fhir/StructureDefinition/author-role').valueReference.identifier.where(system.count() + value.count() >1).exists())