cqframework / cqf-ruler

FHIR Clinical Reasoning Module Server
Apache License 2.0
63 stars 49 forks source link

Library resource returned by $data-requirements does not conform to Library StructureDefinition #116

Closed mgramigna closed 2 years ago

mgramigna commented 5 years ago

This issue was encountered when running a TestScript that tests if the Library resource returned from a $data-requirements call confirms to the LIbrary Structure Definition, but it can be replicated in Postman without the TestScript.

  1. Get the data requirements for measure-mrp: GET http://measure.eval.kanvix.com/cqf-ruler/baseDstu3/Measure/measure-mrp/$data-requirements?periodStart=2018-01-01&periodEnd=2018-12-31

Should get the following JSON as the response:

{
    "resourceType": "Library",
    "type": {
        "coding": [
            {
                "code": "module-definition"
            }
        ]
    },
    "dataRequirement": [
        {
            "type": "Patient",
            "profile": [
                "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient"
            ]
        },
        {
            "type": "Encounter",
            "profile": [
                "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"
            ],
            "codeFilter": [
                {
                    "path": "type",
                    "valueSetReference": {
                        "reference": "http://ncqa.org/hedis/ValueSet/2.16.840.1.113883.3.666.5.307",
                        "display": "Inpatient Encounter"
                    }
                }
            ],
            "dateFilter": [
                {
                    "path": "period",
                    "valueDuration": {
                        "value": 1,
                        "unit": "a"
                    }
                }
            ]
        },
        {
            "type": "Practitioner",
            "profile": [
                "http://hl7.org/fhir/us/davinci-deqm/StructureDefinition/practitioner-deqm"
            ]
        },
        {
            "type": "Task",
            "profile": [
                "http://ncqa.org/fhir/us/hedis/StructureDefinition/hedis-task"
            ],
            "codeFilter": [
                {
                    "path": "code",
                    "valueSetReference": {
                        "reference": "http://ncqa.org/hedis/ValueSet/2.16.840.1.113883.3.464.1004.1174",
                        "display": "Medication Reconciliation Value Set"
                    }
                }
            ],
            "dateFilter": [
                {
                    "path": "executionPeriod",
                    "valueDuration": {
                        "value": 1,
                        "unit": "a"
                    }
                }
            ]
        },
        {
            "type": "Observation",
            "profile": [
                "http://ncqa.org/fhir/us/hedis/StructureDefinition/hedis-observation"
            ],
            "codeFilter": [
                {
                    "path": "code",
                    "valueSetReference": {
                        "reference": "http://ncqa.org/hedis/ValueSet/2.16.840.1.113883.3.464.1004.1174",
                        "display": "Medication Reconciliation Value Set"
                    }
                }
            ],
            "dateFilter": [
                {
                    "path": "effectiveDateTime",
                    "valueDuration": {
                        "value": 1,
                        "unit": "a"
                    }
                }
            ]
        }
    ]
}
  1. Validate the above JSON using the $validate operation for a Library resource: POST http://measure.eval.kanvix.com/cqf-ruler/baseDstu3/Library/$validate with the above JSON as the request body

The validation fails with HTTP 412 Precondition Failed

{
    "resourceType": "OperationOutcome",
    "text": {
        "status": "generated",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[Library]</td><td><pre>Profile http://hl7.org/fhir/StructureDefinition/Library, Element 'Library.status': minimum required = 1, but only found 0</pre></td>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
    },
    "issue": [
        {
            "severity": "error",
            "code": "processing",
            "diagnostics": "Profile http://hl7.org/fhir/StructureDefinition/Library, Element 'Library.status': minimum required = 1, but only found 0",
            "location": [
                "Library"
            ]
        }
    ]
}

The error message status that "Library.status" is missing, and we can see in the structure definition that "status" does have cardinality 1..1 so it is required. When a "status" property is added to the JSON body for the $validate call, it does return 200 OK.

JPercival commented 2 years ago

Closing as stale. The kanvix server has been retired. The lastest sandbox is here: https://cloud.alphora.com/sandbox/r4/cqm/