projecttacoma / fqm-execution

fqm-execution is a library that allows users to calculate FHIR-based electronic Clinical Quality Measures (eCQMs) and retrieve the results in a variety of formats
https://projecttacoma.github.io/fqm-execution/
Apache License 2.0
18 stars 6 forks source link

Calculator.calculate results in e.map is not a function error #205

Closed sb-cecilialiu closed 1 year ago

sb-cecilialiu commented 1 year ago

Summary

Expected Behavior

Version or Commit

Inputs (e.g. Measure Bundle, Patient Bundle, CQL Library)

Relevant Calculation Options (e.g. Measurement Period, meta.profile Validation)

cql-to-elm Version Used for Measure Logic Translation (if known)

Any Additional Info

sb-cecilialiu commented 1 year ago

e.map is not a function.docx

sb-cecilialiu commented 1 year ago

measureBundle.txt patientBundle.txt attached bundle files and screen shot

mgramigna commented 1 year ago

Hi @sb-cecilialiu. I looked at this briefly and identified it as an issue with the patient data, not fqm-execution. The following FHIR Observation is taken from your patient:

{
  "fullUrl": "http://GoodHealthcare.com/Observation/numer-pass-CMS646v0QICore4-4",
  "resource": {
    "resourceType": "Observation",
    "id": "numer-pass-CMS646v0QICore4-4",
    "meta": {
      "profile": [
        "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"
      ]
    },
    "status": "final",
    "category": [
      {
        "coding": [
          {
            "system": "http://terminology.hl7.org/CodeSystem/observation-category",
            "code": "procedure",
            "display": "Procedure"
          }
        ]
      }
    ],
    "code": {
      "coding": [
        {
          "system": "http://loinc.org",
          "code": "21902-2",
          "display": "Stage group.pathology Cancer"
        }
      ]
    },
    "subject": { "reference": "Patient/numer-pass-CMS646v0QICore4" },
    "partOf": { "reference": "Procedure/numer-pass-CMS646v0QICore4-3" },
    "effectivePeriod": {
      "start": "2022-02-01T08:00:00.000+00:00",
      "end": "2022-02-02T08:15:00.000+00:00"
    },
    "issued": "2022-02-02T08:15:00.000+00:00",
    "valueCodeableConcept": {
      "coding": [
        {
          "system": "http://snomed.info/sct",
          "code": "369949005",
          "display": "Ta: Noninvasive papillary carcinoma (urinary tract) (finding)",
          "userSelected": true
        }
      ]
    }
  },
  "request": {
    "method": "PUT",
    "url": "Observation/numer-pass-CMS646v0QICore4-4"
  }
}

The attribute "partOf": { "reference": "Procedure/numer-pass-CMS646v0QICore4-3" } is a cardinality violation of the FHIR spec. Per the Structure Definition of a QI Core Observation, partOf is 0..*, meaning it needs to be an array.

If you change the patient data to have "partOf": [{ "reference": "Procedure/numer-pass-CMS646v0QICore4-3" }] instead, it will work

sb-cecilialiu commented 1 year ago

@mgramigna Thank you so much Matt!

mgramigna commented 1 year ago

@sb-cecilialiu You're welcome!

I saw that this came from https://oncprojectracking.healthit.gov/support/browse/BONNIEMAT-1369, originally reported by @srankins.

With this issue, I wanted to try and learn more about MADiE's FHIR validation behavior so we can better understand what goes on in the MADiE tool before data is passed in to the fqm-execution calculator.

Is MADiE passing the patient data through FHIR validation of some kind before calculation happens (either a full profile-level validator or a FHIR schema validator)? I would've expected validation to catch this cardinality constraint, so I figured I'd ask

sb-cecilialiu commented 1 year ago

@mgramigna Thanks so much for your patience Matt! Yes MADiE gets the patient data through FHIR validation before calculation happens. I actually did see a warning when this happens, so we are going to investigate our validation and how the errors can be caught.