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

Place reasonDetail on reasonCode, not coding #226

Closed sarahmcdougall closed 1 year ago

sarahmcdougall commented 1 year ago

Summary

For care gaps, updates the GuidanceResponse.reasonCode to have the reasonDetail extension on the reasonCode itself rather than on the coding.

New behavior

When running care gaps, the structure of the generated GuidanceResponse resources will be different if the reason contains a reference. Previously, the output would look like the following:

"reasonCode": [
  {
    "coding": [
      {
        "system": ... ,
        "code": ... ,
        "display": ...
        "extension": [
          {
            "url": "http://hl7.org/fhir/us/davinci-deqm/StructureDefinition/reasonDetail",
            "extension": [<reason detail extension >]
          }
        ]
      }
    ]
  }
]

The expected output should now have the following format:

"reasonCode": [
  {
    "coding": [
      {
        "system": ...,
        "code": ...,
        "display": ...
      }
    ],
    "extension": [
      {
        "url": "http://hl7.org/fhir/us/davinci-deqm/StructureDefinition/reasonDetail",
        "extension": [<reason detail extension>]
      }
    ]
  }
],

See the GuidanceResponse attachment in this Jira issue to get an understanding of the updated structure. NOTE: it appears that there are several ways of attaching the extension (might be possible to attach it to the reasonCode.coding as well as including it on the root of reasonCode). For now, we will use this approach, but the extension may change in the future.

See the resource profile for Detailed Care Gap Guidance Response for more detail.

Code changes

Testing guidance

npm run cli -- gaps -m <EXM 130 measure bundle> -p <EXM 130 denominator patient bundle> -o -s 2019-01-01 -e 2019-12-31
github-actions[bot] commented 1 year ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟢 Statements
85.4% (+0.01% 🔼)
2024/2370
🟡 Branches 73.97% 1802/2436
🟢 Functions 87.5% 357/408
🟢 Lines
85.7% (+0.01% 🔼)
1953/2279

Test suite run success

380 tests passing in 29 suites.

Report generated by 🧪jest coverage report action from 5e087d6322be13b3f331d22437005aec43742612

p9g commented 1 year ago

Can you add a test with 2 items in the reasonCode array, one with just a coding, and the other with a coding and the extension (with reference and path), for example

 "reasonCode": [
    {
      "coding": [
        {
          "code": "Present",
          "system": "http://hl7.org/fhir/us/davinci-deqm/CodeSystem/care-gap-reason",
          "display": "Data Element is Present"
        }
      ]
    },
    {
      "coding": [
        {
          "code": "ValueInRange",
          "system": "http://hl7.org/fhir/us/davinci-deqm/CodeSystem/care-gap-reason",
          "display": "Value is within specified range"
        }
      ],
      "extension": [
        {
          "extension": [
            {
              "url": "reference",
              "valueReference": {
                "reference": "Patient/cfsb1681933662110"
              }
            },
            {
              "url": "path",
              "valueString": "generalPractitioner"
            }
          ],
          "url": "http://hl7.org/fhir/us/davinci-deqm/StructureDefinition/reasonDetail"
        }
      ]
    }
  ]
sarahmcdougall commented 1 year ago

Can you add a test with 2 items in the reasonCode array, one with just a coding, and the other with a coding and the extension (with reference and path), for example

Good suggestion, I added a test in https://github.com/projecttacoma/fqm-execution/pull/226/commits/5e087d6322be13b3f331d22437005aec43742612 to address this scenario