Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with PATCH operation using .NET Firely SDK for EPIC FHIR Integration #2738

Closed
fayazshaik07 opened this issue Mar 19, 2024 · 3 comments

Comments

@fayazshaik07
Copy link

fayazshaik07 commented Mar 19, 2024

I'm integrating EPIC FHIR into our C# application using the .NET Firely SDK. I've successfully created a patient using the provided resources, but I'm encountering an issue with the PATCH operation. I'm strictly following the .net firely sdk documentation for doing the same. https://docs.fire.ly/projects/Firely-NET-SDK/en/latest/client/crud.html#patching-resources

I'm attempting to update a patient's birth date using the following payload:

var patch = new Parameters(); patch.Parameter.Add(new Parameters.ParameterComponent() { Name = "OPERATION", Part = new List<Parameters.ParameterComponent>() { new Parameters.ParameterComponent() { Name = "type", Value = new FhirString("replace") }, new Parameters.ParameterComponent() { Name = "path", Value = new FhirString("Patient.BirthDate") }, new Parameters.ParameterComponent() { Name = "value", Value = new FhirString("2003-02-12") } } }); var r = await _fhirClient.PatchAsync<Patient>(url, patch);

However, this PATCH operation is failing with an InternalServerError. The OperationOutcome returned contains the message "There was an error processing your request."

Error :
Hl7.Fhir.Rest.FhirOperationException
HResult=0x80131500
Message=Operation was unsuccessful, and returned status InternalServerError. OperationOutcome: Overall result: FAILURE (1 errors and 0 warnings)
[ERROR] (no details)(further diagnostics: There was an error processing your request.)

I've verified the request payload, the URL, and the permissions. Could someone please advise on how to troubleshoot or resolve this issue?
Cc @mbaltus

@ewoutkramer
Copy link
Member

The error indicates that the Epic server is returning a 5xx error - so an internal error on the server side. Does Epic implement PATCH?

@fayazshaik07
Copy link
Author

@ewoutkramer I particularly didn't find any patch APIs on EPIC sandbox.
Firely client has provided the patch extension method, so I expected it to work.
Could you please verify if there is any issue with the payload or do I need to add any headers?
Cc @mbaltus

@mbaltus
Copy link
Member

mbaltus commented Mar 20, 2024

Epic's FHIR interface does not support patch, so even when you've corrected your code, it will not work on the Epic sandbox. They have very limited FHIR capabilities, which you can find in their documentation: https://fhir.epic.com. Note that if your desired functionality is not listed there, you will get 5xx responses even if your call is a valid FHIR call.

Now, looking at your code, there are two small issues with how you have filled in your Parameters resource. In FHIR, casing matters. The name of your first parameter should be "operation" - note the lowercase. And the path for your field should be "Patient.birthDate" following the casing of the field as specified in the FHIR specification (see http://hl7.org/fhir/R4/patient.html) instead of the casing used in the .Net SDK.
When you change both you will have a valid call, which you can verify by using 'https://server.fire.ly' as your FHIR server. But as said, unfortunately Epic does not support patch, so it will not work there.

@mbaltus mbaltus closed this as completed Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants