Closed oliveregger closed 1 year ago
I updated both invariants according to the proposal from @oliveregger, however the second invariant still results in a QA error. So, I made following changes and moved second invariant one level up (to observation level):
Invariant: eu-lab-1 Description: "If observation status is other then \"registered\" or \"cancelled\", at least one of these Observation elements shall be provided: \"value\", \"dataAbsentReason\", \"hasMember\" or \"component\"" Severity: #error Expression: "(status in ('registered'|'cancelled')) or value.exists() or hasMember.exists() or component.exists() or dataAbsentReason.exists()"
Invariant: eu-lab-2 Description: "If observation has components and observation status is other then \"registered\" or \"cancelled\", at least one of these Observation.component elements shall be provided: \"value\" or \"dataAbsentReason\"" Severity: #error Expression: "component.exists() implies (status in ('registered'|'cancelled')) or component.value.exists() or component.dataAbsentReason.exists()" I propose to close this PR.
The problem is that in the java fhirpath implementation the or seems to have precedence over the in, if an additional paranthesis is added the invariant is working as expected:
original: status in ('registered'|'cancelled') or value.exists() or hasMember.exists() or component.exists() or dataAbsentReason.exists()
modified: (status in ('registered'|'cancelled')) or value.exists() or hasMember.exists() or component.exists() or dataAbsentReason.exists()