NZ Shared Digital Health Record API
1.1.3 - release

NZ Shared Digital Health Record API - Local Development build (v1.1.3) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

Contribute Information to SDHR

Purpose and scope

To write patient health information from a participating PMS to the SDHR Primary Care Collection.

Actors

Actor Role
Participating primary care provider Participates in SDHR and is responsible for the care setting from which information is written.
PMS Determines whether source information is eligible for sharing and writes eligible information to SDHR.
SDHR Validates writes, applies relevant controls, and stores an accepted copy.
Healthcare professional Records or updates information in the PMS, where relevant to the source workflow.
Health NZ participation channel Records a patient's global participation choice through operations restricted to authorised Health NZ callers.

Scope

This use case currently applies to information written to the SDHR Primary Care Collection:

The corresponding FHIR representations are described in data models and FHIR artifacts.

Business rules

  • Information must not be written where patient participation choices prevent sharing.
  • A patient who has not opted out must not be required to make a separate opt-in decision, although the API caller must initialise the facility participation preference before successfully creating the first resource for that patient at that facility.
  • Information marked confidential, sensitive, or otherwise excluded from sharing in the source system must not be written, except where the documented confidentiality process requires an existing SDHR copy to be restricted.
  • Historical information must only be loaded where permitted by SDHR participation, onboarding, and implementation requirements.
  • The PMS is responsible for ensuring that information written to SDHR accurately reflects the information held in the PMS.
  • The PMS remains responsible for source-system correction and update processes.
  • SDHR stores a copy of accepted information for authorised access, but does not replace the PMS as the source system.
  • SDHR does not alter the clinical meaning or any coding of information supplied by source systems.

Preconditions

  • The provider participates in SDHR.
  • The PMS has completed the required onboarding and compliance process.
  • The PMS is authorised to write information to SDHR.
  • Patients participate in SDHR by default unless they have opted out globally or at the relevant facility.
  • Before the first resource can be successfully created for a patient at a facility, the API caller has recorded that patient's facility participation preference.
  • Information excluded from sharing will not be written.

Write information

Write workflow

SDHR Resource Write Sequence DiagramSDHR Resource Write Sequence DiagramHealth PractitionerPMSPMS OrchestratorSDHR FHIR APISDHR FHIR ServerHealth PractitionerHealth PractitionerPMSPMSPMS OrchestratorPMS OrchestratorSDHR FHIR APISDHR FHIR APISDHR FHIR ServerSDHR FHIR Server[01]Record or update clinical information[02]Trigger resource event[03]Retrieve resource details[04]Check eligibility, confidentiality,and sharing controls[05]Select create or update interaction[06]Write eligible FHIR resource[07]Validate resource and applyparticipation and privacy controlsalt[Create accepted][08]Persist resource[09]201 Created with created resource[Update accepted][10]Persist updated resource[11]200 OK with updated resource[Write rejected][12]Return OperationOutcome[13]Record and manage failure

Processing steps

  1. A healthcare professional records or updates clinical information in the PMS.
  2. The PMS determines whether the information is eligible to be written, including whether the patient has opted out and whether source confidentiality controls permit sharing.
  3. Before the first resource can be successfully created for the patient at a facility, the PMS uses the $participate operation to record the facility participation preference. As shown in the sequence diagram, this may occur after SDHR rejects an initial write because the preference is unknown, followed by a retry of the write. The same operation records a later opt-out, restores participation after an earlier opt-out, and manages record-level confidentiality.
  4. The PMS determines whether to create a new SDHR resource or update an existing resource. Existing resources are located and retrieved before update.
  5. The PMS writes the eligible FHIR resource to SDHR.
  6. SDHR validates the request and resource and applies applicable participation and privacy controls.
  7. A successful create returns 201 Created with the created resource; a successful update returns 200 OK with the updated resource.
  8. A rejected write returns an OperationOutcome, which the PMS records and handles as a failed write.

