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

Add support for sending the JSON PATCH interaction to FhirClient #2664

Closed
ewoutkramer opened this issue Jan 11, 2024 Discussed in #2217 · 1 comment · Fixed by #2753
Closed

Add support for sending the JSON PATCH interaction to FhirClient #2664

ewoutkramer opened this issue Jan 11, 2024 Discussed in #2217 · 1 comment · Fixed by #2753
Assignees

Comments

@ewoutkramer
Copy link
Member

Discussed in #2217

Originally posted by timammons August 30, 2022
I am trying to patch a patient in the following way, but getting an error body: must be a list of patch operation requests. Any idea why?

Code:
`static void UpdatePatientName(FhirClient fireClient, string patientID)
{
var pat = fireClient.Read($"/Patient/{patientID}");
var eTag = fireClient.LastResult.Etag;

Parameters patParams = new Parameters();
patParams.AddReplacePatchParameter("name/0/given", new HumanName().WithGiven("Beulah").WithGiven("Z"));

fireClient.RequestHeaders.IfMatch.Add(new EntityTagHeaderValue($"\"{eTag}\"", true)); 
var updatedPat = fireClient.Patch<Patient>($"{patientID}", patParams);

}`

This is the body it created, which appears to be a list of patch operation requests:
{"resourceType":"Parameters","parameter":[{"name":"operation","part":[{"name":"type","valueCode":"replace"},{"name":"path","valueString":"name/0/given"},{"name":"value","valueHumanName":{"given":["Beulah","Z"]}}]}]}

Thanks,
Tim

@mmsmits
Copy link
Member

mmsmits commented Mar 28, 2024

Refinement:

  • First, add a custom Patch operation to the FhirClient, where users can define their own payload.
  • Maybe add some helper methods to make JsonPatch easier. Is there an existing library for that?
  • Test against a cerner sandbox (integration test). Or find out another server that supports this.
  • Also create a Moq test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants