num-codex / odm2fhir

This tool maps study/patient data in CDISC ODM based on the GECCO data dictionary to HL7 FHIR which adheres to the GECCO profiles, value sets and code systems.
MIT License
4 stars 1 forks source link

Error executing container: NullPointer in OnsetOfIllness #2

Closed noemide closed 3 years ago

noemide commented 3 years ago

When testing the converter with our ODM files, i got the following error:

:: Spring Boot :: (v2.4.0)

2020-11-23 16:02:00.261 INFO 1 — [ main] d.d.uds.odm2fhir.ODMtoFHIRStandalone : Starting ODMtoFHIRStandalone v0.0.1-alpha-SNAPSHOT using Java 11.0.9.1 on 0c8554d3b594 with PID 1 (/workspace/BOOT-INF/classes started by cnb in /workspace)
2020-11-23 16:02:00.264 INFO 1 — [ main] d.d.uds.odm2fhir.ODMtoFHIRStandalone : No active profile set, falling back to default profiles: default
2020-11-23 16:02:00.952 INFO 1 — [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-11-23 16:02:00.961 INFO 1 — [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-11-23 16:02:00.961 INFO 1 — [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.39]
2020-11-23 16:02:01.010 INFO 1 — [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-11-23 16:02:01.010 INFO 1 — [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 702 ms
2020-11-23 16:02:01.090 INFO 1 — [ main] ca.uhn.fhir.util.VersionUtil : HAPI FHIR version 5.1.0 - Rev 6718826665
2020-11-23 16:02:01.094 INFO 1 — [ main] ca.uhn.fhir.context.FhirContext : Creating new FHIR context for FHIR version [R4]
2020-11-23 16:02:01.227 INFO 1 — [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-11-23 16:02:01.386 INFO 1 — [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-11-23 16:02:01.394 INFO 1 — [ main] d.d.uds.odm2fhir.ODMtoFHIRStandalone : Started ODMtoFHIRStandalone in 1.558 seconds (JVM running for 1.885)
2020-11-23 16:02:01.548 INFO 1 — [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-11-23 16:02:01.562 ERROR 1 — [ main] o.s.boot.SpringApplication : Application run failed

java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:807) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:788) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) ~[spring-boot-2.4.0.jar:2.4.0]
at de.difuture.uds.odm2fhir.ODMtoFHIRStandalone.main(ODMtoFHIRStandalone.java:38) ~[classes/:0.0.1-alpha-SNAPSHOT]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[workspace/:na]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) ~[workspace/:na]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[workspace/:na]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[workspace/:na]
Caused by: java.lang.NullPointerException: null
at de.difuture.uds.odm2fhir.fhir.mapper.OnsetOfIllness.map(OnsetOfIllness.java:35) ~[classes/:0.0.1-alpha-SNAPSHOT]
at de.difuture.uds.odm2fhir.fhir.mapper.MappedSubject.fetchFormData(MappedSubject.java:73) ~[classes/:0.0.1-alpha-SNAPSHOT]
at java.base/java.util.ArrayList.forEach(Unknown Source) ~[na:na]
at de.difuture.uds.odm2fhir.fhir.mapper.MappedSubject.map(MappedSubject.java:39) ~[classes/:0.0.1-alpha-SNAPSHOT]
at de.difuture.uds.odm2fhir.fhir.ODMtoFHIR.lambda$convertODMtoFHIR$0(ODMtoFHIR.java:45) ~[classes/:0.0.1-alpha-SNAPSHOT]
at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[na:na]
at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) ~[na:na]
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[na:na]
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[na:na]
at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source) ~[na:na]
at de.difuture.uds.odm2fhir.fhir.ODMtoFHIR.convertODMtoFHIR(ODMtoFHIR.java:47) ~[classes/:0.0.1-alpha-SNAPSHOT]
at de.difuture.uds.odm2fhir.ODMtoFHIRStandalone.run(ODMtoFHIRStandalone.java:50) ~[classes/:0.0.1-alpha-SNAPSHOT]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:804) ~[spring-boot-2.4.0.jar:2.4.0]
... 11 common frames omitted

