关于FHIR中历史条目回溯更新替代机制的技术问询
Great question! You're right that using PUT encounter/{id}/_history/{vid} to modify specific historical entries isn't allowed per FHIR's HTTP rules—only metadata (primarily for access control) can be adjusted on past versions, as stated:
因此,无法更新或删除记录的过往版本,仅可修改元数据(主要用于访问控制目的)
That said, there are several FHIR-compliant approaches to achieve your goal of retroactive correction while preserving the integrity of the immutable history trail:
Create a new resource version with explicit correction tagging
This is the FHIR-recommended standard approach. Instead of altering old versions, publish a new version of the resource and use metadata to flag it as a correction targeting a specific historical version. For example, add a tag to theMetasection of the new resource:PUT encounter/{id}In the request body:
{ "resourceType": "Encounter", "id": "{id}", "meta": { "tag": [ { "system": "http://your-organization.com/codes/correction-types", "code": "retroactive-fix", "display": "Retroactive correction of historical version vid=3" } ] }, // Updated resource content here }You can also include additional context in a text field or custom extension explaining what was corrected and why.
Track corrections with a Provenance resource
For full auditability, create aProvenanceresource that links the historical version being corrected, the new updated version, and details about who made the change, when, and the reason. This maintains a clear trail of modifications while leaving the original historical entries untouched.Implement custom extensions for correction context
If you need more structured tracking of retroactive changes, define a custom FHIR extension to attach directly to the resource. This extension can store fields liketargetHistoricalVersionId,correctionSummary, andcorrectionReason. Just make sure to register the extension with your FHIR server to ensure compliance.
Remember, FHIR's versioning model is built around immutable history—every change generates a new version, and old versions are preserved. All these approaches work within that model to meet your business need for retroactive updates while staying aligned with FHIR standards.
内容的提问来源于stack exchange,提问作者RahulB

