Question
· Mar 8, 2022

Patient resource not added in FHIR repository.

Hi Team,

I got a 404 status code(fhirResponse.Status) in the below code while inserting patient resources. Other resources data are successfully inserted.

Class HS.FHIRServer.Interop.Operation Extends (Ens.BusinessOperation, HS.HC.Util.Trace.Helper)
{ Parameter SETTINGS As %String; XData MessageMap
{
<MapItems>
<MapItem MessageType="HS.FHIRServer.Interop.Request">
<Method>DispatchRequest</Method>
</MapItem>
</MapItems>
} Method DispatchRequest(pInteropRequest As HS.FHIRServer.Interop.Request, Output pInteropResponse As HS.FHIRServer.Interop.Response) As %Status
{
Set tSC = $$$OK Try {
// Get the FHIR Service
#dim fhirRequest As HS.FHIRServer.API.Data.Request = pInteropRequest.Request
Set key = $$$AppKeyFromApp(fhirRequest.SessionApplication)
$$$LOGWARNING(" key-> "_key)
// Instantiate the FHIR Service Implementation
#dim fhirService as HS.FHIRServer.API.Service = ##class(HS.FHIRServer.Service).EnsureInstance(key) $$$ThrowOnError(pInteropRequest.NewResponse(.pInteropResponse)) // For any incoming request payload, create a %DynamicObject and assign
// it to the Json property of the FHIR request object.
If pInteropRequest.QuickStreamId '= "" {
Set quickStreamIn = ##class(HS.SDA3.QuickStream).%OpenId(pInteropRequest.QuickStreamId, .tSC)
$$$ThrowOnError(tSC)
$$$HSTRACE("Request QuickStream", "quickStreamIn", quickStreamIn)
Set fhirRequest.Json = fhirService.StreamToJSON(quickStreamIn, fhirRequest.RequestFormatCode) } Do fhirService.DispatchRequest(fhirRequest, .fhirResponse)         $$$LOGWARNING("fhirResponse-> "_fhirResponse.Status)
If (($IsObject($Get(fhirResponse))) && ($IsObject(fhirResponse.Json))) {
$$$LOGWARNING(" $IsObject fhirResponse-> ")
// Emit the response object into a QuickStream in the requested format (so that it can just be
// copied when the RESTHandler receives it)
Set quickStreamOut = ##class(HS.SDA3.QuickStream).%New()
Set pInteropResponse.QuickStreamId = quickStreamOut.%Id()
Do ##class(HS.FHIRServer.RestHandler).WriteServiceResponse(fhirResponse , fhirService, quickStreamOut, .pInteropResponse)
Do quickStreamOut.Rewind()
$$$HSTRACE("Response QuickStream", "quickStreamOut", quickStreamOut)
}
Set pInteropResponse.Response = fhirResponse
$$$LOGWARNING(" pInteropResponse.Response-> "_pInteropResponse.Response.Id) Catch eException {
Set tSC = eException.AsStatus()
If $$$HSTRACING {
If (($IsObject($Get(quickStreamIn))) && (quickStreamIn.%Extends("%Stream.Object"))) {
Do quickStreamIn.Rewind()
$$$HSTRACEERROR("Request QuickStream", "quickStreamIn", quickStreamIn)
}
If (($IsObject($Get(quickStreamOut))) && (quickStreamOut.%Extends("%Stream.Object"))) {
Do quickStreamOut.Rewind()
$$$HSTRACEERROR("Response QuickStream", "quickStreamOut", quickStreamOut)
}
}
} Quit tSC
} }
 

Product version: IRIS 2022.1
Discussion (3)0
Log in or sign up to continue

Hi Paul,

I am using below patient resource.

As I mentioned got fhirResponse.Status=404 in below log.

Do fhirService.DispatchRequest(fhirRequest, .fhirResponse)         $$$LOGWARNING("fhirResponse-> "_fhirResponse.Status)

{
  "resourceType""Patient",
  "id""112",
  "text": {
    "status""generated",
    "div""<div xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t<table>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Name</td>\n\t\t\t\t\t\t<td>Peter James \n              <b>Chalmers</b> (&quot;Jim&quot;)\n            </td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Address</td>\n\t\t\t\t\t\t<td>534 Erewhon, Pleasantville, Vic, 3999</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Contacts</td>\n\t\t\t\t\t\t<td>Home: unknown. Work: (03) 5555 6473</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Id</td>\n\t\t\t\t\t\t<td>MRN: 12345 (Acme Healthcare)</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>"
  },
  "identifier": [
    {
      "use""usual",
      "type": {
        "coding": [
          {
            "system""http://terminology.hl7.org/CodeSystem/v2-0203",
            "code""MR"
          }
        ]
      },
      "system""urn:oid:1.2.36.146.595.217.0.1",
      "value""12345",
      "period": {
        "start""2001-05-06"
      },
      "assigner": {
        "display""Acme Healthcare"
      }
    }
  ],
  "active"true,
  "name": [
    {
      "use""official",
      "family""Chalmers",
      "given": [
        "Peter",
        "James"
      ]
    },
    {
      "use""usual",
      "given": [
        "Jim"
      ]
    },
    {
      "use""maiden",
      "family""Windsor",
      "given": [
        "Peter",
        "James"
      ],
      "period": {
        "end""2002"
      }
    }
  ],
  "telecom": [
    {
      "use""home"
    },
    {
      "system""phone",
      "value""(03) 5555 6473",
      "use""work",
      "rank"1
    },
    {
      "system""phone",
      "value""(03) 3410 5613",
      "use""mobile",
      "rank"2
    },
    {
      "system""phone",
      "value""(03) 5555 8834",
      "use""old",
      "period": {
        "end""2014"
      }
    }
  ],
  "gender""male",
  "birthDate""1974-12-25",
  "_birthDate": {
    "extension": [
      {
        "valueDateTime""1974-12-25T14:35:45-05:00"
      }
    ]
  },
  "deceasedBoolean"false,
  "address": [
    {
      "use""home",
      "type""both",
      "text""534 Erewhon St PeasantVille, Rainbow, Vic  3999",
      "line": [
        "534 Erewhon St"
      ],
      "city""PleasantVille",
      "district""Rainbow",
      "state""Vic",
      "postalCode""3999",
      "period": {
        "start""1974-12-25"
      }
    }
  ],
  "contact": [
    {
      "relationship": [
        {
          "coding": [
            {
              "system""http://terminology.hl7.org/CodeSystem/v2-0131",
              "code""N"
            }
          ]
        }
      ],
      "name": {
        "family""du Marché",
        "_family": {
          "extension": [
            {
              "valueString""VV"
            }
          ]
        },
        "given": [
          "Bénédicte"
        ]
      },
      "telecom": [
        {
          "system""phone",
          "value""+33 (237) 998327"
        }
      ],
      "address": {
        "use""home",
        "type""both",
        "line": [
          "534 Erewhon St"
        ],
        "city""PleasantVille",
        "district""Rainbow",
        "state""Vic",
        "postalCode""3999",
        "period": {
          "start""1974-12-25"
        }
      },
      "gender""female",
      "period": {
        "start""2012"
      }
    }
  ],
  "managingOrganization": {
    "reference""Organization/1"
  }
}