I am trying to centralize our FHIR queries into a single BP object that would send the FHIR query to the EMR, interpret the response into a %Persistent structure that could be sent back to the requestor. In theory it seemed like it would work but I am running into an issue..
"Warning on Message body 5@osuwmc.Epic.FHIR.DataStructures.PatientSearch.Record'
/ 229 because Status 'ERROR <Ens>ErrException: <PROPERTY DOES NOT EXIST>Transform+3 ^osuwmc.Scott.FHIR.DemoOutboundHL7Message.1 *DocType,osuwmc.Epic.FHIR.DataStructures.PatientSearch.Record -- logged as '-'
number - @' Set:""=source.DocType tBlankSrc=1, source.DocType="ORMORUPDF:MDM_T02"''
matched ReplyCodeAction 1 : 'E=W'
resulting in Action code W"
When I interpret the FHIR Response into a %Persistent structure, I get the error above. Am I missing something? I do not reference the DocType anywhere in my Transformation...
Class osuwmc.Epic.FHIR.DTL.FHIRResponseToPatient Extends Ens.DataTransform
{
ClassMethod Transform(source As HS.FHIRServer.Interop.Response, target As osuwmc.Epic.FHIR.DataStructures.PatientSearch.Record) As %Status
{
Set tSC=$$$OK
set tQuickStream = ##Class(HS.SDA3.QuickStream).%OpenId(source.QuickStreamId)
set tRawJSON = ##Class(%Library.DynamicObject).%FromJSON(tQuickStream)
$$$TRACE(tRawJSON.%ToJSON())
set tResource = tRawJSON.entry.%Get(0).resource
$$$LOGINFO("Resource Type: "_tResource.resourceType)
if tResource.resourceType '= "Patient" {
set tSC = $$$ERROR($$$GeneralError, "FHIRResponseToPatient: Resource type is not Patient")
return tSC
}
else{
set target = ##class(osuwmc.Epic.FHIR.DataStructures.PatientSearch.Record).%New()
set mrnIter = tResource.identifier.%GetIterator()
while mrnIter.%GetNext(,.identifier) {
if identifier.system = "urn:oid:1.2.840.114350.1.13.172.2.7.5.737384.100" {
set target.MRN = identifier.value
}
}
set NameIter = tResource.name.%GetIterator()
while NameIter.%GetNext(,.humanName) {
if humanName.use = "official" {
set target.lastname = humanName.family
set target.firstname = humanName.given.%Get(0)
}
set target.birthdate = tResource.birthDate
set target.gender = tResource.gender
}
set addrIter = tResource.address.%GetIterator()
while addrIter.%GetNext(,.address) {
if address.use = "home" {
set target.address = address.line.%Get(0)
set target.city = address.city
set target.state = address.state
set target.postalcode = address.postalCode
}
}
}
$$$LOGINFO(target.MRN_" "_target.lastname_" "_target.firstname_" "_target.birthdate_" "_target.gender_" "_target.address_" "_target.city_" "_target.state_" "_target.postalcode)
return tSC
}
}
Maybe it's because I use osuwmc.Epic.FHIR.DataStructures.PatientSearch.Record for the request to get generated, and for me to send the response back to the requestor? Should I be using a different %Persistent class, so the system does not get confused?