FHIR Chat · constraints questions · implementers

Stream: implementers

Topic: constraints questions


view this post on Zulip Sasa (Oct 15 2018 at 16:50):

I have some questions about constraints on Observations and the vitalSigns profile for Observations. Specifically I'm interested in the following constraints with respect to some resource (I'll add the resources down below.) I'd like to know if the constraints should pass or fail on the specific resource and why.

1.) If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource
dom-3: contained.where(('#'+id in %resource.descendants().reference).not()).empty()
The resource follows

{
  "resourceType": "Bundle",
  "type": "collection",
  "entry": [
    {
      "resource": {
        "resourceType": "Claim",
        "contained": [
          {
            "resourceType": "Bundle",
            "type": "collection",
            "entry": [
              {
                "resource": {
                  "resourceType": "Claim",
                  "information": [
                    {
                      "sequence": 1
                    }
                  ]
                }
              }
            ]
          }
        ],
        "information": [
          {
            "sequence": 1
          }
        ],
        "invalid": "cannot have extra fields"
      }
    }
  ]
}

What is %resource in this example? What "should" the constraint evaluate to?


1.) If code is the same as a component code then the value element associated with the code SHALL NOT be present
obs-7: (value.empty() or code!=component.code)

2.) If there is no component or related element then either a value[x] or a data absent reason must be present
vs-2: (component.empty() and related.empty()) implies (dataAbsentReason or value)

The resource follows.

{

            "resourceType": "Observation",
            "meta": {
                "profile": ["http://hl7.org/fhir/StructureDefinition/vitalsigns"]
            },
            "status": "registered",
            "code": {
                "coding": [
                    {
                        "system": "http://loinc.org",
                        "code": "29463-7",
                        "display": "Body Weight"
                    }
                ]
            },
            "category": [
                {
                    "coding": [
                        {
                            "system": "http://hl7.org/fhir/observation-category",
                            "code": "vital-signs"
                        }
                    ]
                }
            ],
            "subject": {
                "reference": "Patient/aPatientId"
            },
            "effectiveDateTime": "2018-02-14T13:42:00+10:00",
            "valueQuantity": {
                "value": 60,
                "unit": "mmHg",
                "system": "http://unitsofmeasure.org",
                "code": "mm[Hg]"
            }
    }

For the example above If you have (component.empty() and related.empty()) implies (dataAbsentReason or value) then
1.) component.empty() -> true
2.) related.empty() -> true
3.) left had side -> true i.e. the right hand side will be what we return
4.) dataAbsentReason -> {}
5.) value -> { valueQuantity:{..} }
6.) {} or { valueQuantity:{..} } -> Error

In this example the constraint will always error. it doesn't have a defined behavior when it is being or'd with a list with some actual values inside of it. How can this be remedied?


Last updated: Apr 12 2022 at 19:14 UTC