Help Needed: Empty Bundle When Converting CCDA to FHIR in InterSystems IRIS
Hello Community,
I'm a beginner and currently working on a project to convert CCDA files to FHIR using InterSystems IRIS. I have developed a web form to upload CCDA files, and I'm attempting to convert the uploaded CCDA files to FHIR. However, I am encountering an issue where the conversion process results in an empty entry.
Here's the Output it displays on HTML page:
Size of CCDA Stream: 74152
vR4
{"resourceType":"Bundle","type":"transaction","entry":[]}Here is my code: CCDtoFHIR.csp
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><title>CCDA to FHIR Converter</title></head><body><section><div><p>CCDA to FHIR Converter</p><div><div><h1>Upload CCDA File</h1><formid="fileUploadForm"enctype="multipart/form-data"method="post"action="CCDtoFHIR.csp"><div><labelfor="file">Upload CCDA File</label><inputtype="file"name="file"id="file"required></div><div><buttontype="submit">Upload</button></div></form><csp:ifcondition='($data(%request.MimeData("file",1)))'><hr><br><b>FHIR Conversion Result:</b><br><ul><scriptlanguage="cache"runat="server"></script></ul></csp:if></div></div></div></section></body></html>
Problem Description:
- The CCDA file uploads successfully, and I can see the size of the uploaded stream.
- The transformation to SDA3 seems to work fine without errors.
- The conversion from SDA3 to FHIR appears to be successful, but the resulting FHIR bundle is empty.
Debugging Steps:
- I've ensured that the CCDA stream is read correctly.
- I confirmed that the transformation to SDA3 does not produce any errors.
- I attempted to output some content from the SDA3 stream, which seems fine.
- The FHIR transformation does not produce any errors, but the resulting FHIR bundle is empty.
Questions:
- What could be the reason for obtaining an empty FHIR bundle after the transformation?
- Are there any additional debugging steps or checks I can perform to identify the issue?
- Is there a specific configuration or additional steps required for the
HS.FHIR.DTL.Util.API.Transform.SDA3ToFHIRtransformation process?
Comments
Using your code (simplified by me) from terminal it works fine using a sample CCDA from here.
set ccdaStream = ##class(%Stream.FileBinary).%OpenId("c:\temp\CCDA_CCD_b1_Ambulatory_v2.xml")
write"Size of CCDA Stream: ", ccdaStream.Size,!
set xsltTransform = "SDA3/CCDA-to-SDA.xsl"set tTransformer = ##class(HS.Util.XSLTTransformer).%New()
set tSC = tTransformer.Transform(ccdaStream, xsltTransform, .sdaStream)
if 'tSC write"Transformation to SDA3 failed with error ",$system.Status.GetErrorText(tSC),!
set fhirStream = ##class(%Stream.TmpBinary).%New()
set SDA3ToFHIRObject = ##class(HS.FHIR.DTL.Util.API.Transform.SDA3ToFHIR).TransformStream(sdaStream, "HS.SDA3.Container", "R4")
if '$isobject(SDA3ToFHIRObject.bundle) write"Failed to transform SDA3 to FHIR",!
do SDA3ToFHIRObject.bundle.%ToJSON()
The result/output is a pretty long JSON FHIR bundle with CCDA data (I didn't check the content!)
Does your code works with that sample CCDA?
If not, then maybe there is something wrong in your CCDA.
For my test I used: IRIS for Windows (x86-64) 2024.1 (Build 267_2U) Tue Apr 30 2024 16:35:10 EDT
Thanks, Enrico Parisi for your reply, I tried using the sample CCDA from here, but it's still showing empty entry for me.
Did you try from terminal using the EXACT code I posted?
What product are you using? You mention "IRIS 2022.2" is it IRIS for Health?
Yes, I tried the exact code just instead of "c:\temp\CCDA_CCD_b1_Ambulatory_v2.xml" I gave the location of same CCDA on my server.
Yes, it is IRIS for Health.
Just tested using IRIS for Health 2022.2 installed in a temp VM and it works fine.
Can you share the terminal output when you run that code?
I am using studio's terminal to run the code.
set ccdaStream = ##class(%Stream.FileBinary).%OpenId("/tmp/CCDA_CCD_b1_Ambulatory_v2.xml")
write"Size of CCDA Stream: ", ccdaStream.Size,!
Size of CCDA Stream: 171823set xsltTransform = "SDA3/CCDA-to-SDA.xsl"set tTransformer = ##class(HS.Util.XSLTTransformer).%New()
set tSC = tTransformer.Transform(ccdaStream, xsltTransform, .sdaStream)
if 'tSC write"Transformation to SDA3 failed with error ",$system.Status.GetErrorText(tSC),!
set fhirStream = ##class(%Stream.TmpBinary).%New()
set SDA3ToFHIRObject = ##class(HS.FHIR.DTL.Util.API.Transform.SDA3ToFHIR).TransformStream(sdaStream, "HS.SDA3.Container", "R4")
if '$isobject(SDA3ToFHIRObject.bundle) write"Failed to transform SDA3 to FHIR",!
do SDA3ToFHIRObject.bundle.%ToJSON()
{"resourceType":"Bundle","type":"transaction","entry":[]}
Can you please run it from a regular terminal/session?
Hey @Enrico Parisi I don't have access to a regular terminal, but I tried doing that using a web terminal provided by InterSystems online course, it's working fine. I am getting the complete bundle.
Can you tell what is the issue? Why am I not able to get the same through my CSP page?
.