Question
· Nov 17, 2016

Duplicate Patients in FHIR Repository

Hoping someone can help,

I have the "Sample FHIR Production" installed ( as described in the documentation) with the following Components:

Service: HS.Gateway.ECR.SDA3XMLFileService

Processes: HS.FHIR.FromSDA.DTL.Transaction.Process

Operations: HS.FHIR.Repository.Operations

When a patient's data gets updated in my application a new SDA3 message is generated and processed by the FromSDA DTL. The Repository Stores that data as a New patient ( i.e. when I query the Repo they have different IDs "resource":{ "resourceType":"Patient", "id":"4", ) . How do I get the record in the Repository to update rather than store as a new Patient record?

Do I have to create a BPL which specifies that I want to do an "update" rather than a "create" ?

Perhaps it's just some field that I need to populate in my SDA3 ?

Any suggestions or code samples would be most helpful.

Thanks

Conor

Discussion (5)1
Log in or sign up to continue

I think you stand a better chance of getting responses to this if you move it to the HealthShare group and tag it with a HealthShare-related tag. The "Developer Community" tag and the "Developer Community Feedback" group are intended for posts/questions about the DC forum itself, not the InterSystems products. Posts tagged/classified like that don't appear on people's general new feed, AFAIK.

Hi Conor,

There is no support for resource matching or for FHIR conditional update in the product at this time.  The SDA to FHIR transform functionality will always generate new resource ids for all the FHIR resources that it generates.

There is no way to achieve what you're looking for in the current product, aside from developing a custom business operation to manipulate the FHIR Bundle to implement your own resource matching before passing it on to HS.FHIR.Repository.Operations.  That would be a rather complex undertaking though.

Regards,

Paul Lomayesva

Developer

InterSystems Corporation

This is a really old post, but I think it is something that developers might be struggling with if they need to create a repository based on another FHIR source.  Making a new ID every time doesn't work in this kind of use case.

I use the PUT method instead of POST.  I use it by default because it maintains the ID from the source system, and will update a record if the ID exists.  I set the ID into  the url: /csp/healthshare/fhirserver/fhir/r4/Patient/ID because it doesn't seem to work without it.

Here's an example.  The error handling still needs work, but you get the idea:

ClassMethod savePatientObj(patient As %DynamicObject) As %String {
// Get the record ID
   s ID=patient.id s url="/csp/healthshare/fhirserver/fhir/r4" s path="/Patient/"_ID
   try { s clientObj=##class(HS.FHIRServer.RestClient.FHIRService).CreateInstance(url)
   d clientObj.SetResponseFormat("JSON"),clientObj.SetRequestFormat("JSON")
   s clientRequestObj=clientObj.MakeRequest("PUT",patient,path,"")
   s clientResponseObj=clientObj.InvokeRequest(clientRequestObj)
   s response=clientResponseObj.Json }
   catch err {
      w !, "Error name: ", ?20, err.Name, !,
      "Error code: ", ?20, err.Code, !,
      "Error location: ", ?20, err.Location, !,
      "Additional data: ", ?20, err.Data,!
      zw err }
   Return response
}

Please hit me back if you want to work on this more.