{
  "resourceType" : "OperationDefinition",
  "id" : "DHOAppointmentBackfill",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: OperationDefinition DHOAppointmentBackfill</b></p><a name=\"DHOAppointmentBackfill\"> </a><a name=\"hcDHOAppointmentBackfill\"> </a><p>URL: [base]/Appointment/$backfill</p><h3>Parameters</h3><table class=\"grid\"><tr><td><b>Use</b></td><td><b>Name</b></td><td><b>Scope</b></td><td><b>Cardinality</b></td><td><b>Type</b></td><td><b>Binding</b></td><td><b>Documentation</b></td></tr><tr><td>IN</td><td>mode</td><td/><td>1..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#code\">code</a></td><td/><td><div><p>location-correction, patient-instruction or touch</p>\n</div></td></tr><tr><td>IN</td><td>lastUpdated</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#date\">date</a></td><td/><td><div><p>Select Appointments updated on or after this date. Not with apptDate or identifier.</p>\n</div></td></tr><tr><td>IN</td><td>apptDate</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#date\">date</a></td><td/><td><div><p>Select Appointments starting on or after this date. Not with lastUpdated or identifier.</p>\n</div></td></tr><tr><td>IN</td><td>apptDateTo</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#date\">date</a></td><td/><td><div><p>With apptDate: select Appointments starting from apptDate to this date, both included.</p>\n</div></td></tr><tr><td>IN</td><td>identifier</td><td/><td>0..*</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#string\">string</a></td><td/><td><div><p>An appointment id value to select, under any appointment-id system. Not with a date.</p>\n</div></td></tr><tr><td>IN</td><td>audit</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#boolean\">boolean</a></td><td/><td><div><p>true: look everything up and report what would change, but write nothing. Not for touch.</p>\n</div></td></tr><tr><td>OUT</td><td>job</td><td/><td>1..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#string\">string</a></td><td/><td><div><p>The job id, for $backfill-status and $backfill-cancel</p>\n</div></td></tr><tr><td>OUT</td><td>status</td><td/><td>1..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#code\">code</a></td><td/><td><div><p>accepted</p>\n</div></td></tr></table></div>"
  },
  "url" : "https://fhir-ig.digital.health.nz/shared-care/OperationDefinition/DHOAppointmentBackfill",
  "version" : "0.4.7",
  "name" : "DHOAppointmentBackfill",
  "title" : "Start an Appointment backfill",
  "status" : "active",
  "kind" : "operation",
  "date" : "2026-10-13T01:26:02+00:00",
  "publisher" : "Te Whatu Ora",
  "contact" : [{
    "name" : "Te Whatu Ora",
    "telecom" : [{
      "system" : "url",
      "value" : "https://www.tewhatuora.govt.nz/"
    }]
  },
  {
    "name" : "Te Whatu Ora Integration Team",
    "telecom" : [{
      "system" : "email",
      "value" : "integration@tewhatuora.govt.nz",
      "use" : "work"
    }]
  }],
  "description" : "Starts a backfill of DHO Appointments in FHIR CDR and returns straight away with a job id. The run carries on in the\nbackground. Follow it with $backfill-status and stop it with $backfill-cancel.\n\nSelect Appointments with one of:\n- a date: `lastUpdated` (updated on or after it) or `apptDate` (starting on or after it, or from `apptDate` to\n  `apptDateTo` inclusive)\n- one or more `identifier` values (SIPICS, legacy or Karisma SO appointment ids)\n\nModes:\n- `location-correction` corrects each Appointment's location from SIPICS, or cancels it. Identifiers FHIR CDR\n  doesn't have are created from SIPICS.\n- `patient-instruction` replaces each Appointment's patientInstruction from SIPICS.\n- `touch` re-saves each Appointment unchanged, so its meta.lastUpdated moves on.",
  "jurisdiction" : [{
    "coding" : [{
      "system" : "urn:iso:std:iso:3166",
      "code" : "NZ",
      "display" : "New Zealand"
    }]
  }],
  "affectsState" : true,
  "code" : "backfill",
  "resource" : ["Appointment"],
  "system" : false,
  "type" : true,
  "instance" : false,
  "parameter" : [{
    "name" : "mode",
    "use" : "in",
    "min" : 1,
    "max" : "1",
    "documentation" : "location-correction, patient-instruction or touch",
    "type" : "code"
  },
  {
    "name" : "lastUpdated",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "Select Appointments updated on or after this date. Not with apptDate or identifier.",
    "type" : "date"
  },
  {
    "name" : "apptDate",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "Select Appointments starting on or after this date. Not with lastUpdated or identifier.",
    "type" : "date"
  },
  {
    "name" : "apptDateTo",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "With apptDate: select Appointments starting from apptDate to this date, both included.",
    "type" : "date"
  },
  {
    "name" : "identifier",
    "use" : "in",
    "min" : 0,
    "max" : "*",
    "documentation" : "An appointment id value to select, under any appointment-id system. Not with a date.",
    "type" : "string"
  },
  {
    "name" : "audit",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "true: look everything up and report what would change, but write nothing. Not for touch.",
    "type" : "boolean"
  },
  {
    "name" : "job",
    "use" : "out",
    "min" : 1,
    "max" : "1",
    "documentation" : "The job id, for $backfill-status and $backfill-cancel",
    "type" : "string"
  },
  {
    "name" : "status",
    "use" : "out",
    "min" : 1,
    "max" : "1",
    "documentation" : "accepted",
    "type" : "code"
  }]
}