Question
· Feb 20

MAXSTRING error on conversion to JSON in FHIR R4 DTL

I'm working on FHIR project and using this code to convert an incoming request to FHIR 

Method OnRequest(request As HS.FHIRServer.Interop.Request, Output response As HS.FHIRServer.Interop.Response) As %Status

{

    #dim tSC As %Status = $$$OK

    Try {

        // Process incoming request

       

        set stream = ##class(HS.SDA3.QuickStream).%OpenId(request.QuickStreamId)

        set bundle = ##class(HS.FHIR.DTL.vR4.Model.Resource.Bundle).FromJSON(stream,"vR4")

 



It's working ok but when I include a realistic PDF in a FHIR Binary resource (contained in the Bundle) I get a MAXSTRING error. 

Looking at the documentation for HS.FHIR.DTL.vR4.Model.Resource.Binary, I wondering if MAXLEN setting for data is missing and data MAXLEN = 50. 
 

Property contentType As %String(MAXLEN = 1000000, XMLNAME = "contentType", XMLPROJECTION = "ATTRIBUTE") [ Required ];

Property data As %Binary(XMLNAME = "data", XMLPROJECTION = "ATTRIBUTE");


 

Product version: HealthShare 2024.1
$ZV: IRIS for Windows (x86-64) 2024.1.3 (Build 456U) Thu Jan 9 2025 12:47:03 EST
Discussion (4)1
Log in or sign up to continue

Error 

ERROR <Ens>ErrBPTerminated: Terminating BP ProcessMessage # due to error: ERROR #5002: ObjectScript error: <MAXSTRING>%GetNext+12^%Iterator.Object.1
> ERROR #5002: ObjectScript error: <MAXSTRING>%GetNext+12^%Iterator.Object.1

Stack 

  • ^%GetNext+12^%Iterator.Object.1^1
  • e^FromJSONHelper+17^HS.FHIR.DTL.Util.JSON.Adapter.1^1
  • e^FromJSONHelper+98^HS.FHIR.DTL.Util.JSON.Adapter.1^1
  • e^FromJSONHelper+80^HS.FHIR.DTL.Util.JSON.Adapter.1^1
  • e^FromJSON+9^HS.FHIR.DTL.Util.JSON.Adapter.1^1
  • e^OnRequest+5^RIE.GLH.FHIR.Process.ProcessMessage.1^1
  • e^MessageHeaderHandler+19^RIE.GLH.FHIR.Process.ProcessMessage.1^1
  • e^MessageHeaderHandler+110^Ens.Actor.1^1  

Hello @Kevin Mayfield 

%GetNext retrieves values from the JSON object/array and assigns them to a local variable. However, the BLOB/streams exceed the maximum local length (3641144), MAXLEN doesn't cause the issue because it's a registered object, and the values are currently stored in memory. Therefore, AFAIK FromJSON is not suitable for handling such a large dataset.