hapi-fhir icon indicating copy to clipboard operation
hapi-fhir copied to clipboard

Error: Operation $evaluate-measure on a large population

Open alackerbauer opened this issue 1 year ago • 2 comments

When trying to submit a GET request with Measure operation $evaluate-measure and practitioner as a parameter on a large population an error appears.

Example-Request: *GET http://localhost:8000/Measure/ImmunizationStatus/$evaluate-measure?practitioner=ImmunizationStatus-practitioner-1``

        "resourceType": "OperationOutcome",
        "issue": [
                {
                        "severity": "error",
                        "code": "processing",
                        "diagnostics": "HAPI-0389: Failed to call access method: ca.uhn.fhir.context.ConfigurationException: HAPI-0464: Attempt to request all resources from an asynchronous search result.  The SearchParameterMap for this search probably should have been synchronous."
                }
        ]
}

The following POSTman collection, that was tested on the JPA-server-starter project, can be used to reproduce the error. This collection contains one failing request and >1000 test resources, including over 60 test patients.

https://gitlab.com/smilecdr-open-source/immunization-cql-poc/-/blob/main/resources/postman_collection_submission_v1.json

Please note, that you might need to enable cql_enabled=true (for jpa-server-starter in application.yaml).

My hint is that the trouble makers are these LOC / functions:

  1. https://github.com/hapifhir/hapi-fhir/blob/master/hapi-fhir-jpaserver-cql/src/main/java/ca/uhn/fhir/cql/r4/evaluation/MeasureEvaluation.java#L110
  2. https://github.com/hapifhir/hapi-fhir/blob/master/hapi-fhir-jpaserver-cql/src/main/java/ca/uhn/fhir/cql/r4/evaluation/MeasureEvaluation.java#L123

and for some reason the result of those large searches when calling Provider.getAllResources() is empty (or maybe took too long?)

alackerbauer avatar Sep 14 '22 09:09 alackerbauer

Latest update: This bug has potentially been fixed by this pull request: https://github.com/hapifhir/hapi-fhir/commit/6c0c730ebcf857667a9e810804b50a68c9628468

manual testing with postman collection still pending.

alackerbauer avatar Sep 15 '22 07:09 alackerbauer

Update, the bug still exists, the threshold to reproduce the bug has just been increase to 50 results. Still being worked on

longma1 avatar Sep 15 '22 14:09 longma1

+1

DWay17 avatar Oct 28 '22 12:10 DWay17

+1

tonyashm avatar Jan 06 '23 16:01 tonyashm

This should be resolved with #4347.

JPercival avatar Feb 14 '23 18:02 JPercival

(Please re-open if the issue re-occurs)

JPercival avatar Feb 14 '23 18:02 JPercival