WildFHIR R4 Enterprise Edition Implementation Guide
1.0.0 - current International flag

WildFHIR R4 Enterprise Edition Implementation Guide - Local Development build (v1.0.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

OperationDefinition: AEGIS WildFHIR R4 Patient Purge

Official URL: http://wildfhir4.aegis.net/ig/wildfhir/OperationDefinition/wildfhir-operation-patient-purge Version: 1.0.0
Active as of 2025-03-26 Computable Name: AEGISWildFHIRR4PatientPurge

This is the WildFHIR R4 Patient Purge operation. It provides a standardized mechanism to force a hard delete or purge of all referenced FHIR resources to a specific Patient. The operation behaves similar to the Patient $everything operation where the Patient Compartment definition is used to discover all related Patient data.

Generated Narrative: OperationDefinition wildfhir-operation-patient-purge

URL: [base]/Patient/$purge

URL: [base]/Patient/[id]/$purge

Parameters

UseNameScopeCardinalityTypeBindingDocumentation
INstart0..1date

The date range relates to care dates, not record currency dates - e.g. all records relating to care provided in a certain date range. If no start date is provided, all records prior to the end date are in scope.

INend0..1date

The date range relates to care dates, not record currency dates - e.g. all records relating to care provided in a certain date range. If no end date is provided, all records subsequent to the start date are in scope.

OUTreturn0..1OperationOutcome

If successful, the operation may contain an OperationOutcome with further information about the purge results (such as warnings or information messages, such as a count of records that were purged / eliminated).

If the operation was unsuccessful, then an OperationOutcome may be returned along with a BadRequest status Code (e.g. reference integrity issue, security issue, or insufficient privileges).

Implemented in AEGIS WildFHIR R4 FHIR test server - http://wildfhir4.aegis.net/fhir4-0-1

Notes:

WARNING This operation purges ALL data for the specified Patient in the WildFHIR data repository and cannot be undone. Please use with caution.

The operation can be invoked using the GET Syntax if the complex type parameter is omitted:

GET [base]/Patient/$purge?{parameters} (Only use when specific authorized patient context is defined.)

GET [base]/Patient/[id]/$purge?{parameters}

Otherwise the POST transaction is used as follows:

POST [base]/Patient/$purge (Only use when specific authorized patient context is defined.)

POST [base]/Patient/[id]/$purge


Example

Request the purge of all related data for a patient using GET syntax

GET [base]/Patient/[id]/$purge?start=2015-01-01
[other headers]

Request the purge of all related data for a patient using POST syntax

POST [base]/Patient/[id]/$purge
[other headers]

POST request body:

    <?xml version="1.0" encoding="UTF-8"?>
    <Parameters xmlns="http://hl7.org/fhir">
      <id value="parameters-patient-purge-in-example"/>
      <parameter>
        <name value="start"/>
        <valueDate value="2015-01-01"/>
      </parameter> 
      <parameter>
        <name value="end"/>
        <valueDate value="2018-12-31"/>
      </parameter>
    </Parameters>

Response

HTTP/1.1 200 OK
[other headers]

Response body:

    <?xml version="1.0" encoding="UTF-8"?>
    <OperationOutcome xmlns="http://hl7.org/fhir">
      <id value="parameters-patient-purge-out-example"/>
      <text>
        <status value="additional"/>
        <div xmlns="http://www.w3.org/1999/xhtml">
          <p>Purge successfully completed</p>
        </div>
      </text>
      <issue> 
        <severity value="information"/>
        <code value="informational"/>
        <details>
          <text value="Purge successfully completed"/>
        </details>
     </issue>
    </OperationOutcome>