Key behaviour

  • Clinical information is recorded and maintained in the PMS.
  • The PMS determines whether information is eligible to be written to SDHR.
  • The PMS writes eligible information to the SDHR Primary Care Collection.
  • SDHR applies validation and relevant privacy and participation controls.
  • SDHR stores a copy of accepted information.
  • The PMS remains the source system for information written to the SDHR Primary Care Collection.

Response and error handling

  • A successful $participate request returns an OperationOutcome containing a success result.
  • A successful create normally returns 201 Created with the created resource.
  • A successful update normally returns 200 OK with the updated resource.
  • A batch write returns a batch-response Bundle containing the outcome of each entry.
  • A rejected single-resource write returns an OperationOutcome.
  • A failed entry in a batch is represented in that entry's batch response and may contain an OperationOutcome.
  • The PMS must not mark a write as successful when SDHR rejects the request or resource.
  • Detailed status codes, response payloads, validation rules, and errors are documented in the API documentation.

Manage participation

Patients participate in SDHR by default. A patient who has not opted out does not need to take a specific action to opt in.

The API still requires an explicit participation preference before the first resource can be successfully created for that patient at a given facility. The PMS records the default preference on the patient's behalf through $participate; this is technical initialisation and does not represent a separate opt-in decision by the patient.

The PMS must also respect global and facility-level opt-outs and record-level confidentiality choices. These choices, and any later restoration of participation, are managed through SDHR participation capabilities, including the $participate operation where applicable. $participate returns an OperationOutcome indicating whether the participation preference was accepted or why it failed. Detailed parameters, examples, and outcome definitions are documented in the $participate OperationDefinition.

Facility participation

The following diagram covers the facility participation scenarios:

  1. The first write for a patient at a facility establishes the default participation preference if SDHR reports that the preference is unknown.
  2. A facility opt-out records participationIndicator as false and prevents subsequent resources from being shared from that facility.
  3. A facility opt-back-in records participationIndicator as true, allows routine writes to resume, and can trigger the assigned historical-load process for an enrolled patient.
