go to post Saju Abraham · Dec 12 Hello Marc, Do you have any other suggestions that will support both the JSON structures to work?
go to post Saju Abraham · Dec 11 Hello Marc, I am getting the following errors in the BPL log viewer: ERROR <Ens>ErrBPTerminated: Terminating BP DCIQ GetPatient Handler # due to error: ERROR #5003: Not implemented > ERROR #5003: Not implementedError in the Json/HL7 conversion/transformation block. Code changed per suggestion: /// Given a patient number in a JSON string format, this includes required transformations and makes use of /// the MPI Query Handler to pull basic demographics from Epic. Class CUH.Proc.DCIQGetPatient Extends Ens.BusinessProcessBPL [ ClassType = persistent, ProcedureBlock ]{ Storage Default{<Type>%Storage.Persistent</Type>} /// BPL DefinitionXData BPL [ XMLNamespace = "http://www.intersystems.com/bpl" ]{<process language='objectscript' request='CUH.Mess.DCIQ.JsonIn' response='CUH.Mess.DCIQ.JsonOut' height='3400' width='2000' ><context><property name='JsonObjectIn' type='CUH.Mess.DCIQ.JsonInObj' instantiate='1' /><property name='HL7QRY' type='EnsLib.HL7.Message' instantiate='0' /><property name='HL7ADR' type='EnsLib.HL7.Message' instantiate='0' /><property name='JsonObjectOut' type='CUH.Mess.DCIQ.JsonOutObj' instantiate='1' /><property name='RequestNumber' type='%String' initialexpression='""' instantiate='0' ><parameters><parameter name='MAXLEN' value='50' /></parameters></property><property name='IsInteger' type='%Boolean' instantiate='0' /><property name='ProcError' type='%String' initialexpression='""' instantiate='0' ><annotation><![CDATA[Error message to be sent back in the Response.]]></annotation><parameters><parameter name='MAXLEN' value='50' /></parameters></property><property name='ValidOriginUrl' type='%String' instantiate='0' ><parameters><parameter name='MAXLEN' value='100' /></parameters></property><property name='ValidContactType' type='%String' instantiate='0' ><parameters><parameter name='MAXLEN' value='50' /></parameters></property><property name='ValidIDNumberType' type='%String' initialexpression='""' instantiate='0' ><parameters><parameter name='MAXLEN' value='50' /></parameters></property><property name='ValidNHSCodeType' type='%String' initialexpression='""' instantiate='0' ><parameters><parameter name='MAXLEN' value='50' /></parameters></property></context><sequence xend='200' yend='3500' ><scope xpos='200' ypos='250' xend='200' yend='2850' ><annotation><![CDATA[Handles all errors]]></annotation><code name='Initialize JSON request' xpos='200' ypos='350' ><![CDATA[ set context.JsonObjectIn = ##class(CUH.Mess.DCIQ.JsonInObj).%New() do context.JsonObjectIn.%JSONImport(request.bodyJson)]]></code><if name='Is "data" an array?' condition='context.JsonObjectIn.data.%IsA("%DynamicArray")' xpos='200' ypos='450' xend='200' yend='700' ><true><assign name="Make "data" a %DynamicObject" property="context.JsonObjectIn.data" value="context.JsonObjectIn.data.%Pop()" action="set" xpos='335' ypos='600' /></true></if><assign name="Valid URL" property="context.ValidOriginUrl" value="##class(Ens.Util.FunctionSet).Lookup("CUH.DCIQToEpic.OriginUrl",$NAMESPACE,"",3)" action="set" languageOverride="" xpos='200' ypos='800' ><annotation><![CDATA[Environment specific]]></annotation></assign><assign name="Valid ContactType" property="context.ValidContactType" value="##class(Ens.Util.FunctionSet).Lookup("CUH.DCIQToEpic.ContactType",$NAMESPACE,"",3)" action="set" languageOverride="" xpos='200' ypos='900' ><annotation><![CDATA[Environment specific]]></annotation></assign><assign name="Valid IDNumberType" property="context.ValidIDNumberType" value="##class(Ens.Util.FunctionSet).Lookup("CUH.DCIQToEpic.IDNumberType",$NAMESPACE,"",3)" action="set" languageOverride="" xpos='200' ypos='1000' ><annotation><![CDATA[Environment specific]]></annotation></assign><assign name="Valid NHSCodeType" property="context.ValidNHSCodeType" value="##class(Ens.Util.FunctionSet).Lookup("CUH.DCIQToEpic.NHSCodeType",$NAMESPACE,"",3)" action="set" languageOverride="" xpos='200' ypos='1100' ><annotation><![CDATA[Environment specific]]></annotation></assign><if name='Check OriginUrl' condition='context.JsonObjectIn.meta."origin_url"=context.ValidOriginUrl' xpos='200' ypos='1200' xend='200' yend='2600' ><true><if name='Check Contact Type' condition='(context.JsonObjectIn.data."0"."con_type"=context.ValidContactType)||(context.JsonObjectIn.data."con_type"=context.ValidContactType)' xpos='470' ypos='1350' xend='470' yend='2500' ><true><if name='Check idNumber Type' condition='(context.JsonObjectIn.data.idNumbers.GetAt(1).type)=context.ValidIDNumberType' xpos='740' ypos='1500' xend='740' yend='2400' ><true><assign name="Get Request Number" property="context.RequestNumber" value="context.JsonObjectIn.data.idNumbers.GetAt(1).number" action="set" languageOverride="" xpos='1010' ypos='1650' /><code name='Integer pattern' xpos='1010' ypos='1750' ><![CDATA[ set context.IsInteger = ((context.RequestNumber)?.N)]]></code><if name='Integer?' condition='context.IsInteger' xpos='1010' ypos='1850' xend='1010' yend='2300' ><annotation><![CDATA[Checks if Requested Number sent is an Integer]]></annotation><true><transform name='Create HL7 query' class='CUH.Tran.GetDCIQJsonPatientToEpicQRYQ011' source='context.JsonObjectIn' target='context.HL7QRY' xpos='1280' ypos='2000' /><call name='Send to MPIQueryHandler' target='MPI Query Handler' async='0' xpos='1280' ypos='2100' ><request type='EnsLib.HL7.Message' ><assign property="callrequest" value="context.HL7QRY" action="set" languageOverride="" /></request><response type='EnsLib.HL7.Message' ><assign property="context.HL7ADR" value="callresponse" action="set" languageOverride="" /></response></call><transform name='Converts HL7 to JSON' class='CUH.Tran.EpicADRA19ToDCIQJsonPatient' source='context.HL7ADR' target='context.JsonObjectOut' xpos='1280' ypos='2200' /></true><false><assign name="Error No Number" property="context.ProcError" value=""MRN needs to be a positive numeric value"" action="set" languageOverride="" xpos='1010' ypos='2000' /></false></if></true><false><assign name="Error idNumber Type" property="context.ProcError" value=""Invalid idNumber Type"" action="set" languageOverride="" xpos='740' ypos='1650' /></false></if></true><false><assign name="Error Contact Type" property="context.ProcError" value=""Invalid Patient Contact Type"" action="set" languageOverride="" xpos='470' ypos='1500' /></false></if></true><false><assign name="Error Origin Url" property="context.ProcError" value=""Origin URL not authorized!"" action="set" languageOverride="" xpos='200' ypos='1350' /></false></if><faulthandlers><catchall xpos='200' ypos='2700' xend='200' yend='350' ><assign property="context.ProcError" value=""Error in the Json/HL7 conversion/transformation block"" action="set" languageOverride="" xpos='200' ypos='250' /></catchall></faulthandlers></scope><assign name="Assign Error to Response" property="context.JsonObjectOut.errors" value="context.ProcError" action="set" languageOverride="" xpos='200' ypos='2950' /><if condition='context.JsonObjectOut.errors'=""' xpos='200' ypos='3050' xend='200' yend='3400' ><annotation><![CDATA[Check if any errors]]></annotation><true><trace name='Log the Error' value='context.JsonObjectOut.errors' xpos='470' ypos='3200' /><assign name="Returns {}" property="response.bodyJson" value=""{}"" action="set" languageOverride="" xpos='470' ypos='3300' /></true><false><code name='Returns Valid Response' xpos='200' ypos='3200' ><![CDATA[ set temp = ##class(CUH.Mess.DCIQ.JsonOut).%New() do context.JsonObjectOut.%JSONExportToString(.temp) set response.bodyJson = temp]]></code></false></if></sequence></process>} }
go to post Saju Abraham · Dec 5 Hello Marc, Where exactly do you want me to add these statements? Here is the current BPL definition: /// Given a patient number in a JSON string format, this includes required transformations and makes use of /// the MPI Query Handler to pull basic demographics from Epic. Class CUH.Proc.DCIQGetPatient Extends Ens.BusinessProcessBPL [ ClassType = persistent, ProcedureBlock ]{ Storage Default{<Type>%Storage.Persistent</Type>} /// BPL DefinitionXData BPL [ XMLNamespace = "http://www.intersystems.com/bpl" ]{<process language='objectscript' request='CUH.Mess.DCIQ.JsonIn' response='CUH.Mess.DCIQ.JsonOut' height='3400' width='2000' ><context><property name='JsonObjectIn' type='CUH.Mess.DCIQ.JsonInObj' instantiate='1' /><property name='HL7QRY' type='EnsLib.HL7.Message' instantiate='0' /><property name='HL7ADR' type='EnsLib.HL7.Message' instantiate='0' /><property name='JsonObjectOut' type='CUH.Mess.DCIQ.JsonOutObj' instantiate='1' /><property name='RequestNumber' type='%String' initialexpression='""' instantiate='0' ><parameters><parameter name='MAXLEN' value='50' /></parameters></property><property name='IsInteger' type='%Boolean' instantiate='0' /><property name='ProcError' type='%String' initialexpression='""' instantiate='0' ><annotation><![CDATA[Error message to be sent back in the Response.]]></annotation><parameters><parameter name='MAXLEN' value='50' /></parameters></property><property name='ValidOriginUrl' type='%String' instantiate='0' ><parameters><parameter name='MAXLEN' value='100' /></parameters></property><property name='ValidContactType' type='%String' instantiate='0' ><parameters><parameter name='MAXLEN' value='50' /></parameters></property><property name='ValidIDNumberType' type='%String' initialexpression='""' instantiate='0' ><parameters><parameter name='MAXLEN' value='50' /></parameters></property><property name='ValidNHSCodeType' type='%String' initialexpression='""' instantiate='0' ><parameters><parameter name='MAXLEN' value='50' /></parameters></property></context><sequence xend='200' yend='3150' ><scope xpos='200' ypos='250' xend='200' yend='2500' ><annotation><![CDATA[Handles all errors]]></annotation><code name='Initialize JSON request' xpos='200' ypos='350' ><![CDATA[ set context.JsonObjectIn = ##class(CUH.Mess.DCIQ.JsonInObj).%New() do context.JsonObjectIn.%JSONImport(request.bodyJson)]]></code><assign name="Valid URL" property="context.ValidOriginUrl" value="##class(Ens.Util.FunctionSet).Lookup("CUH.DCIQToEpic.OriginUrl",$NAMESPACE,"",3)" action="set" xpos='200' ypos='450' ><annotation><![CDATA[Environment specific]]></annotation></assign><assign name="Valid ContactType" property="context.ValidContactType" value="##class(Ens.Util.FunctionSet).Lookup("CUH.DCIQToEpic.ContactType",$NAMESPACE,"",3)" action="set" xpos='200' ypos='550' ><annotation><![CDATA[Environment specific]]></annotation></assign><assign name="Valid IDNumberType" property="context.ValidIDNumberType" value="##class(Ens.Util.FunctionSet).Lookup("CUH.DCIQToEpic.IDNumberType",$NAMESPACE,"",3)" action="set" xpos='200' ypos='650' ><annotation><![CDATA[Environment specific]]></annotation></assign><assign name="Valid NHSCodeType" property="context.ValidNHSCodeType" value="##class(Ens.Util.FunctionSet).Lookup("CUH.DCIQToEpic.NHSCodeType",$NAMESPACE,"",3)" action="set" xpos='200' ypos='750' ><annotation><![CDATA[Environment specific]]></annotation></assign><if name='Check OriginUrl' condition='context.JsonObjectIn.meta."origin_url"=context.ValidOriginUrl' xpos='200' ypos='850' xend='200' yend='2250' ><true><if name='Check Contact Type' condition='(context.JsonObjectIn.data."0"."con_type"=context.ValidContactType)||(context.JsonObjectIn.data."con_type"=context.ValidContactType)' xpos='470' ypos='1000' xend='470' yend='2150' ><true><if name='Check idNumber Type' condition='(context.JsonObjectIn.data.idNumbers.GetAt(1).type)=context.ValidIDNumberType' xpos='740' ypos='1150' xend='740' yend='2050' ><true><assign name="Get Request Number" property="context.RequestNumber" value="context.JsonObjectIn.data.idNumbers.GetAt(1).number" action="set" xpos='1010' ypos='1300' /><code name='Integer pattern' xpos='1010' ypos='1400' ><![CDATA[ set context.IsInteger = ((context.RequestNumber)?.N)]]></code><if name='Integer?' condition='context.IsInteger' xpos='1010' ypos='1500' xend='1010' yend='1950' ><annotation><![CDATA[Checks if Requested Number sent is an Integer]]></annotation><true><transform name='Create HL7 query' class='CUH.Tran.GetDCIQJsonPatientToEpicQRYQ011' source='context.JsonObjectIn' target='context.HL7QRY' xpos='1280' ypos='1650' /><call name='Send to MPIQueryHandler' target='MPI Query Handler' async='0' xpos='1280' ypos='1750' ><request type='EnsLib.HL7.Message' ><assign property="callrequest" value="context.HL7QRY" action="set" /></request><response type='EnsLib.HL7.Message' ><assign property="context.HL7ADR" value="callresponse" action="set" /></response></call><transform name='Converts HL7 to JSON' class='CUH.Tran.EpicADRA19ToDCIQJsonPatient' source='context.HL7ADR' target='context.JsonObjectOut' xpos='1280' ypos='1850' /></true><false><assign name="Error No Number" property="context.ProcError" value=""MRN needs to be a positive numeric value"" action="set" xpos='1010' ypos='1650' /></false></if></true><false><assign name="Error idNumber Type" property="context.ProcError" value=""Invalid idNumber Type"" action="set" xpos='740' ypos='1300' /></false></if></true><false><assign name="Error Contact Type" property="context.ProcError" value=""Invalid Patient Contact Type"" action="set" xpos='470' ypos='1150' /></false></if></true><false><assign name="Error Origin Url" property="context.ProcError" value=""Origin URL not authorized!"" action="set" xpos='200' ypos='1000' /></false></if><faulthandlers><catchall xpos='200' ypos='2350' xend='200' yend='350' ><assign property="context.ProcError" value=""Error in the Json/HL7 conversion/transformation block"" action="set" xpos='200' ypos='250' /></catchall></faulthandlers></scope><assign name="Assign Error to Response" property="context.JsonObjectOut.errors" value="context.ProcError" action="set" xpos='200' ypos='2600' /><if condition='context.JsonObjectOut.errors'=""' xpos='200' ypos='2700' xend='200' yend='3050' ><annotation><![CDATA[Check if any errors]]></annotation><true><trace name='Log the Error' value='context.JsonObjectOut.errors' xpos='470' ypos='2850' /><assign name="Returns {}" property="response.bodyJson" value=""{}"" action="set" xpos='470' ypos='2950' /></true><false><code name='Returns Valid Response' xpos='200' ypos='2850' ><![CDATA[ set temp = ##class(CUH.Mess.DCIQ.JsonOut).%New() do context.JsonObjectOut.%JSONExportToString(.temp) set response.bodyJson = temp]]></code></false></if></sequence></process>} }