<?xml version="1.0" encoding="UTF-8"?>

<OperationDefinition xmlns="http://hl7.org/fhir">
  <id value="Immunization-upsert"/>
  <text>
    <status value="generated"/><div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: OperationDefinition Immunization-upsert</b></p><a name="Immunization-upsert"> </a><a name="hcImmunization-upsert"> </a><p>URL: [base]/Immunization/$upsert</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>immunization</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R4/immunization.html">Immunization</a></td><td/><td><div><p>The Immunization resource to be either updated (if an algorithmic match is found) or inserted (if no match is found) into ImmSOT.</p>
</div></td></tr><tr><td>OUT</td><td>return</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/immunization.html">Immunization</a></td><td/><td><div><p>The updated or created immunisation event (as an Immunization resource).</p>
</div></td></tr><tr><td>OUT</td><td>failure</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/operationoutcome.html">OperationOutcome</a></td><td/><td><div><p>Error response</p>
</div></td></tr></table></div>
  </text>
  <url value="https://standards.digital.health.nz/fhir/air/OperationDefinition/immunization-upsert"/>
  <version value="1.28.0-SNAPSHOT"/>
  <name value="UpsertImmunisationEvent"/>
  <title value="Upsert Immunisation Event"/>
  <status value="active"/>
  <kind value="operation"/>
  <experimental value="false"/>
  <date value="2026-08-04T03:40:16+00:00"/>
  <publisher value="Te Whatu Ora"/>
  <contact>
    <name value="Te Whatu Ora"/>
    <telecom>
      <system value="url"/>
      <value value="https://tewhatuora.govt.nz"/>
    </telecom>
  </contact>
  <description value="Upsert an immunisation event based on a matching algorithm."/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="US"/>
      <display value="New Zealand"/>
    </coding>
  </jurisdiction>
  <affectsState value="true"/>
  <code value="upsert"/>
  <resource value="Immunization"/>
  <system value="false"/>
  <type value="true"/>
  <instance value="false"/>
  <parameter>
    <name value="immunization"/>
    <use value="in"/>
    <min value="1"/>
    <max value="1"/>
    <documentation value="The Immunization resource to be either updated (if an algorithmic match is found) or inserted (if no match is found) into ImmSOT."/>
    <type value="Immunization"/>
  </parameter>
  <parameter>
    <name value="return"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="The updated or created immunisation event (as an Immunization resource)."/>
    <type value="Immunization"/>
  </parameter>
  <parameter>
    <name value="failure"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Error response"/>
    <type value="OperationOutcome"/>
  </parameter>
</OperationDefinition>