au-core-medicationrequest
type: TestScript
node role: treeRoot
resource.id:
  value: au-core-medicationrequest
domain resource.text:
  narrative.status:
    value: generated
  narrative.div: Generated Narrative: TestScript au-core-medicationrequest url: TestScript AU Core MedicationRequest — SHALL-level conformance version: 0.1.0 name: AUCoreMedicationRequest title: AU Core MedicationRequest — SHALL-level conformance status: Active date: 2026-08-16 05:55:37+0000 publisher: FHIR Frog contact: FHIR Frog: https://gitlab.com/fhirfrog description: Covers the SHALL-level AU Core MedicationRequest (2.0.0) requirements: read, search by _id, authoredon, intent, status and patient, a search demonstrating the _include=MedicationRequest:medication inclusion mechanism, must-support element presence, and profile conformance validation. Mirrors the SHALL subset of au-fhir-core-inferno's MedicationRequestGroup (medication_request_read_test, medication_request__id_search_test, medication_request_authoredon_search_test, medication_request_intent_search_test, medication_request_status_search_test, medication_request_patient_search_test, medication_request_patient_include_medication_test, medication_request_must_support_test, medication_request_validation_test) — the SHOULD/MAY-level combinatorial search tests (chained patient.identifier searches, multi-param AND/OR combinations, the further patient+intent+authoredon/status _include variants) are not replicated here; see fhirfrog/au-core-compiler#6 for the general scope rationale established for Patient, applied here for #14. Known engine limitation, documented here rather than as a new issue: fhir-frog's AssertionEvaluator validateProfileId assertion validates whichever resource came back from the last operation directly; it cannot reach into a specific entry of a returned Bundle to separately validate an included resource (e.g. the Medication pulled in via _include) against its own profile as a sub-check. Consequently the IncludeMedication test below only demonstrates the retrieval mechanism — asserting via FHIRPath that the Bundle contains both a MedicationRequest and a Medication entry — and does not attempt to validat…
test script.url:
  value: http://fhirfrog.org/fhir/au-core-tests/TestScript/au-core-medicationrequest
test script.version:
  value: 0.1.0
test script.name:
  value: AUCoreMedicationRequest
test script.title:
  value: AU Core MedicationRequest — SHALL-level conformance
test script.status:
  value: active
test script.date:
  value: 2026-08-16T05:55:37+00:00
test script.publisher:
  value: FHIR Frog
test script.contact:
  index: 0
  contact detail.name:
    value: FHIR Frog
  contact detail.telecom:
    index: 0
    contact point.system:
      value: url
    contact point.value:
      value: https://gitlab.com/fhirfrog
test script.description:
  value: Covers the SHALL-level AU Core MedicationRequest (2.0.0) requirements: read, search by _id, authoredon, intent, status and patient, a search demonstrating the _include=MedicationRequest:medication inclusion mechanism, must-support element presence, and profile conformance validation. Mirrors the SHALL subset of au-fhir-core-inferno's MedicationRequestGroup (medication_request_read_test, medication_request__id_search_test, medication_request_authoredon_search_test, medication_request_intent_search_test, medication_request_status_search_test, medication_request_patient_search_test, medication_request_patient_include_medication_test, medication_request_must_support_test, medication_request_validation_test) — the SHOULD/MAY-level combinatorial search tests (chained patient.identifier searches, multi-param AND/OR combinations, the further patient+intent+authoredon/status _include variants) are not replicated here; see fhirfrog/au-core-compiler#6 for the general scope rationale established for Patient, applied here for #14. Known engine limitation, documented here rather than as a new issue: fhir-frog's AssertionEvaluator validateProfileId assertion validates whichever resource came back from the *last* operation directly; it cannot reach into a specific entry of a returned Bundle to separately validate an included resource (e.g. the Medication pulled in via _include) against its own profile as a sub-check. Consequently the IncludeMedication test below only demonstrates the retrieval mechanism — asserting via FHIRPath that the Bundle contains both a MedicationRequest and a Medication entry — and does not attempt to validateProfileId the included Medication against au-core-medication. MedicationRequest's own profile conformance is instead exercised separately in the ProfileValidation test via a plain read followed by validateProfileId, which the engine handles correctly. A second, unrelated engine quirk found during validation against a live HAPI server: HAPI's FHIRPathEng…
