Hello everyone,
not sure if it is still possible to proceed in this topic, but I am facing a similar problem: would like to embed larger payloads (greater 3M) as presentedForm in a DiagnosticReport to send it to our archive server (have to prepend as well, unfortunately I am not too familiar with FHIR at all).
My brute force method is to populate a HS.FHIR.DTL.vR4.Model.Resource.DiagnosticReport using a DTL, convert it to a DynamicObject, replace the presentedForm.data-Property with the large file stream, and write it out to a QuickStream:
ClassMethod GetQuickStreamFromDiagnosticReport(pDiagRep As HS.FHIR.DTL.vR4.Model.Resource.DiagnosticReport, pFile As%String) As%String
{
#dim tStreamInFile As%Stream.FileBinary
#dim tTempJSON As%Stream.Object
#dim tDynOb As%DynamicObject
#dim tQuickStream As HS.SDA3.QuickStream
Set tStreamInFile = ##class(%Stream.FileBinary).%New()
Do tStreamInFile.FilenameSet(pFile)
// convert: DiagnosticReport --> JSON --> DynamicObject
Set tTempJSON = pDiagRep.ToJSON()
Set tDynOb = ##class(%DynamicAbstractObject).%FromJSON(tTempJSON)
// replace presentedForm.(1).data-property by stream
Do tDynOb.%Get("presentedForm").%Get(0).%Set("data", tStreamInFile, "stream")
// serialize DynamicObject
Set tQuickStream = ##class(HS.SDA3.QuickStream).%New()
Do tDynOb.%ToJSON(tQuickStream)
Do tQuickStream.%Save()
Quit tQuickStream.%Id()
}It works, although it seems like a hack. Any hints how to improve would be highly appreciated...
Thanks!
- Log in to post comments