SDHR Participate Operation Facility Participation Sequence DiagramSDHR Participate Operation Facility Participation Sequence DiagramPatientHealth PractitionerPMSPMS OrchestratorParticipate OperationSDHR FHIR APISDHR FHIR ServerPatientPatientHealth PractitionerHealth PractitionerPMSPMSPMS OrchestratorPMS OrchestratorParticipate Operation$participateParticipate Operation$participateSDHR FHIR APISDHR FHIR APISDHR FHIR ServerSDHR FHIR ServerFirst resource write establishes facility participation[01]Consultation[02]Record patient data e.g. Condition[03]Trigger new condition event[04]Retrieve Condition details[05]Write Condition[06]Check patient participation preferencesThe SDHR service checks whether a participation preference has been recorded for the patient at this facility.If no preference has been recorded, the SDHR service returns an OperationOutcome with a participation status unknown.The API consumer should then use the $participate operation to indicate the patient's participation preferences.alt[Facility participation preference is unknown][07]Return OperationOutcome[08]Return OperationOutcome{"resourceType" : "OperationOutcome","issue" : [{"severity" : "information","code" : "informational","details" : {"coding" : [{"system" : "https://fhir-ig.digital.health.nz/sdhr/CodeSystem/sdhr-outcome-codes","code" : "sdhr-participation-status-unknown","display" : "SDHR Participation Status Unknown"}],"text" : "The Shared Digital Health Record service has no record of participation preferences for this patient at this facility.Please use the $participate operation to indicate the patients participation preferences."}}]}[09]Return OperationOutcome[10]Trigger patient event[11]Retrieve patient details[12]Prepare participationparameters[13]Invoke participate operationParameters:- patient: Patient ID (NHI)- facilityId: Facility ID (HPI FacilityID)- participationIndicator: true[14]Write Participation[15]Persist[16]Return OperationOutcome{"resourceType" : "OperationOutcome","issue" : [{"severity" : "information","code" : "informational","details" : {"coding" : [{"system" : "https://fhir-ig.digital.health.nz/sdhr/CodeSystem/sdhr-outcome-codes","code" : "sdhr-operation-success","display" : "SDHR Operation Success"}],"text" : "Patient participation status successfully recorded."}}]}[17]Retry write Condition[18]Persist Condition[19]Return created Condition resource[Facility participation preference permits sharing][20]Persist Condition[21]Return Condition resource[22]Return created Condition resourcePatient opts out of SDHR participation at facility[23]Request to opt outof SDHR participation[24]Request to opt outof SDHR participation[25]Trigger patient event[26]Retrieve patient details[27]Prepare participationparameters[28]Invoke participate operationParameters:- patient: Patient ID (NHI)- facilityId: Facility ID (HPI FacilityID)- participationIndicator: false[29]Write Participation[30]Persist[31]Return OperationOutcomeSearch for a Resource[32]Search Resource (e.g. Condition)[33]Query Resource[34]Return[35]Return Search result with REDACTED dataIn this example the patient was previously opted in and uploaded 1 Condition resource.The SDHR service indicates that the search resulted in 1 `match` but the data is redacteddue to the patient's participation preferences. "meta" : {"security" : [{"system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationValue","code" : "redacted","display" : "REDACTED"}]},"type" : "searchset","total" : 1,"entry": []GET a Single Resource by ID[36]GET ANY Resource by ID (e.g./Condition/{ID})[37]Query Resource by ID[38]Return 403[39]Return OperationOutcome UNAUTHORIZED{"resourceType" : "OperationOutcome","id" : "OperationOutcomeFacilityDenyExample","issue" : [{"severity" : "error","code" : "suppressed","details" : {"coding" : [{"system" : "https://fhir-ig.digital.health.nz/sdhr/CodeSystem/sdhr-outcome-codes","code" : "sdhr-participation-status-denied-facility","display" : "SDHR Participation Status Denied at Facility"}],"text" : "Patient has opted out of participating in the shared digital health record service at this facility."}}]}Create a Resource[40]Create Resource (e.g. Condition)[41]Return OperationOutcome{"resourceType" : "OperationOutcome","id" : "OperationOutcomeFacilityDenyExample","issue" : [{"severity" : "error","code" : "suppressed","details" : {"coding" : [{"system" : "https://fhir-ig.digital.health.nz/sdhr/CodeSystem/sdhr-outcome-codes","code" : "sdhr-participation-status-denied-facility","display" : "SDHR Participation Status Denied at Facility"}],"text" : "Patient has opted out of participating in the shared digital health record service at this facility."}}]}Patient opts back in to SDHR participation at facility[42]Request to opt back into SDHR participation[43]Record restored participation preference[44]Trigger patient event[45]Retrieve patient details and enrolment[46]Prepare participationparameters[47]Invoke participate operationParameters:- patient: Patient ID (NHI)- facilityId: Facility ID (HPI FacilityID)- participationIndicator: true- enrolledPatient: true (when enrolled and a historic load is required)[48]Write Participation[49]Persist[50]Return OperationOutcomeopt[Enrolled patient requires historical information][51]Trigger assigned historical-load processPull-based acquisition uses an SDHR patient lock.For push-based acquisition, the PMS Orchestrator coordinateshistoric and real-time writes.[52]Resume eligible resource writeswhen load coordination permits[53]Persist resource[54]Return created or updated resource

The PMS must immediately prevent new or changed local records for the patient from being written after a facility opt-out is recorded. See Reload after a patient opts back in for the historical information process that follows an opt-back-in.

Set record-level confidentiality