2020-11-23 16:02:01.622 INFO 1 — [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'

(One of our datasets is mostly empty for testing purposes... Could this have caused the error?)

cerbelding commented 3 years ago

Dear @noemide, thank you for reporting your issue. This problem is already known and will hopefully be resolved soon.

The reason is that the alpha version of the ODM2FHIR mapper does not contain sufficient handling for null/empty/invalid-values. The class OnsetOfIllness is just the first occurance of this problem.

So you are right in assuming that the mostly empty test data set is the reason.

cerbelding commented 3 years ago

Dear @noemide, I'm currently trying to run your CDISC ODM file, @holger-stenzhorn gave me.

After replacing all Value="" by Value="0" for testing purposes (to bypass the Null-Handling problem), i encountered several problems besides this:

Your error as shown above states Caused by: java.lang.NullPointerException: null at de.difuture.uds.odm2fhir.fhir.mapper.OnsetOfIllness.map(OnsetOfIllness.java:35) ~[classes/:0.0.1-alpha-SNAPSHOT] which does not result from the empty values but from the missing patient_id Item.

Which version of the DataDictionary did you use?

joundso commented 3 years ago

Mea culpa - The two fields geburtsdatum and patient_id are marked as "Identifying fields" in the Data Dictionary (we used the DataDictionary from 13.11.2020). So they are not included in the export if you do not select it. I never do that and therefore I didn't think about it for the demo data. I have now exported the data set again and this time I included the two identifying fields. The mail is on its way. Lets give it another try. Please excuse!

holger-stenzhorn commented 3 years ago

@joundso Can you perhaps try and check whether version 0.0.2-alpha-SNAPSHOT of ODM2FHIR works with your (uncleaned) CDISC ODM export? It should now just return warnings in the log in case of missing or illegal data but not fail.

mia-wis commented 3 years ago

Hello, I am testing the ODM2FHIR Converter on a test dataset from our REDCap instance. Using the data dictionary from the 13.11.2020 and version 0.0.2-alpha-SNAPSHOT, I had a similar error to @noemide but different cause:

Caused by: java.lang.IllegalArgumentException: theMonth must be between 0 and 11

Once I changed the month from 12. to 11. this error did not occur again. I think the "allowable" month range should be corrected? It seems the issue with empty values (value ="") is corrected, as my dataset had missing values but did not through the same error.

However, the FHIR resource was created but not written to a file:

2020-12-07 14:05:29.571  INFO 1 --- [           main] ca.uhn.fhir.context.FhirContext          : Creating new FHIR context for FHIR version [R4]
2020-12-07 14:05:30.865  WARN 1 --- [           main] ca.uhn.fhir.parser.LenientErrorHandler   : Resource is missing required element: value
2020-12-07 14:05:30.973 ERROR 1 --- [           main] d.d.u.o.f.w.FhirBundleToFileWriter       : Failed to write bundle to file

I'm not sure what the missing "value" is... Any ideas? FHIRResNotSaved.txt See the complete response attached.

Thanks in advance!

cerbelding commented 3 years ago

Dear @mia-wis, thanks for your Issue.
I will take a look and come back to you asap.

cerbelding commented 3 years ago

Dear @mia-wis, i fixed the issue regarding the wring DateOfBirth-Handling. It will work within the update of the release.

EDIT: should now work with the newest package version

The warning on a missing value does not affect writing the Bundles to a file. The app only issues this warning when a FHIR-Resource containing a value (e.g. Observation or MedicationStatement) is missing this value (which would be a mandatory property) This will only occur if the value is (a) malformated or (b) missing and adds the Uncertainty-of-Presence-Extension to the resource. (at least for these resources which can't be completely skipped) Therefore, this would be represented as answered with unknown

Regarding your problem with file-writing, can you please paste your docker-command when running the container? This seems like the docker-container isn't allowed to write to the given directory.

mia-wis commented 3 years ago

Hi @cerbelding,

I was using docker login, then the pull and run as shown on the package page:

docker run -v /home/wis/ODM.xml:/workspace/input/ODM.xml -v /home/wis/results/:/workspace/bundle-out docker.pkg.github.com/num-codex/odm2fhir/odm2fhir:0.0.2-alpha-snapshot Can I specify the permission for the container/results folder somewhere?

Thanks!

Emilia

cerbelding commented 3 years ago

Dear @mia-wis, your docker-command looks good. But does the folder /home/wis/results/ already exist? If you haven't created this folder in advance, the docker-daemon will create a file with the same name (in order to mount it as a volume). The app requires a folder instead of a file, as the Bundles are written into seperate files. I got the same error message when testing to run the container without creating the folder in advance.

mia-wis commented 3 years ago

Hi @cerbelding, I just tried deleted/creating the folder but still get the same error message unfortunately. Thanks in advance!

cerbelding commented 3 years ago

I copied the conversation related to @mia-wis's issue to Issue #3. As the original Error from this issue is solved, the issue will be closed.