hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2.04k stars 1.33k forks source link

Measure evaluate parameters are different than documented #3479

Closed dcw312 closed 1 year ago

dcw312 commented 2 years ago

Describe the bug CQL Measure Evaluate does not work as documented. Specifically the subject and reportType params

To Reproduce Steps to reproduce the behavior:

  1. Load /Measure/BreastCancerScreeningsFHIR bundle from https://raw.githubusercontent.com/cqframework/ecqm-content-r4/master/bundles/measure/BreastCancerScreeningFHIR/BreastCancerScreeningFHIR-bundle.json
  2. Evaluate measure per documentation (note spelling BreastCancerScreeningFHIR vs BreastCancerScreeningsFHIR) https://github.com/hapifhir/hapi-fhir/blame/35dedb86289a30d8d8fe7404c9248a1e9f159446/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_cql/cql_measure.md#L89
    curl 'http://localhost:8080/fhir/Measure/BreastCancerScreeningsFHIR/$evaluate-measure?periodStart=2019-01-01&periodEnd=2019-12-31&subject=Patient/numer-EXM125&reportType=subject'
  3. Observe error: HAPI-0389: Failed to call access method: java.lang.IllegalArgumentException: HAPI-1664: Invalid report type: subject

Expected behavior Measure Report is generated

Environment (please complete the following information):

dcw312 commented 2 years ago

Note that getting the parameters patient=numer-EXM125&reportType=patient from the source code works

curl 'http://localhost:8080/fhir/Measure/BreastCancerScreeningsFHIR/$evaluate-measure?periodStart=2019-01-01&periodEnd=2019-12-31&patient=numer-EXM125&reportType=patient'
dcw312 commented 2 years ago

@JPercival It looks like the documentation matches the standard (but not the implementation). If you confirm, I'll consider adding "subject" and reportType=subject. Should I keep backward compatibility in the implementation? I assume so, but curious to know your thoughts. @rob-reynolds fyi https://build.fhir.org/measure-operation-evaluate-measure.html

tonyashm commented 1 year ago
http://localhost:8080/fhir/Measure/BreastCancerScreeningFHIR/$evaluate-measure?periodStart=2019-01-01&periodEnd=2019-12-31&subject=numerator&reportType=subject-list

works when using the hapi-fhir-jpaserver-starter* and changing the hapi-fhir-jpaserver-cql dependency from ${project.version} to 6.3.2:

<dependency>
         <groupId>ca.uhn.hapi.fhir</groupId>
         <artifactId>hapi-fhir-jpaserver-cql</artifactId>
         <version>6.2.3</version>
</dependency>

Note that there is still an error existing that causes the CQL engine to break when there're 20 or more resources to be evaluated (see https://github.com/hapifhir/hapi-fhir/issues/4025)

* you may want to go to Kevin Dougan's commit of August 15, 2022 (4978f32e320da49317ba490db11712d83834c8c6)

JPercival commented 1 year ago

Resolved by #4347. The parameters have been updated to match the spec.