SDHR Participate Operation Record Withheld SequenceSDHR Participate Operation Record Withheld SequenceHealth PractitionerPMSPMS OrchestratorParticipate OperationSDHR FHIR APISDHR FHIR ServerHealth PractitionerHealth PractitionerPMSPMSPMS OrchestratorPMS OrchestratorParticipate Operation$participateParticipate Operation$participateSDHR FHIR APISDHR FHIR APISDHR FHIR ServerSDHR FHIR ServerPatient Elects to Withhold Records Whilst Participating in the SDHR Service[01]Record set to RESTRICTED[02]Trigger resource event[03]Retrieve resource details[04]Prepare participationparameters[05]Invoke participate operationParameters:- patient: Patient ID (NHI)- facilityId: Facility ID (HPI FacilityID)- resourceType: Resource Type (e.g. Condition)- localResourceId: Resource ID (e.g. Local Resource ID)- reasonCode: sdhr-record-withheld[06]Write Participation[07]Persist[08]Return OperationOutcomealt[SDHR has resource][09]PUT Resource with meta.securityRESTRICTED"meta" : {"security" : [{"system" : "http://terminology.hl7.org/CodeSystem/v3-Confidentiality","code" : "R","display" : "Restricted"}]}Search for Withheld Record[10]Search Resource (e.g. Condition)[11]Query Resource[12]Return[13]Return Search result with OperationOutcomeindicating that the patient has witheld recordsat source{"resourceType" : "OperationOutcome","issue" : [{"severity" : "information","code" : "informational","details" : {"coding" : [{"system" : "https://fhir-ig.digital.health.nz/sdhr/CodeSystem/sdhr-outcome-codes","code" : "sdhr-records-withheld-at-source","display" : "Records withheld at source"}],"text" : "Patient has withheld records at source. The operation was successful,but some records were not included in the response due to confidentiality settings."}}]}Patient Elects to Unrestict the Record[14]Record set to UNRESTRICTED[15]Trigger resource event[16]Retrieve resource detailsalt[check SDHR for resource][17]Search for Resource by Patient, Facility andLocalID[18]Query Resource[19]Return[20]Return Search result with OperationOutcomeindicating that the patient has witheld recordsat source"type" : "searchset","total" : 0,"entry": ["resourceType" : "Bundle",{"resourceType" : "OperationOutcome","issue" : [{"severity" : "information","code" : "informational","details" : {"coding" : [{"system" : "https://fhir-ig.digital.health.nz/sdhr/CodeSystem/sdhr-outcome-codes","code" : "sdhr-records-withheld-at-source","display" : "Records withheld at source"}],"text" : "Patient has withheld records at source. The operation was successful,but some records were not included in the response due to confidentiality settings."}}]}][21]Prepare participationparameters[22]Invoke participate operationParameters:- patient: Patient ID (NHI)- facilityId: Facility ID (HPI FacilityID)- resourceType: Resource Type (e.g. Condition)- localResourceId: Resource ID (e.g. Local Resource ID)- reasonCode: sdhr-record-released[23]Write Participation[24]Persist[25]Return OperationOutcome[26]POST Resource[27]Create Resource[28]Return[29]Return Resource

A new confidential Condition or Observation record must not be written to SDHR. If a copy already exists when the source record becomes confidential, the PMS must follow the documented update and confidentiality process. AllergyIntolerance records cannot be withheld at record level. See the confidential record API behaviour and compliance requirements for systems sharing data.

Global participation through Health NZ

A patient can record a global opt-out or restore global participation through an authorised Health NZ channel.