test script.fixture:
  index: 0
  element.id:
    value: patient-fixture
  test script.fixture.autocreate:
    value: true
  test script.fixture.autodelete:
    value: true
  test script.fixture.resource:
    reference.reference:
      value: au-core-patient-conformant
test script.fixture:
  index: 1
  element.id:
    value: medication-fixture
  test script.fixture.autocreate:
    value: true
  test script.fixture.autodelete:
    value: true
  test script.fixture.resource:
    reference.reference:
      value: au-core-medicationrequest-medication
test script.fixture:
  index: 2
  element.id:
    value: medicationrequest-fixture
  test script.fixture.autocreate:
    value: true
  test script.fixture.autodelete:
    value: true
  test script.fixture.resource:
    reference.reference:
      value: au-core-medicationrequest-conformant
test script.variable:
  index: 0
  test script.variable.name:
    value: patientId
  test script.variable.path:
    value: Patient.id
  test script.variable.source id:
    value: patient-fixture
test script.variable:
  index: 1
  test script.variable.name:
    value: medicationRequestId
  test script.variable.path:
    value: MedicationRequest.id
  test script.variable.source id:
    value: medicationrequest-fixture
test script.test:
  index: 0
  test script.test.name:
    value: Read
  test script.test.action:
    index: 0
    test script.test.action.operation:
      test script.setup.action.operation.resource:
        value: MedicationRequest
      test script.setup.action.operation.encode request url:
        value: true
      test script.setup.action.operation.params:
        value: /${medicationRequestId}
  test script.test.action:
    index: 1
    test script.test.action.assert:
      test script.setup.action.assert.response:
        value: okay
      test script.setup.action.assert.warning only:
        value: false
test script.test:
  index: 1
  test script.test.name:
    value: SearchById
  test script.test.action:
    index: 0
    test script.test.action.operation:
      test script.setup.action.operation.resource:
        value: MedicationRequest
      test script.setup.action.operation.encode request url:
        value: true
      test script.setup.action.operation.params:
        value: ?_id=${medicationRequestId}
  test script.test.action:
    index: 1
    test script.test.action.assert:
      test script.setup.action.assert.response:
        value: okay
      test script.setup.action.assert.warning only:
        value: false
  test script.test.action:
    index: 2
    test script.test.action.assert:
      test script.setup.action.assert.expression:
        value: Bundle.entry.resource.ofType(MedicationRequest).exists()
      test script.setup.action.assert.warning only:
        value: false
test script.test:
  index: 2
  test script.test.name:
    value: SearchByAuthoredOn
  test script.test.action:
    index: 0
    test script.test.action.operation:
      test script.setup.action.operation.resource:
        value: MedicationRequest
      test script.setup.action.operation.encode request url:
        value: true
      test script.setup.action.operation.params:
        value: ?authoredon=2024-03-15
  test script.test.action:
    index: 1
    test script.test.action.assert:
      test script.setup.action.assert.response:
        value: okay
      test script.setup.action.assert.warning only:
        value: false
  test script.test.action:
    index: 2
    test script.test.action.assert:
      test script.setup.action.assert.expression:
        value: Bundle.entry.resource.ofType(MedicationRequest).exists()
      test script.setup.action.assert.warning only:
        value: false
test script.test:
  index: 3
  test script.test.name:
    value: SearchByIntent
  test script.test.action:
    index: 0
    test script.test.action.operation:
      test script.setup.action.operation.resource:
        value: MedicationRequest
      test script.setup.action.operation.encode request url:
        value: true
      test script.setup.action.operation.params:
        value: ?intent=order
  test script.test.action:
    index: 1
    test script.test.action.assert:
      test script.setup.action.assert.response:
        value: okay
      test script.setup.action.assert.warning only:
        value: false
  test script.test.action:
    index: 2
    test script.test.action.assert:
      test script.setup.action.assert.expression:
        value: Bundle.entry.resource.ofType(MedicationRequest).exists()
      test script.setup.action.assert.warning only:
        value: false
test script.test:
  index: 4
  test script.test.name:
    value: SearchByStatus
  test script.test.action:
    index: 0
    test script.test.action.operation:
      test script.setup.action.operation.resource:
        value: MedicationRequest
      test script.setup.action.operation.encode request url:
        value: true
      test script.setup.action.operation.params:
        value: ?status=active
  test script.test.action:
    index: 1
    test script.test.action.assert:
      test script.setup.action.assert.response:
        value: okay
      test script.setup.action.assert.warning only:
        value: false

