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

<TestScript xmlns="http://hl7.org/fhir">
  <id value="au-core-medication"/>
  <text>
    <status value="generated"/><div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: TestScript au-core-medication</b></p><a name="au-core-medication"> </a><a name="hcau-core-medication"> </a><p><b>url</b>: <a href="TestScript-au-core-medication.html">TestScript AU Core Medication — SHALL-level conformance</a></p><p><b>version</b>: 0.1.0</p><p><b>name</b>: AUCoreMedication</p><p><b>title</b>: AU Core Medication — SHALL-level conformance</p><p><b>status</b>: Active</p><p><b>date</b>: 2026-08-16 05:55:37+0000</p><p><b>publisher</b>: FHIR Frog</p><p><b>contact</b>: FHIR Frog: <a href="https://gitlab.com/fhirfrog">https://gitlab.com/fhirfrog</a></p><p><b>description</b>: </p><div><p>Covers the SHALL-level AU Core Medication (2.0.0) requirements reachable via direct read: read by id, must-support element presence (code; code.coding pbs and amt slices), and profile conformance validation. AU Core Medication defines no AU-Core search parameters, so this TestScript is read-only by design — there is no per-search-param test block, unlike au-core-patient. Inferno's own coverage of au-core-medication is itself indirect: config.basic.json sets Medication: {skip_generation: true}, so no standalone Inferno group exists for this profile, and it is otherwise reached only via MedicationRequest's medication_request_medication_inclusion_validation_test.rb, which validates a Medication resource fetched through _include=MedicationRequest:medication. That inclusion pattern is covered separately by au-core-medicationrequest's TestScript (fhirfrog/au-core-compiler#14) and is not duplicated here. This TestScript instead exercises Medication directly by id, mirroring the SHALL-only scope precedent set for Patient (fhirfrog/au-core-compiler#6). See fhirfrog/au-core-compiler#13 for scope rationale.</p>
</div><blockquote><p><b>fixture</b></p><blockquote><p><b>id</b></p>medication-fixture</blockquote><p><b>autocreate</b>: true</p><p><b>autodelete</b>: true</p><p><b>resource</b>: <code>au-core-medication-conformant</code></p></blockquote><h3>Variables</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Name</b></td><td><b>Path</b></td><td><b>SourceId</b></td></tr><tr><td style="display: none">*</td><td>medicationId</td><td>Medication.id</td><td>medication-fixture</td></tr></table><blockquote><p><b>test</b></p><p><b>name</b>: Read</p><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>EncodeRequestUrl</b></td><td><b>Params</b></td></tr><tr><td style="display: none">*</td><td><a href="http://terminology.hl7.org/7.3.0/CodeSystem-testscript-operation-codes.html#testscript-operation-codes-read">Test script operation code: read</a> (Read)</td><td>Medication</td><td>true</td><td>/${medicationId}</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Response</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>okay</td><td>false</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><p><b>name</b>: MustSupport</p><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>EncodeRequestUrl</b></td><td><b>Params</b></td></tr><tr><td style="display: none">*</td><td><a href="http://terminology.hl7.org/7.3.0/CodeSystem-testscript-operation-codes.html#testscript-operation-codes-read">Test script operation code: read</a> (Read)</td><td>Medication</td><td>true</td><td>/${medicationId}</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Medication.code.exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Medication.code.coding.where(system = 'http://pbs.gov.au/code/item').exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Medication.code.coding.where(system = 'http://snomed.info/sct').exists()</td><td>false</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><p><b>name</b>: ProfileValidation</p><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>EncodeRequestUrl</b></td><td><b>Params</b></td></tr><tr><td style="display: none">*</td><td><a href="http://terminology.hl7.org/7.3.0/CodeSystem-testscript-operation-codes.html#testscript-operation-codes-read">Test script operation code: read</a> (Read)</td><td>Medication</td><td>true</td><td>/${medicationId}</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>ValidateProfileId</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>http://hl7.org.au/fhir/core/StructureDefinition/au-core-medication</td><td>false</td></tr></table></blockquote></blockquote></div>
  </text>
  <url value="http://fhirfrog.org/fhir/au-core-tests/TestScript/au-core-medication"/>
  <version value="0.1.0"/>
  <name value="AUCoreMedication"/>
  <title value="AU Core Medication — SHALL-level conformance"/>
  <status value="active"/>
  <date value="2026-08-16T05:55:37+00:00"/>
  <publisher value="FHIR Frog"/>
  <contact>
    <name value="FHIR Frog"/>
    <telecom>
      <system value="url"/>
      <value value="https://gitlab.com/fhirfrog"/>
    </telecom>
  </contact>
  <description value="Covers the SHALL-level AU Core Medication (2.0.0) requirements reachable via direct read: read by id, must-support element presence (code; code.coding pbs and amt slices), and profile conformance validation. AU Core Medication defines no AU-Core search parameters, so this TestScript is read-only by design — there is no per-search-param test block, unlike au-core-patient. Inferno's own coverage of au-core-medication is itself indirect: config.basic.json sets Medication: {skip_generation: true}, so no standalone Inferno group exists for this profile, and it is otherwise reached only via MedicationRequest's medication_request_medication_inclusion_validation_test.rb, which validates a Medication resource fetched through _include=MedicationRequest:medication. That inclusion pattern is covered separately by au-core-medicationrequest's TestScript (fhirfrog/au-core-compiler#14) and is not duplicated here. This TestScript instead exercises Medication directly by id, mirroring the SHALL-only scope precedent set for Patient (fhirfrog/au-core-compiler#6). See fhirfrog/au-core-compiler#13 for scope rationale."/>
  <fixture id="medication-fixture">
    <autocreate value="true"/>
    <autodelete value="true"/>
    <resource>
      <reference value="au-core-medication-conformant"/>
    </resource>
  </fixture>
  <variable>
    <name value="medicationId"/>
    <path value="Medication.id"/>
    <sourceId value="medication-fixture"/>
  </variable>
  <test>
    <name value="Read"/>
    <action>
      <operation>
        <type>
          <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="read"/>
        </type>
        <resource value="Medication"/>
        <encodeRequestUrl value="true"/>
        <params value="/${medicationId}"/>
      </operation>
    </action>
    <action>
      <assert>
        <response value="okay"/>
        <warningOnly value="false"/>
      </assert>
    </action>
  </test>
  <test>
    <name value="MustSupport"/>
    <action>
      <operation>
        <type>
          <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="read"/>
        </type>
        <resource value="Medication"/>
        <encodeRequestUrl value="true"/>
        <params value="/${medicationId}"/>
      </operation>
    </action>
    <action>
      <assert>
        <expression value="Medication.code.exists()"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <expression value="Medication.code.coding.where(system = 'http://pbs.gov.au/code/item').exists()"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <expression value="Medication.code.coding.where(system = 'http://snomed.info/sct').exists()"/>
        <warningOnly value="false"/>
      </assert>
    </action>
  </test>
  <test>
    <name value="ProfileValidation"/>
    <action>
      <operation>
        <type>
          <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="read"/>
        </type>
        <resource value="Medication"/>
        <encodeRequestUrl value="true"/>
        <params value="/${medicationId}"/>
      </operation>
    </action>
    <action>
      <assert>
        <validateProfileId value="http://hl7.org.au/fhir/core/StructureDefinition/au-core-medication"/>
        <warningOnly value="false"/>
      </assert>
    </action>
  </test>
</TestScript>