prime-reportstream icon indicating copy to clipboard operation
prime-reportstream copied to clipboard

fhirdata command not working for hl7->fhir conversions

Open JFisk42 opened this issue 1 year ago • 2 comments

Describe the bug

The fhirdata command produces an exception when attempting to convert from hl7->fhir. A check that requires fhir data to be present was introduced.

Impact on ReportStream

Any engineer trying to generate FHIR data from a HL7 file will encounter an exception causing the tool to fail. This has an impact on any developer trying to create or update large amounts of FHIR data as they will not be able to.

Steps to reproduce

Steps to reproduce the behavior:

  1. Run a fhirdata command to go from hl7 to fhir (ex: ./gradlew primeCLI --args="fhirdata --input-file src/testIntegration/resources/datatests/HL7_to_FHIR/sample_oml_20240319-001.hl7 --output-file src/testIntegration/resources/datatests/HL7_to_FHIR/sample_oml_20240319-001.fhir --output-format FHIR"
  2. See the DataFormatException

Expected behavior

The fhirdata command should successfully convert hl7 to fhir data.

Resources

Issue was introduced here: https://github.com/CDCgov/prime-reportstream/pull/15865

Logs

Current output when hl7->fhir conversion is attempted. Note that the root code issue is inaccessible in the stack trace. What happens is that it is taking hl7 files and attempting to parse them as fhir.

> Task :prime-router:primeCLI FAILED
Exception in thread "main" ca.uhn.fhir.parser.DataFormatException: HAPI-1861: Failed to parse JSON encoded FHIR content: HAPI-1859: Content does not appear to be FHIR JSON, first non-whitespace character was: 'M' (must be '{')
        at ca.uhn.fhir.parser.json.jackson.JacksonStructure.load(JacksonStructure.java:150)
        at ca.uhn.fhir.parser.json.jackson.JacksonStructure.load(JacksonStructure.java:79)
        at ca.uhn.fhir.parser.JsonParser.doParseResource(JsonParser.java:240)
        at ca.uhn.fhir.parser.BaseParser.parseResource(BaseParser.java:647)
        at ca.uhn.fhir.parser.BaseParser.parseResource(BaseParser.java:702)
        at gov.cdc.prime.router.fhirengine.utils.FhirTranscoder.decode(FhirTranscoder.kt:60)
        at gov.cdc.prime.router.fhirengine.utils.FhirTranscoder.decode$default(FhirTranscoder.kt:59)
        at gov.cdc.prime.router.cli.ProcessFhirCommands.run(ProcessFhirCommands.kt:142)
        at com.github.ajalt.clikt.parsers.Parser.finalizeAndRun(Parser.kt:348)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:218)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:245)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:42)
        at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:457)
        at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:454)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:474)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:481)
        at gov.cdc.prime.router.cli.MainKt.main(main.kt:306)
Caused by: ca.uhn.fhir.parser.DataFormatException: HAPI-1859: Content does not appear to be FHIR JSON, first non-whitespace character was: 'M' (must be '{')
        at ca.uhn.fhir.parser.json.jackson.JacksonStructure.load(JacksonStructure.java:108)
        ... 16 more

Additional context

Add any other historical context about the problem here.

JFisk42 avatar Oct 01 '24 23:10 JFisk42

@JFisk42 what is the impact of this issue on our developers? In other words, what's the current work around? Please add this detail to ticket.

arnejduranovic avatar Oct 07 '24 15:10 arnejduranovic

@arnejduranovic I have updated the Impact section, let me know if that still isn't clear enough.

JFisk42 avatar Oct 08 '24 17:10 JFisk42

Hey team! Please add your planning poker estimate with Zenhub @adegolier @arnejduranovic @david-navapbc @jack-h-wang @JFisk42 @kant777 @mkalish @thetaurean

MichaelEsuruoso avatar Oct 15 '24 16:10 MichaelEsuruoso

Please add your planning poker estimate with Zenhub @jalbinson

MichaelEsuruoso avatar Oct 15 '24 16:10 MichaelEsuruoso

@victor-chaparro Looking back at this ticket after I logged it, it's not entirely clear what functionality https://github.com/CDCgov/prime-reportstream/pull/15865 was implementing. Are you able to provide any guidance?

JFisk42 avatar Oct 15 '24 16:10 JFisk42