medizininformatik-initiative / feasibility-backend

Backend of the feasibility-gui.
Apache License 2.0
2 stars 4 forks source link

HAPI fails to execute CQL query via DSF middleware #6

Closed DiCanio closed 2 years ago

DiCanio commented 2 years ago

When using the DSF middleware in conjunction with a HAPI FHIR server and dispatching a valid CQL query then this leads to the following error:

BPE Site Log:

AbstractServiceDelegate.execute(78) | Process wwwnetzwerk-universitaetsmedizinde_executeSimpleFeasibility:1:8 has fatal error in step evaluateMeasure:104 for task with id Task/f5032e03-7d36-4d62-99c8-7100b618d1aa/_history/2, reason: HTTP 500 : Failed to call access method: java.lang.NullPointerException

Tracing this error all the way back to the HAPI FHIR server itself, leads to the following log snippet:

java.lang.IllegalArgumentException: libraryIdentifier Id is null
    at org.cqframework.cql.cql2elm.LibraryManager.resolveLibrary(LibraryManager.java:95)
    at org.opencds.cqf.cql.evaluator.engine.execution.TranslatingLibraryLoader.translate(TranslatingLibraryLoader.java:141)
    at org.opencds.cqf.cql.evaluator.engine.execution.TranslatingLibraryLoader.load(TranslatingLibraryLoader.java:86)
    at org.opencds.cqf.cql.evaluator.engine.execution.CacheAwareLibraryLoaderDecorator.load(CacheAwareLibraryLoaderDecorator.java:49)
    at ca.uhn.fhir.cql.r4.helper.LibraryHelper.loadLibraries(LibraryHelper.java:135)
    at ca.uhn.fhir.cql.r4.evaluation.MeasureEvaluationSeed.setup(MeasureEvaluationSeed.java:80)
    at ca.uhn.fhir.cql.r4.provider.MeasureOperationsProvider.evaluateMeasure(MeasureOperationsProvider.java:95)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at ca.uhn.fhir.rest.server.method.BaseMethodBinding.invokeServerMethod(BaseMethodBinding.java:264)
    at ca.uhn.fhir.rest.server.method.OperationMethodBinding.invokeServer(OperationMethodBinding.java:332)
    at ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding.doInvokeServer(BaseResourceReturningMethodBinding.java:296)
    at ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding.invokeServer(BaseResourceReturningMethodBinding.java:404)
    at ca.uhn.fhir.rest.server.method.OperationMethodBinding.invokeServer(OperationMethodBinding.java:307)
    at ca.uhn.fhir.rest.server.RestfulServer.handleRequest(RestfulServer.java:1146)
    at ca.uhn.fhir.rest.server.RestfulServer.doGet(RestfulServer.java:407)
    at ca.uhn.fhir.rest.server.RestfulServer.service(RestfulServer.java:1856)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

This is due to a missing name attribute on the library resource, as @wetret figured out. Thus, we should add this attribute within the DSFQueryManager when creating a library resource.

DiCanio commented 2 years ago

Resolved. For more information see #7