Motivation
The DSF FHIR server currently supports create, read, vread, update, delete, search and history, but not the FHIR PATCH interaction. Clients that only want to modify part of a resource have to read the full resource, change it locally and send a complete update. This is unnecessarily verbose, is prone to lost-update problems in concurrent scenarios, and prevents callers (e.g. BPE
process plugins) from expressing a targeted change such as "set this Task's status" without transferring the whole resource.
PATCH is part of the FHIR RESTful API (https://www.hl7.org/fhir/http.html#patch) and is currently reported as not supported in the server's CapabilityStatement.
Proposed solution
Add support for the FHIR PATCH interaction using the FHIRPath Patch format (a Parameters resource, https://www.hl7.org/fhir/R4/fhirpatch.html):
- Direct REST:
PATCH [type]/[id]
- conditional
PATCH [type]?[search criteria]
- Inside transaction and batch bundles (
Bundle.entry.request.method = PATCH)
A patch is applied to a copy of the current resource and then written through the existing update code path, so authorization, validation, optimistic locking (If-Match), versioning and the Prefer header behave exactly as for an update. PATCH maps to the existing UPDATE role — no new permission is required.
Advertise patch as a supported interaction in the CapabilityStatement.
Scope
In scope
- FHIRPath Patch format (
Parameters with operation parameters: add / insert / delete / replace / move)
- REST (standard + conditional) and bundle (transaction + batch)
FhirWebserviceClient support: patch(...) / patchConditionaly(...)
- Unit tests for the patch engine, integration tests for the interaction
Out of scope (for now)
- JSON Patch (
application/json-patch+json) and XML Patch (application/xml-patch+xml) — intentionally omitted to avoid pulling in hapi-fhir-storage (JPA/Hibernate/Quartz) and keep the dependency footprint minimal. FHIRPath Patch is also the FHIR-recommended format for FHIR resources. Can be added later if a concrete need arises.
- Resolving temporary (
urn:uuid:) references contained inside patch values when processed within a bundle.
Acceptance criteria
Motivation
The DSF FHIR server currently supports create, read, vread, update, delete, search and history, but not the FHIR PATCH interaction. Clients that only want to modify part of a resource have to read the full resource, change it locally and send a complete update. This is unnecessarily verbose, is prone to lost-update problems in concurrent scenarios, and prevents callers (e.g. BPE
process plugins) from expressing a targeted change such as "set this Task's status" without transferring the whole resource.
PATCH is part of the FHIR RESTful API (https://www.hl7.org/fhir/http.html#patch) and is currently reported as not supported in the server's CapabilityStatement.
Proposed solution
Add support for the FHIR PATCH interaction using the FHIRPath Patch format (a
Parametersresource, https://www.hl7.org/fhir/R4/fhirpatch.html):PATCH [type]/[id]PATCH [type]?[search criteria]Bundle.entry.request.method = PATCH)A patch is applied to a copy of the current resource and then written through the existing update code path, so authorization, validation, optimistic locking (
If-Match), versioning and thePreferheader behave exactly as for an update. PATCH maps to the existingUPDATErole — no new permission is required.Advertise
patchas a supportedinteractionin the CapabilityStatement.Scope
In scope
Parameterswithoperationparameters: add / insert / delete / replace / move)FhirWebserviceClientsupport:patch(...)/patchConditionaly(...)Out of scope (for now)
application/json-patch+json) and XML Patch (application/xml-patch+xml) — intentionally omitted to avoid pulling inhapi-fhir-storage(JPA/Hibernate/Quartz) and keep the dependency footprint minimal. FHIRPath Patch is also the FHIR-recommended format for FHIR resources. Can be added later if a concrete need arises.urn:uuid:) references contained inside patch values when processed within a bundle.Acceptance criteria
PATCH [type]/[id]with a FHIRPathParametersbody updates the addressed resource and returns the result according to thePreferheader; a new version is created.PATCH [type]?[criteria]patches the single match, returns404on no match and412on multiple matches.reasonUpdateAllowed(old, patched));If-Matchis honored.400with anOperationOutcome; a patch to a non-existing resource returns404.patchinteraction for the supported resource types.