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

Saving result to local FHIR bundles fails in version 0.3.0 #17

Closed joundso closed 3 years ago

joundso commented 3 years ago

Describe the bug Using the new version 0.3.0-alpha-snapshot the container did not create output files. This happened while converting a local xml file to local FHIR bundles as well while extracting data from the REDCap API to local FHIR bundles.

Main Error text 2021-02-02 07:36:21.206 ERROR 1 --- [ main] d.d.uds.odm2fhir.ODM2FHIRApplication : Failed to retrieve the server metadata statement during client initialization. URL used was /metadata

To Reproduce Steps to reproduce the behavior: Working version (0.2.2):

git clone https://github.com/miracum/odm-2-fhir-job.git
cd odm-2-fhir-job
docker-compose up

Error version (0.3.0):

git clone https://github.com/miracum/odm-2-fhir-job.git
cd odm-2-fhir-job
## Change version tag in `.env` file from `0.2.2-alpha-snapshot` to `0.3.0-alpha-snapshot`:
sed -i 's/0.2.2-alpha-snapshot/0.3.0-alpha-snapshot/g' .env
docker-compose up

Details

Error log

odm2fhir    | 2021-02-02 07:24:44.371  INFO 1 --- [           main] d.d.uds.odm2fhir.ODM2FHIRApplication     : Started ODM2FHIRApplication in 1.16 seconds (JVM running for 1.514)
odm2fhir    | 2021-02-02 07:24:44.374  INFO 1 --- [           main] d.d.uds.odm2fhir.odm.reader.ODMReader    : Reading ODM from file '/workspace/input/ODM.xml'...
odm2fhir    | 2021-02-02 07:24:45.256 ERROR 1 --- [           main] d.d.uds.odm2fhir.ODM2FHIRApplication     : Failed to retrieve the server metadata statement during client initialization. URL used was /metadata
odm2fhir    |
odm2fhir    | ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException: Failed to retrieve the server metadata statement during client initialization. URL used was /metadata
odm2fhir    |   at ca.uhn.fhir.rest.client.impl.RestfulClientFactory.validateServerBase(RestfulClientFactory.java:312) ~[hapi-fhir-client-5.2.1.jar:na]
odm2fhir    |   at ca.uhn.fhir.rest.client.impl.RestfulClientFactory.validateServerBaseIfConfiguredToDoSo(RestfulClientFactory.java:264) ~[hapi-fhir-client-5.2.1.jar:na]
odm2fhir    |   at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:227) ~[hapi-fhir-client-5.2.1.jar:na]
odm2fhir    |   at ca.uhn.fhir.rest.client.impl.GenericClient$BaseClientExecutable.invoke(GenericClient.java:540) ~[hapi-fhir-client-5.2.1.jar:na]
odm2fhir    |   at ca.uhn.fhir.rest.client.impl.GenericClient$FetchConformanceInternal.execute(GenericClient.java:827) ~[hapi-fhir-client-5.2.1.jar:na]
odm2fhir    |   at de.difuture.uds.odm2fhir.fhir.writer.FHIRBundleServerWriter.write(FHIRBundleServerWriter.java:124) ~[classes/:0.3.0-alpha-SNAPSHOT]
odm2fhir    |   at de.difuture.uds.odm2fhir.ODM2FHIRApplication.process(ODM2FHIRApplication.java:76) ~[classes/:0.3.0-alpha-SNAPSHOT]
odm2fhir    |   at de.difuture.uds.odm2fhir.ODM2FHIRApplication.run(ODM2FHIRApplication.java:67) ~[classes/:0.3.0-alpha-SNAPSHOT]
odm2fhir    |   at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:804) ~[spring-boot-2.4.2.jar:2.4.2]
odm2fhir    |   at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:788) ~[spring-boot-2.4.2.jar:2.4.2]
odm2fhir    |   at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) ~[spring-boot-2.4.2.jar:2.4.2]
odm2fhir    |   at de.difuture.uds.odm2fhir.ODM2FHIRApplication.main(ODM2FHIRApplication.java:58) ~[classes/:0.3.0-alpha-SNAPSHOT]
odm2fhir    |   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
odm2fhir    |   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
odm2fhir    |   at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[workspace/:na]
odm2fhir    |   at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) ~[workspace/:na]
odm2fhir    |   at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[workspace/:na]
odm2fhir    |   at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[workspace/:na]
odm2fhir    | Caused by: ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException: Failed to parse response from server when performing GET to URL /metadata - org.apache.http.client.ClientProtocolException
odm2fhir    |   at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:400) ~[hapi-fhir-client-5.2.1.jar:na]
odm2fhir    |   at ca.uhn.fhir.rest.client.impl.GenericClient$BaseClientExecutable.invoke(GenericClient.java:540) ~[hapi-fhir-client-5.2.1.jar:na]
odm2fhir    |   at ca.uhn.fhir.rest.client.impl.GenericClient$FetchConformanceInternal.execute(GenericClient.java:827) ~[hapi-fhir-client-5.2.1.jar:na]
odm2fhir    |   at ca.uhn.fhir.rest.client.impl.RestfulClientFactory.validateServerBase(RestfulClientFactory.java:300) ~[hapi-fhir-client-5.2.1.jar:na]
odm2fhir    |   ... 19 common frames omitted
odm2fhir    | Caused by: org.apache.http.client.ClientProtocolException: null
odm2fhir    |   at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187) ~[httpclient-4.5.13.jar:4.5.13]
odm2fhir    |   at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) ~[httpclient-4.5.13.jar:4.5.13]
odm2fhir    |   at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108) ~[httpclient-4.5.13.jar:4.5.13]
odm2fhir    |   at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) ~[httpclient-4.5.13.jar:4.5.13]
odm2fhir    |   at ca.uhn.fhir.rest.client.apache.ApacheHttpRequest.execute(ApacheHttpRequest.java:70) ~[hapi-fhir-client-5.2.1.jar:na]
odm2fhir    |   at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:303) ~[hapi-fhir-client-5.2.1.jar:na]
odm2fhir    |   ... 22 common frames omitted
odm2fhir    | Caused by: org.apache.http.ProtocolException: Target host is not specified
odm2fhir    |   at org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.java:71) ~[httpclient-4.5.13.jar:4.5.13]
odm2fhir    |   at org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:125) ~[httpclient-4.5.13.jar:4.5.13]
odm2fhir    |   at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) ~[httpclient-4.5.13.jar:4.5.13]
odm2fhir    |   ... 27 common frames omitted
odm2fhir    |
odm2fhir exited with code 0
holger-stenzhorn commented 3 years ago

@joundso Can you provide your .env here so that we have all information on how to reproduce your issue in one place?

holger-stenzhorn commented 3 years ago

Fixed. Please retry with the updated image.

P.S.: If you want you do not need to explicitly specify the actual version of the ODM2FHIR image, e.g. 0.3.0-alpha-snapshot, but simply leave it out as the image is always automatically tagged as latest.

joundso commented 3 years ago

@holger-stenzhorn: The .env file is in the repo. The error occurred while producing local files, NOT while connecting to the FHIR server and still occurs with the new version with tag 0.3.0 from 30 minutes ago.

odm2fhir    | 2021-02-02 09:15:17.841  INFO 1 --- [           main] ca.uhn.fhir.context.FhirContext          : Creating new FHIR context for FHIR version [R4]
odm2fhir    | 2021-02-02 09:15:17.976  INFO 1 --- [           main] d.d.uds.odm2fhir.ODM2FHIRApplication     : Started ODM2FHIRApplication in 1.275 seconds (JVM running for 1.697)
odm2fhir    | 2021-02-02 09:15:17.980  INFO 1 --- [           main] d.d.uds.odm2fhir.odm.reader.ODMReader    : Reading ODM from file '/workspace/input/ODM.xml'...
odm2fhir    | 2021-02-02 09:15:18.565  INFO 1 --- [           main] ca.uhn.fhir.util.XmlUtil                 : FHIR XML procesing will use StAX implementation 'Woodstox' version '6.2.3'
odm2fhir    | 2021-02-02 09:15:19.381 ERROR 1 --- [           main] d.d.uds.odm2fhir.ODM2FHIRApplication     : Failed to retrieve the server metadata statement during client initialization. URL used was /metadata
odm2fhir    |
odm2fhir    | ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException: Failed to retrieve the server metadata statement during client initialization. URL used was /metadata

To reproduce:

git clone https://github.com/miracum/odm-2-fhir-job.git
cd odm-2-fhir-job
## Change version tag in `.env` file from `0.2.2-alpha-snapshot` to `0.3.0-alpha-snapshot`:
sed -i 's/0.2.2-alpha-snapshot/0.3.0-alpha-snapshot/g' .env
docker-compose up
holger-stenzhorn commented 3 years ago

@joundso Of course, the mentioned .env file is in your repository but it is a different repository which is not under our "control" and so that .env file could become out of sync as you only have a master branch and no tags there. Besides that it is always best to have all information on how to reproduce an error in the actual issue report. So could you drop your .env file here? Thanks! 🤝

joundso commented 3 years ago

OK, here is the docker-compose.yml and .env file form the repo above

version: "3.7"

services:
  odm2fhir:
    container_name: odm2fhir
    # image: docker.pkg.github.com/num-codex/odm2fhir/odm2fhir:${IMAGE_TAG}
    image: ghcr.io/num-codex/odm2fhir:${IMAGE_TAG}
    restart: "no"
    # environment:
      # - odm.redcap.api.url=${odm_redcap_api_url}
      # - odm.redcap.api.token=${odm_redcap_api_token}
      # - fhir.server.url=${fhir_server_url}
      # - fhir.server.basicauth.username=${fhir_server_basicauth_username}
      # - fhir.server.basicauth.password=${fhir_server_basicauth_password}
      # - fhir.server.oauth2.token.url=${fhir_server_oauth2_token_url}
      # - fhir.server.oauth2.client.id=${fhir_server_oauth2_client_id}
      # - fhir.server.oauth2.client.secret=${fhir_server_oauth2_client_secret}
    volumes:
      - ${ODM_FILE_PATH}:/workspace/input/ODM.xml
      - ${FHIR_BUNDLES_FOLDER_PATH}:/workspace/output
## Image-Tag (see here: https://github.com/num-codex/odm2fhir/packages):
IMAGE_TAG=0.2.2-alpha-snapshot

## REDCap API:
# odm_redcap_api_url=https://redcap.hospital.com/api/

## API-Key:
# odm_redcap_api_token=123456abcd

## Path to input file:
ODM_FILE_PATH=./in/demo.xml

## Path for output files:
FHIR_BUNDLES_FOLDER_PATH=./out

# fhir_server_url=url

# fhir_server_basicauth_username=username
# fhir_server_basicauth_password=password

# fhir_server_oauth2_token_url=url
# fhir_server_oauth2_client_id=id
# fhir_server_oauth2_client_secret=secret

cron="0 0 0 0 * *"
holger-stenzhorn commented 3 years ago

@joundso Code and image updated. Could you please retry?

joundso commented 3 years ago

@joundso Code and image updated. Could you please retry?

Now it works. Thanks!