SDHR Health NZ Channel Opt Off Sequence DiagramSDHR Health NZ Channel Opt Off Sequence DiagramPatientHealth PractitionerHealth NZPMSPMS OrchestratorParticipate OperationSDHR FHIR APISDHR FHIR ServerPatientPatientHealth PractitionerHealth PractitionerHealth NZHealth NZPMSPMSPMS OrchestratorPMS OrchestratorParticipate Operation$participateParticipate Operation$participateSDHR FHIR APISDHR FHIR APISDHR FHIR ServerSDHR FHIR ServerPatient opts out of SDHR participation using HNZ channel[01]Notify HNZ of opt out prefference[02]Prepare participationparameters[03]Invoke participate operationParameters:- patient: Patient ID (NHI)- facilityId: Facility ID (HPI FacilityID)Note that this is a reserved HNZ facility ID- participationIndicator: false[04]Write Participation[05]Persist[06]Return OperationOutcome{"resourceType" : "OperationOutcome","issue" : [{"severity" : "information","code" : "informational","details" : {"coding" : [{"system" : "https://fhir-ig.digital.health.nz/sdhr/CodeSystem/sdhr-outcome-codes","code" : "sdhr-operation-success","display" : "SDHR Operation Success"}],"text" : "Patient participation status successfully recorded."}}]}Patient Consultation[07]Consultation[08]Record patient data e.g. Condition[09]Trigger new condition event[10]Search Resource (e.g. Condition)[11]Return 403 OperationOutcomeUNAUTHORIZEDThe patient has opted out of participating in the Shared Digital Health Record service.{"resourceType" : "OperationOutcome","issue" : [{"severity" : "error","code" : "suppressed","details" : {"coding" : [{"system" : "https://fhir-ig.digital.health.nz/sdhr/CodeSystem/sdhr-outcome-codes","code" : "sdhr-participation-status-denied","display" : "SDHR Participation Status Denied"}],"text" : "Patient has opted out of participating in the shared digital health record service."}}]}GET a Single Resource by ID[12]GET ANY Resource by ID (e.g./Condition/{ID})[13]Return 403 OperationOutcomeUNAUTHORIZEDThe patient has opted out of participating in the Shared Digital Health Record service.{"resourceType" : "OperationOutcome","issue" : [{"severity" : "error","code" : "suppressed","details" : {"coding" : [{"system" : "https://fhir-ig.digital.health.nz/sdhr/CodeSystem/sdhr-outcome-codes","code" : "sdhr-participation-status-denied","display" : "SDHR Participation Status Denied"}],"text" : "Patient has opted out of participating in the shared digital health record service."}}]}Create a Resource[14]Create Resource (e.g. Condition)[15]Return 403 OperationOutcomeUNAUTHORIZEDThe patient has opted out of participating in the Shared Digital Health Record service.{"resourceType" : "OperationOutcome","issue" : [{"severity" : "error","code" : "suppressed","details" : {"coding" : [{"system" : "https://fhir-ig.digital.health.nz/sdhr/CodeSystem/sdhr-outcome-codes","code" : "sdhr-participation-status-denied","display" : "SDHR Participation Status Denied"}],"text" : "Patient has opted out of participating in the shared digital health record service."}}]}

When a patient restores global participation, the enrolled PMS must be notified so the applicable historical reload can be initiated. See Reload after a patient opts back in.

Load historical information

Historical loads populate the SDHR Primary Care Collection with eligible information recorded before routine SDHR writes began. Historical information remains subject to provider onboarding, patient participation, enrolment, confidentiality, and source-quality requirements.

Initial facility historical load

SDHR supports two acquisition designs. Each PMS implementation uses the design assigned during onboarding:

  • Pull-based: SDHR performs the initial load on behalf of the application.
  • Push-based: the application initiates and controls the load through the bulk API.
SDHR Initial Facility Historic Load Sequence DiagramSDHR Initial Facility Historic Load Sequence DiagramPrimary Care ProviderPMSPMS OrchestratorSDHR FHIR APISDHR FHIR ServerPrimary Care ProviderPrimary Care ProviderPMSPMSPMS OrchestratorPMS OrchestratorSDHR FHIR APISDHR FHIR APISDHR FHIR ServerSDHR FHIR Server[01]Complete onboarding and sharingauthorisation[02]Enable SDHR information sharing[03]Apply patient opt-outs andconfidentiality exclusionsalt[Pull-based acquisition][04]Lock facility for routine writes[05]Initiate authorised facility historic load[06]Retrieve eligible historic information[07]Return eligible historic information[08]Supply eligible historic informationloop[For each eligible historic resource][09]Persist historic resource[10]Unlock facility[Push-based acquisition][11]Trigger facility historic load[12]Retrieve eligible historic information[13]Return eligible historic information[14]Coordinate historic and real-time writesso history cannot overwrite newer data[15]Write authorised bulk historic load[16]Persist submitted historic resources[17]Return load results[18]Begin or continue routine writes

