Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null pointer exception exercising operations $collect-data and $evaluate-measure #3061

Closed
kmbarton423 opened this issue Dec 1, 2021 · 5 comments
Assignees
Labels
bug Something isn't working cql

Comments

@kmbarton423
Copy link
Contributor

kmbarton423 commented Dec 1, 2021

Running IBM FHIR Server 4.10.0 with CPG and CQF operations.
When attempting to confirm required and optional parameters, hit null pointer exception:

   "resourceType": "OperationOutcome",
  "issue": 
      "severity": "fatal",
      "code": "exception",
      "details": {
        "text": "NullPointerException: <null message>"

Null pointer exception received for each of the following cases:

  • /Measure/$collect-data?periodStart=2014-01-31&periodEnd=2014-12-31&measure=Measure/measure-EXM104-8.2.000
  • /Measure/$evaluate-measure?periodStart=2014-01-31&periodEnd=2014-12-31&measure=Measure/measure-EXM104-8.2.000
  • /Measure/measure-EXM104-8.2.000/$evaluate-measure?periodStart=2014-01-31&periodEnd=2014-12-31
@kmbarton423 kmbarton423 added bug Something isn't working cql labels Dec 1, 2021
@csandersdev
Copy link
Contributor

csandersdev commented Dec 1, 2021

Looks like I'm not handling the "Measure not found" use case very well. You need to load the Measure resource you are trying to use into your server prior to invoking these methods and make sure the measure parameter matches the loaded resource's ID. The resources that I use to test with are in fhir-server-test/src/test/resources/testdata/Bundle-EXM74-10.2.000.json, cql/operation/fhir-operation-cpq/src/test/resources, and cql/operation/fhir-operation-cqf/src/test/resources

[12/1/21, 13:26:14:360 EST] 00000046 com.ibm.fhir.server.resources.FHIRResource E An unexpected exception occurred while processing the request^M
java.lang.NullPointerException^M
at com.ibm.fhir.operation.cqf.AbstractMeasureOperation.doMeasureEvaluation(AbstractMeasureOperation.java:90)^M
at com.ibm.fhir.operation.cqf.EvaluateMeasureOperation.doInvoke(EvaluateMeasureOperation.java:91)^M
at com.ibm.fhir.operation.cqf.MeasureCollectDataOperation.doInvoke(MeasureCollectDataOperation.java:51)^M
at com.ibm.fhir.server.operation.spi.AbstractOperation.invoke(AbstractOperation.java:57)^M
at com.ibm.fhir.server.util.FHIRRestHelper.doInvoke(FHIRRestHelper.java:1171)^M
at com.ibm.fhir.server.resources.Operation.invoke(Operation.java:215)^M

@csandersdev
Copy link
Contributor

Dug into this a little more and it turns out the measure parameter is implemented as a lookup by canonical URL right now. This is a bit different from the reference implementation which assumes that the evaluate measure is called on only at the instance level and thus always resolves by ID. This is definitely an area where we could beef up support so that we offered both URL-based and ID-based lookup.

csandersdev added a commit that referenced this issue Dec 7, 2021
references both by resource ID and canonical URL (previously only
canonical URL) and then to also to provide error handling for when the
measure does not properly resolve.

This PR also relates to the missing feature support documented in #2618
not by implementing those features, but by adding error handling that
clearly states to the user those features are not supported at this
time.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>
@kmbarton423
Copy link
Contributor Author

Retried the three cases listed above. Still getting NPE. See attached "recreate3061stacktraces.txt"
https://app.zenhub.com/files/202361279/4e1c546d-e5da-422e-9e70-95737b789f56/download

csandersdev added a commit that referenced this issue Jan 12, 2022
I applied a fix before the holiday that corrected a category of NPE
errors related to execution against a measure or library resources that
don't exist. It turns out that wasn't the core of the issue 3061. This
goes back and addresses when a valid measure reference is used, but that
Measure refers to a Library resource that does not exist. I also added
some handling that allows resolution of Library resources by reference
in addition to by canonical URL in the registry and also updated the
error handling around retrieving the primary library reference from the
Measure resource.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>
lmsurpre pushed a commit that referenced this issue Jan 14, 2022
* #3061 - Fix NPE when Measure refers to non-existent library

I applied a fix before the holiday that corrected a category of NPE
errors related to execution against a measure or library resources that
don't exist. It turns out that wasn't the core of the issue 3061. This
goes back and addresses when a valid measure reference is used, but that
Measure refers to a Library resource that does not exist. I also added
some handling that allows resolution of Library resources by reference
in addition to by canonical URL in the registry and also updated the
error handling around retrieving the primary library reference from the
Measure resource.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Update copyright dates

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Whitespace corrections and added javadocs

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>
@prb112
Copy link
Contributor

prb112 commented Jan 14, 2022

@kmbarton423 back to you.

@kmbarton423
Copy link
Contributor Author

Confirmed new behavior for three cases noted above:

Status 500
{
"resourceType": "OperationOutcome",
"id": "ac-11-0-3-0c0abd0d-ee1a-4d16-8cc9-82382e61faf1",
"issue": [
{
"severity": "fatal",
"code": "exception",
"details": {
"text": "FHIROperationException: Failed to resolve Measure resource "measure-EXM104-8.2.000""
}
}
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cql
Projects
None yet
Development

No branches or pull requests

3 participants