Testing IG
0.0.1 - CI Build
Testing IG, published by DBojicic. This guide is not an authorized publication; it is the continuous build for version 0.0.1 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/dbojicic/test-repo/ and changes regularly. See the Directory of published versions
This test series evaluates four candidate FHIRPath expressions for the AU Core MedicationRequest.authoredOn invariant au-core-medreq-01, raised in FHIR-59045.
The human readable invariant description is:
Date shall be precise to the day or, if not available, the Data Absent Reason extension shall be present
The tests evaluate whether each candidate expression:
MedicationRequest.authoredOn value to be precise to at least the dayMedicationRequest.authoredOn has no valueMedicationRequest.authoredOn in downstream profilesThis will be used to determine which expression correctly implements the human readable description without intentionally restricting downstream use and profiling choices around MedicationRequest.authoredOn and the use of DAR.
The following candidate expressions are tested:
| Series code | Candidate expression |
|---|---|
| ao-a | ($this.hasValue() and $this.toString().length() >= 10) or ($this.hasValue().not() and extension('http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists()) |
| ao-b | ($this.hasValue() implies $this.toString().length() >= 10) and ($this.hasValue().not() implies extension('http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists()) |
| ao-c | ($this.hasValue() and $this.toString().length() >= 10) xor extension('http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists() |
| ao-d | ($this.hasValue() implies ($this.toString().length() >= 10 and extension('http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists().not())) and ($this.hasValue().not() implies extension('http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists()) |
The purpose of this test series is to confirm which expression(s) correctly implement the human readable description, without unintentionally restricting downstream profiling choices around authoredOn cardinality or use of DAR. This will provide input into discussion about which of the correct expressions is preferable for AU Core.
Note: A FHIR primitive element can contain both a primitive value and extensions. The presence of a value and DAR on MedicationRequest.authoredOn should be considered when comparing the candidate expressions and any needed specific requirements built into the invariant expression.
The following table shows the expected result for each expression based on its FHIRPath logic:
| Scenario | ao-a | ao-b | ao-c | ao-d | What we want |
|---|---|---|---|---|---|
| Precise value only | Pass | Pass | Pass | Pass | Pass |
| Imprecise value only | Fail | Fail | Fail | Fail | Fail |
| DAR only | Pass | Pass | Pass | Pass | Pass |
| Other extension only, no DAR | Fail | Fail | Fail | Fail | Fail |
| Precise value + DAR | Pass | Pass | Fail | Fail | Fail |
| Imprecise value + DAR | Fail | Fail | Pass | Fail | Fail |
The differences from the expression logic:
These scenarios are tested first to confirm the expected behaviour of each candidate expression. TBD - derived profiles + full test matrix.
List of baseline profiles:
| Profile | Expression |
|---|---|
| au-core-medicationrequest-ao-a | ao-a |
| au-core-medicationrequest-ao-b | ao-b |
| au-core-medicationrequest-ao-c | ao-c |
| au-core-medicationrequest-ao-d | ao-d |
List of derived profiles:
List of baseline scenarios, to run against each profile:
| Scenario | What it does |
|---|---|
| Precise value only | valid value accepted |
| Imprecise value only, no DAR | enforced precision requriement |
| DAR only | DAR accepted |
| Other extension only, no DAR | DAR required when value is not present |
| DAR + other extension, no value | DAR requirement satisfied |
| Precise value + DAR | should have one or the other |
| Imprecise value + DAR | this shows issue with the xor expression - don't think AU Core wants to allow this |
| Precise value + other extension, no DAR | allowed, the invariant does not say anything about other extensions |
| Imprecise value + other extension, no DAR | enforced precision requriement |
| No authoredOn element | cardinality behavior |
The table below lists each test profile and its additional constraint, the test scenarios, expected validation results, and corresponding example instances.
| Profile | Constraint | Test scenario | Expected result | Example id |
|---|---|---|---|---|
| medicationrequest-ao-a | ($this.hasValue() and $this.toString().length() >= 10) or ($this.hasValue().not() and extension('http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists()) |
authoredOn value present, full datetime | Pass | MedicationRequest-ao-a-01 |
| authoredOn value present, date only (10 chars) | Pass | MedicationRequest-ao-a-02 | ||
| authoredOn value present, month only (7 chars) | Fail | MedicationRequest-ao-a-03 | ||
| authoredOn value present, year only (4 chars) | Fail | MedicationRequest-ao-a-04 | ||
| authoredOn value not present, DAR used instead | Pass | MedicationRequest-ao-a-05 | ||
| Other extension only, no value and no DAR | Fail | MedicationRequest-ao-a-06 | ||
| DAR + other extension, no value | Pass | MedicationRequest-ao-a-07 | ||
| authoredOn precise value present + DAR | Fail | MedicationRequest-ao-a-08 | ||
| authoredOn imprecise value present + DAR | Fail | MedicationRequest-ao-a-09 | ||
| authoredOn precise value present + other extension, no DAR | Pass | MedicationRequest-ao-a-10 | ||
| authoredOn imprecise value present + other extension, no DAR | Fail | MedicationRequest-ao-a-11 | ||
| No authoredOn element | Fail | MedicationRequest-ao-a-12 | ||
| medicationrequest-ao-b | ($this.hasValue() implies $this.toString().length() >= 10) and ($this.hasValue().not() implies extension('http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists()) |
authoredOn value present, full datetime | Pass | MedicationRequest-ao-b-01 |
| authoredOn value present, date only (10 chars) | Pass | MedicationRequest-ao-b-02 | ||
| authoredOn value present, month only (7 chars) | Fail | MedicationRequest-ao-b-03 | ||
| authoredOn value present, year only (4 chars) | Fail | MedicationRequest-ao-b-04 | ||
| authoredOn value not present, DAR used instead | Pass | MedicationRequest-ao-b-05 | ||
| Other extension only, no value and no DAR | Fail | MedicationRequest-ao-b-06 | ||
| DAR + other extension, no value | Pass | MedicationRequest-ao-b-07 | ||
| authoredOn precise value present + DAR | Fail | MedicationRequest-ao-b-08 | ||
| authoredOn imprecise value present + DAR | Fail | MedicationRequest-ao-b-09 | ||
| authoredOn precise value present + other extension, no DAR | Pass | MedicationRequest-ao-b-10 | ||
| authoredOn imprecise value present + other extension, no DAR | Fail | MedicationRequest-ao-b-11 | ||
| No authoredOn element | Fail | MedicationRequest-ao-b-12 | ||
| medicationrequest-ao-c | ($this.hasValue() and $this.toString().length() >= 10) xor extension('http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists() |
authoredOn value present, full datetime | Pass | MedicationRequest-ao-c-01 |
| authoredOn value present, date only (10 chars) | Pass | MedicationRequest-ao-c-02 | ||
| authoredOn value present, month only (7 chars) | Fail | MedicationRequest-ao-c-03 | ||
| authoredOn value present, year only (4 chars) | Fail | MedicationRequest-ao-c-04 | ||
| authoredOn value not present, DAR used instead | Pass | MedicationRequest-ao-c-05 | ||
| Other extension only, no value and no DAR | Fail | MedicationRequest-ao-c-06 | ||
| DAR + other extension, no value | Pass | MedicationRequest-ao-c-07 | ||
| authoredOn precise value present + DAR | Fail | MedicationRequest-ao-c-08 | ||
| authoredOn imprecise value present + DAR | Fail | MedicationRequest-ao-c-09 | ||
| authoredOn precise value present + other extension, no DAR | Pass | MedicationRequest-ao-c-10 | ||
| authoredOn imprecise value present + other extension, no DAR | Fail | MedicationRequest-ao-c-11 | ||
| No authoredOn element | Fail | MedicationRequest-ao-c-12 | ||
| medicationrequest-ao-d | ($this.hasValue() implies ($this.toString().length() >= 10 and extension('http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists().not())) and ($this.hasValue().not() implies extension('http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists()) |
authoredOn value present, full datetime | Pass | MedicationRequest-ao-d-01 |
| authoredOn value present, date only (10 chars) | Pass | MedicationRequest-ao-d-02 | ||
| authoredOn value present, month only (7 chars) | Fail | MedicationRequest-ao-d-03 | ||
| authoredOn value present, year only (4 chars) | Fail | MedicationRequest-ao-d-04 | ||
| authoredOn value not present, DAR used instead | Pass | MedicationRequest-ao-d-05 | ||
| Other extension only, no value and no DAR | Fail | MedicationRequest-ao-d-06 | ||
| DAR + other extension, no value | Pass | MedicationRequest-ao-d-07 | ||
| authoredOn precise value present + DAR | Fail | MedicationRequest-ao-d-08 | ||
| authoredOn imprecise value present + DAR | Fail | MedicationRequest-ao-d-09 | ||
| authoredOn precise value present + other extension, no DAR | Pass | MedicationRequest-ao-d-10 | ||
| authoredOn imprecise value present + other extension, no DAR | Fail | MedicationRequest-ao-d-11 | ||
| No authoredOn element | Fail | MedicationRequest-ao-d-12 | ||
| medicationrequest-ao-e | Derives from medicationrequest-ao-d and requires DAR | authoredOn value present, full datetime | Fail | MedicationRequest-ao-e-01 |
| authoredOn value present, date only (10 chars) | Fail | MedicationRequest-ao-e-02 | ||
| authoredOn value present, month only (7 chars) | Fail | MedicationRequest-ao-e-03 | ||
| authoredOn value present, year only (4 chars) | Fail | MedicationRequest-ao-e-04 | ||
| authoredOn value not present, DAR used instead | Pass | MedicationRequest-ao-e-05 | ||
| Other extension only, no value and no DAR | Fail | MedicationRequest-ao-e-06 | ||
| DAR + other extension, no value | Pass | MedicationRequest-ao-e-07 | ||
| authoredOn precise value present + DAR | Fail | MedicationRequest-ao-e-08 | ||
| authoredOn imprecise value present + DAR | Fail | MedicationRequest-ao-e-09 | ||
| authoredOn precise value present + other extension, no DAR | Fail | MedicationRequest-ao-e-10 | ||
| authoredOn imprecise value present + other extension, no DAR | Fail | MedicationRequest-ao-e-11 | ||
| No authoredOn element | Fail | MedicationRequest-ao-e-12 | ||
| medicationrequest-ao-f | Derives from medicationrequest-ao-d and requires authoredOn to have a value | authoredOn value present, full datetime | Pass | MedicationRequest-ao-f-01 |
| authoredOn value present, date only (10 chars) | Pass | MedicationRequest-ao-f-02 | ||
| authoredOn value present, month only (7 chars) | Fail | MedicationRequest-ao-f-03 | ||
| authoredOn value present, year only (4 chars) | Fail | MedicationRequest-ao-f-04 | ||
| authoredOn value not present, DAR used instead | Fail | MedicationRequest-ao-f-05 | ||
| Other extension only, no value and no DAR | Fail | MedicationRequest-ao-f-06 | ||
| DAR + other extension, no value | Fail | MedicationRequest-ao-f-07 | ||
| authoredOn precise value present + DAR | Fail | MedicationRequest-ao-f-08 | ||
| authoredOn imprecise value present + DAR | Fail | MedicationRequest-ao-f-09 | ||
| authoredOn precise value present + other extension, no DAR | Pass | MedicationRequest-ao-f-10 | ||
| authoredOn imprecise value present + other extension, no DAR | Fail | MedicationRequest-ao-f-11 | ||
| No authoredOn element | Fail | MedicationRequest-ao-f-12 |