The initial load:

  • includes only patients enrolled at the participating facility who have not opted out;
  • applies existing source opt-out choices before information is loaded;
  • includes all eligible historical depth rather than imposing an arbitrary time limit;
  • excludes confidential Condition and Observation records and records already deleted in the source system; and
  • must not overwrite a newer resource written through the routine API.

For pull-based acquisition, SDHR temporarily locks the facility against routine writes while it performs the historical load; a write attempted during this period receives the Facility Locked OperationOutcome. For push-based acquisition, the PMS Orchestrator is responsible for coordinating historical and real-time writes so that older history does not overwrite newer data.

Detailed assurance requirements are documented under Concurrent historical and real-time data and Facility onboarding and historical data load.

Reload after a patient opts back in

When a patient opts back in at a facility, their eligible history must be reloaded for that facility. For pull-based acquisition, SDHR initiates the individual load. For push-based acquisition, the application initiates the load.

When a patient opts back in through a Health NZ channel after a global opt-out, the application must be able to receive a notification and trigger a load of the enrolled patient's history. An API-triggered process is preferred; a controlled manual process may be used where agreed during onboarding.

SDHR Patient Historic Reload Sequence DiagramSDHR Patient Historic Reload Sequence DiagramPatientHealth PractitionerHealth NZPMSPMS OrchestratorParticipate OperationSDHR FHIR APISDHR FHIR ServerPatientPatientHealth PractitionerHealth PractitionerHealth NZHealth NZPMSPMSPMS OrchestratorPMS OrchestratorParticipate Operation$participateParticipate Operation$participateSDHR FHIR APISDHR FHIR APISDHR FHIR ServerSDHR FHIR Serveralt[Patient opts back in at facility][01]Request to opt back into SDHR participation[02]Record restored participation preference[03]Trigger patient event[04]Invoke participate operation[05]Write Participation[06]Persist[07]Return OperationOutcome[Patient opts back in through Health NZ channel][08]Restore SDHR participation[09]Notify participation changealt[Pull-based acquisition][10]Lock patient for routine writes[11]Initiate individual historic reload[12]Retrieve eligible patient history[13]Return eligible patient history[14]Supply eligible patient historyloop[For each eligible historic resource][15]Create or update resource[16]Unlock patient[17]Return load results[Push-based acquisition][18]Retrieve eligible patient history[19]Return eligible patient history[20]Coordinate historic and real-time writesso history cannot overwrite newer dataloop[For each eligible historic resource][21]Create or update resource[22]Persist submitted resource[23]Return load results[24]Resume eligible routine writes

For pull-based acquisition, SDHR temporarily locks the patient against routine writes while it performs the reload; a write attempted during this period receives the Patient Locked OperationOutcome. For push-based acquisition, the PMS Orchestrator is responsible for coordinating historical and real-time writes so that older history does not overwrite newer data.

The application must resume writing eligible new and changed information at the earliest practical time once the applicable load coordination permits. See Concurrent historical and real-time data, the facility opt-back-in requirements, and the global opt-back-in requirements.

Interaction Use in this workflow API documentation
$participate Initialise a facility preference, record opt-outs, restore participation after an opt-out, and manage record-level withholding or release. Participation operations
Search and read Locate and retrieve an existing resource before update. Contributed resource interactions
Create Write a new eligible resource. Contributed resource interactions
Update Reconcile an existing SDHR copy with the source PMS. Resource update behaviour
Batch Write multiple eligible resources in a FHIR batch. Batch interaction
Errors and confidentiality Handle validation, participation, and confidentiality outcomes. Confidential record API behaviour