go to post Andreas Beck · Sep 12, 2023 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!
go to post Andreas Beck · Apr 14, 2023 Hi all, I am facing actually a similar issue, any hint would be highly appreciated: I developed an operation that downloads a document (from a REST Service as well) and stores it to a local folder on the server. If saving locally fails, e.g. due to insufficient file permissions, the .stream-files do remain in the stream-folder for the namespace. Before using the Save-Method in %FileBinaryStream, the payload is copied from HttpResponse.Data (CopyFrom). I purged the trigger-messages for the operation as well, but without an effect. Can I simply delete those .stream-files? Maybe they were created temporarily before trying to copy them into the mentioned directory, or as a backup? Is there any way how to check if they are related to any database objects? Thanks!