value: read

value: search

value: search

value: search

value: search

index: 2
test script.test.action.assert:
  test script.setup.action.assert.expression:
    value: Bundle.entry.resource.ofType(MedicationRequest).exists()
  test script.setup.action.assert.warning only:
    value: false

index: 5
test script.test.name:
  value: SearchByPatient
test script.test.action:
  index: 0
  test script.test.action.operation:
    test script.setup.action.operation.type:
      coding.system:
        value: http://terminology.hl7.org/CodeSystem/testscript-operation-codes
      coding.code:
        value: search
    test script.setup.action.operation.resource:
      value: MedicationRequest
    test script.setup.action.operation.encode request url:
      value: true
    test script.setup.action.operation.params:
      value: ?patient=${patientId}
test script.test.action:
  index: 1
  test script.test.action.assert:
    test script.setup.action.assert.response:
      value: okay
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 2
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: Bundle.entry.resource.ofType(MedicationRequest).exists()
    test script.setup.action.assert.warning only:
      value: false

index: 6
test script.test.name:
  value: SearchWithIncludeMedication
test script.test.action:
  index: 0
  test script.test.action.operation:
    test script.setup.action.operation.type:
      coding.system:
        value: http://terminology.hl7.org/CodeSystem/testscript-operation-codes
      coding.code:
        value: search
    test script.setup.action.operation.resource:
      value: MedicationRequest
    test script.setup.action.operation.encode request url:
      value: true
    test script.setup.action.operation.params:
      value: ?patient=${patientId}&_include=MedicationRequest:medication
test script.test.action:
  index: 1
  test script.test.action.assert:
    test script.setup.action.assert.response:
      value: okay
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 2
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: Bundle.entry.resource.ofType(MedicationRequest).exists()
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 3
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: Bundle.entry.resource.ofType(Medication).exists()
    test script.setup.action.assert.warning only:
      value: false

index: 7
test script.test.name:
  value: MustSupport
test script.test.action:
  index: 0
  test script.test.action.operation:
    test script.setup.action.operation.type:
      coding.system:
        value: http://terminology.hl7.org/CodeSystem/testscript-operation-codes
      coding.code:
        value: read
    test script.setup.action.operation.resource:
      value: MedicationRequest
    test script.setup.action.operation.encode request url:
      value: true
    test script.setup.action.operation.params:
      value: /${medicationRequestId}
test script.test.action:
  index: 1
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: MedicationRequest.status.exists()
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 2
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: MedicationRequest.intent.exists()
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 3
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: MedicationRequest.medication.exists()
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 4
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: MedicationRequest.medication.ofType(Reference).exists()
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 5
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: MedicationRequest.subject.exists()
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 6
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: MedicationRequest.encounter.exists()
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 7
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: MedicationRequest.authoredOn.exists()
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 8
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: MedicationRequest.requester.exists()
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 9
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: MedicationRequest.reasonCode.exists()
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 10
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: MedicationRequest.reasonReference.exists()
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 11
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: MedicationRequest.dosageInstruction.exists()
    test script.setup.action.assert.warning only:
      value: false
test script.test.action:
  index: 12
  test script.test.action.assert:
    test script.setup.action.assert.expression:
      value: MedicationRequest.dosageInstruction.text.exists()
    test script.setup.action.assert.warning only:
      value: false

index: 8
test script.test.name:
  value: ProfileValidation
test script.test.action:
  index: 0
  test script.test.action.operation:
    test script.setup.action.operation.type:
      coding.system:
        value: http://terminology.hl7.org/CodeSystem/testscript-operation-codes
      coding.code:
        value: read
    test script.setup.action.operation.resource:
      value: MedicationRequest
    test script.setup.action.operation.encode request url:
      value: true
    test script.setup.action.operation.params:
      value: /${medicationRequestId}
test script.test.action:
  index: 1
  test script.test.action.assert:
    test script.setup.action.assert.validate profile id:
      value: http://hl7.org.au/fhir/core/StructureDefinition/au-core-medicationrequest
    test script.setup.action.assert.warning only:
      value: false