FHIR © HL7.org  |  FHIRsmith 4.0.1  |  Server Home  |  XIG Home  |  XIG Stats  | 

FHIR IG analytics

Packagefhirfrog.au-core-tests
Resource TypeTestScript
IdTestScript-au-core-medicationrequest.json
FHIR VersionR4
Sourcehttps://build.fhir.org/ig/jgsuess/au-core-tests/TestScript-au-core-medicationrequest.html
URLhttp://fhirfrog.org/fhir/au-core-tests/TestScript/au-core-medicationrequest
Version0.1.0
Statusactive
Date2026-08-16T05:55:37+00:00
NameAUCoreMedicationRequest
TitleAU Core MedicationRequest — SHALL-level conformance
DescriptionCovers 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 FHIRPathEngine (ca.uhn.fhir newFhirPath(), used by fhir-frog's assertion evaluator) does not resolve the suffixed choice-type accessor form (e.g. `medicationReference`) as a property name on a resource instance — only the base choice name (`medication`) or an explicit `.ofType(Reference)`/`as Reference` filter on it work. The MustSupport test below therefore asserts `MedicationRequest.medication.ofType(Reference).exists()` rather than `MedicationRequest.medicationReference.exists()` to check the specific slice actually populated by the fixture.

Resources that use this resource

No resources found


Resources that this resource uses

No resources found


Narrative

Note: links and images are rebased to the (stated) source

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 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 FHIRPathEngine (ca.uhn.fhir newFhirPath(), used by fhir-frog's assertion evaluator) does not resolve the suffixed choice-type accessor form (e.g. medicationReference) as a property name on a resource instance — only the base choice name (medication) or an explicit .ofType(Reference)/as Reference filter on it work. The MustSupport test below therefore asserts MedicationRequest.medication.ofType(Reference).exists() rather than MedicationRequest.medicationReference.exists() to check the specific slice actually populated by the fixture.

fixture

id

patient-fixture

autocreate: true

autodelete: true

resource: au-core-patient-conformant

fixture

id

medication-fixture

autocreate: true

autodelete: true

resource: au-core-medicationrequest-medication

fixture

id

medicationrequest-fixture

autocreate: true

autodelete: true

resource: au-core-medicationrequest-conformant

variable

name: patientId

path: Patient.id

sourceId: patient-fixture

variable

name: medicationRequestId

path: MedicationRequest.id

sourceId: medicationrequest-fixture

test

name: Read

action

Operations

-TypeResourceEncodeRequestUrlParams
*Test script operation code: read (Read)MedicationRequesttrue/${medicationRequestId}

action

Asserts

-ResponseWarningOnly
*okayfalse

test

name: SearchById

action

Operations

-TypeResourceEncodeRequestUrlParams
*Test script operation code: search (Search)MedicationRequesttrue?_id=${medicationRequestId}

action

Asserts

-ResponseWarningOnly
*okayfalse

action

Asserts

-ExpressionWarningOnly
*Bundle.entry.resource.ofType(MedicationRequest).exists()false

test

name: SearchByAuthoredOn

action

Operations

-TypeResourceEncodeRequestUrlParams
*Test script operation code: search (Search)MedicationRequesttrue?authoredon=2024-03-15

action

Asserts

-ResponseWarningOnly
*okayfalse

action

Asserts

-ExpressionWarningOnly
*Bundle.entry.resource.ofType(MedicationRequest).exists()false

test

name: SearchByIntent

action

Operations

-TypeResourceEncodeRequestUrlParams
*Test script operation code: search (Search)MedicationRequesttrue?intent=order

action

Asserts

-ResponseWarningOnly
*okayfalse

action

Asserts

-ExpressionWarningOnly
*Bundle.entry.resource.ofType(MedicationRequest).exists()false

test

name: SearchByStatus

action

Operations

-TypeResourceEncodeRequestUrlParams
*Test script operation code: search (Search)MedicationRequesttrue?status=active

action

Asserts

-ResponseWarningOnly
*okayfalse

action

Asserts

-ExpressionWarningOnly
*Bundle.entry.resource.ofType(MedicationRequest).exists()false

test

name: SearchByPatient

action

Operations

-TypeResourceEncodeRequestUrlParams
*Test script operation code: search (Search)MedicationRequesttrue?patient=${patientId}

action

Asserts

-ResponseWarningOnly
*okayfalse

action

Asserts

-ExpressionWarningOnly
*Bundle.entry.resource.ofType(MedicationRequest).exists()false

test

name: SearchWithIncludeMedication

action

Operations

-TypeResourceEncodeRequestUrlParams
*Test script operation code: search (Search)MedicationRequesttrue?patient=${patientId}&_include=MedicationRequest:medication

action

Asserts

-ResponseWarningOnly
*okayfalse

action

Asserts

-ExpressionWarningOnly
*Bundle.entry.resource.ofType(MedicationRequest).exists()false

action

Asserts

-ExpressionWarningOnly
*Bundle.entry.resource.ofType(Medication).exists()false

test

name: MustSupport

action

Operations

-TypeResourceEncodeRequestUrlParams
*Test script operation code: read (Read)MedicationRequesttrue/${medicationRequestId}

action

Asserts

-ExpressionWarningOnly
*MedicationRequest.status.exists()false

action

Asserts

-ExpressionWarningOnly
*MedicationRequest.intent.exists()false

action

Asserts

-ExpressionWarningOnly
*MedicationRequest.medication.exists()false

action

Asserts

-ExpressionWarningOnly
*MedicationRequest.medication.ofType(Reference).exists()false

action

Asserts

-ExpressionWarningOnly
*MedicationRequest.subject.exists()false

action

Asserts

-ExpressionWarningOnly
*MedicationRequest.encounter.exists()false

action

Asserts

-ExpressionWarningOnly
*MedicationRequest.authoredOn.exists()false

action

Asserts

-ExpressionWarningOnly
*MedicationRequest.requester.exists()false

action

Asserts

-ExpressionWarningOnly
*MedicationRequest.reasonCode.exists()false

action

Asserts

-ExpressionWarningOnly
*MedicationRequest.reasonReference.exists()false

action

Asserts

-ExpressionWarningOnly
*MedicationRequest.dosageInstruction.exists()false

action

Asserts

-ExpressionWarningOnly
*MedicationRequest.dosageInstruction.text.exists()false

test

name: ProfileValidation

action

Operations

-TypeResourceEncodeRequestUrlParams
*Test script operation code: read (Read)MedicationRequesttrue/${medicationRequestId}

action

Asserts

-ValidateProfileIdWarningOnly
*http://hl7.org.au/fhir/core/StructureDefinition/au-core-medicationrequestfalse

Source1

{
  "resourceType": "TestScript",
  "id": "au-core-medicationrequest",
  "text": {
    "status": "generated",
    "div": "<!-- snip (see above) -->"
  },
  "url": "http://fhirfrog.org/fhir/au-core-tests/TestScript/au-core-medicationrequest",
  "version": "0.1.0",
  "name": "AUCoreMedicationRequest",
  "title": "AU Core MedicationRequest — SHALL-level conformance",
  "status": "active",
  "date": "2026-08-16T05:55:37+00:00",
  "publisher": "FHIR Frog",
  "contact": [
    {
      "name": "FHIR Frog",
      "telecom": [
        {
          "system": "url",
          "value": "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 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 FHIRPathEngine (ca.uhn.fhir newFhirPath(), used by fhir-frog's assertion evaluator) does not resolve the suffixed choice-type accessor form (e.g. `medicationReference`) as a property name on a resource instance — only the base choice name (`medication`) or an explicit `.ofType(Reference)`/`as Reference` filter on it work. The MustSupport test below therefore asserts `MedicationRequest.medication.ofType(Reference).exists()` rather than `MedicationRequest.medicationReference.exists()` to check the specific slice actually populated by the fixture.",
  "fixture": [
    {
      "id": "patient-fixture",
      "autocreate": true,
      "autodelete": true,
      "resource": {
        "reference": "au-core-patient-conformant"
      }
    },
    {
      "id": "medication-fixture",
      "autocreate": true,
      "autodelete": true,
      "resource": {
        "reference": "au-core-medicationrequest-medication"
      }
    },
    {
      "id": "medicationrequest-fixture",
      "autocreate": true,
      "autodelete": true,
      "resource": {
        "reference": "au-core-medicationrequest-conformant"
      }
    }
  ],
  "variable": [
    {
      "name": "patientId",
      "path": "Patient.id",
      "sourceId": "patient-fixture"
    },
    {
      "name": "medicationRequestId",
      "path": "MedicationRequest.id",
      "sourceId": "medicationrequest-fixture"
    }
  ],
  "test": [
    {
      "name": "Read",
      "action": [
        {
          "operation": {
            "type": {
              "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes",
              "code": "read"
            },
            "resource": "MedicationRequest",
            "encodeRequestUrl": true,
            "params": "/${medicationRequestId}"
          }
        },
        {
          "assert": {
            "response": "okay",
            "warningOnly": false
          }
        }
      ]
    },
    {
      "name": "SearchById",
      "action": [
        {
          "operation": {
            "type": {
              "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes",
              "code": "search"
            },
            "resource": "MedicationRequest",
            "encodeRequestUrl": true,
            "params": "?_id=${medicationRequestId}"
          }
        },
        {
          "assert": {
            "response": "okay",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "Bundle.entry.resource.ofType(MedicationRequest).exists()",
            "warningOnly": false
          }
        }
      ]
    },
    {
      "name": "SearchByAuthoredOn",
      "action": [
        {
          "operation": {
            "type": {
              "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes",
              "code": "search"
            },
            "resource": "MedicationRequest",
            "encodeRequestUrl": true,
            "params": "?authoredon=2024-03-15"
          }
        },
        {
          "assert": {
            "response": "okay",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "Bundle.entry.resource.ofType(MedicationRequest).exists()",
            "warningOnly": false
          }
        }
      ]
    },
    {
      "name": "SearchByIntent",
      "action": [
        {
          "operation": {
            "type": {
              "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes",
              "code": "search"
            },
            "resource": "MedicationRequest",
            "encodeRequestUrl": true,
            "params": "?intent=order"
          }
        },
        {
          "assert": {
            "response": "okay",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "Bundle.entry.resource.ofType(MedicationRequest).exists()",
            "warningOnly": false
          }
        }
      ]
    },
    {
      "name": "SearchByStatus",
      "action": [
        {
          "operation": {
            "type": {
              "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes",
              "code": "search"
            },
            "resource": "MedicationRequest",
            "encodeRequestUrl": true,
            "params": "?status=active"
          }
        },
        {
          "assert": {
            "response": "okay",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "Bundle.entry.resource.ofType(MedicationRequest).exists()",
            "warningOnly": false
          }
        }
      ]
    },
    {
      "name": "SearchByPatient",
      "action": [
        {
          "operation": {
            "type": {
              "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes",
              "code": "search"
            },
            "resource": "MedicationRequest",
            "encodeRequestUrl": true,
            "params": "?patient=${patientId}"
          }
        },
        {
          "assert": {
            "response": "okay",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "Bundle.entry.resource.ofType(MedicationRequest).exists()",
            "warningOnly": false
          }
        }
      ]
    },
    {
      "name": "SearchWithIncludeMedication",
      "action": [
        {
          "operation": {
            "type": {
              "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes",
              "code": "search"
            },
            "resource": "MedicationRequest",
            "encodeRequestUrl": true,
            "params": "?patient=${patientId}&_include=MedicationRequest:medication"
          }
        },
        {
          "assert": {
            "response": "okay",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "Bundle.entry.resource.ofType(MedicationRequest).exists()",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "Bundle.entry.resource.ofType(Medication).exists()",
            "warningOnly": false
          }
        }
      ]
    },
    {
      "name": "MustSupport",
      "action": [
        {
          "operation": {
            "type": {
              "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes",
              "code": "read"
            },
            "resource": "MedicationRequest",
            "encodeRequestUrl": true,
            "params": "/${medicationRequestId}"
          }
        },
        {
          "assert": {
            "expression": "MedicationRequest.status.exists()",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "MedicationRequest.intent.exists()",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "MedicationRequest.medication.exists()",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "MedicationRequest.medication.ofType(Reference).exists()",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "MedicationRequest.subject.exists()",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "MedicationRequest.encounter.exists()",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "MedicationRequest.authoredOn.exists()",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "MedicationRequest.requester.exists()",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "MedicationRequest.reasonCode.exists()",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "MedicationRequest.reasonReference.exists()",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "MedicationRequest.dosageInstruction.exists()",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "expression": "MedicationRequest.dosageInstruction.text.exists()",
            "warningOnly": false
          }
        }
      ]
    },
    {
      "name": "ProfileValidation",
      "action": [
        {
          "operation": {
            "type": {
              "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes",
              "code": "read"
            },
            "resource": "MedicationRequest",
            "encodeRequestUrl": true,
            "params": "/${medicationRequestId}"
          }
        },
        {
          "assert": {
            "validateProfileId": "http://hl7.org.au/fhir/core/StructureDefinition/au-core-medicationrequest",
            "warningOnly": false
          }
        }
      ]
    }
  ]
}