From ef593a7628329a6cdddc4d91adc4d3379bec6eb8 Mon Sep 17 00:00:00 2001 From: Josh Mandel Date: Thu, 28 May 2026 17:29:57 -0500 Subject: [PATCH] Fix faulty invariant FHIRPath expressions and add regression fixtures Corrects invariant expressions whose FHIRPath does not match the rule's stated intent under the validator's evaluation semantics (a constraint passes only if its expression converts to boolean true; false, empty {}, and runtime errors all fail). Each behavioral fix ships a new invariant-test fixture that flips verdict between the old and new expression. Fixes, by class: - Single-value operators (=, !=, in) on repeating elements: bdl-14, bdl-16, csd-3, csd-6, pld-3 - count()/exists() aggregated across all repeats instead of per item: isl-7, isl-8, isl-10, isl-11 - xor used for "mutually exclusive" (wrongly forbids "neither"): mrp-3, mrp-4 - Unanchored matches() (partial match): exp-2, que-16, qrs-3; eld-12 (missing ':') - Tree-walk that skips a level: csd-1, qrs-2 - .exists() where a value is required (extension-only primitive): eld-21 - Representation pitfalls: cnt-3 (5.0 toString), bdl-7 (delimiterless key) - Inverted/over-strict logic: drt-1 - Clause referencing a non-existent element: pld-6, adf-2 - Obsolete element names (reasonCode/reasonReference -> reason): inv-2 - Wrong literal token ('uri' -> 'url'): que-5, que-5b - Antecedent guards the wrong element (series vs series.instance): ist-4 - Human text corrected, expression already correct: bdl-3b, docRef-2 Deferred (identified, not included): dgr-1 (needs resolve()-context verification), cmp-3 (needs structural re-anchor from .section to the resource), tst-1/tst-2/tst-3 (3-way chained xor; authored in a binary spreadsheet, not editable here). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../invariant-tests/adf-2.p1.pass.json | 13 +++++++ ...structuredefinition-ActivityDefinition.xml | 2 +- .../invariant-tests/bdl-14.f2.fail.json | 30 ++++++++++++++++ .../invariant-tests/bdl-16.p2.pass.json | 24 +++++++++++++ .../bundle/invariant-tests/bdl-7.p1.pass.json | 34 +++++++++++++++++++ source/bundle/structuredefinition-Bundle.xml | 8 ++--- .../invariant-tests/csd-1.f2.fail.json | 16 +++++++++ .../invariant-tests/csd-3.f3.fail.json | 34 +++++++++++++++++++ .../invariant-tests/csd-6.p2.pass.json | 9 +++++ .../structuredefinition-CodeSystem.xml | 6 ++-- source/datatypes/count.xml | 2 +- source/datatypes/duration.xml | 2 +- source/datatypes/elementdefinition.xml | 4 +-- source/datatypes/expression.xml | 2 +- .../structuredefinition-DocumentReference.xml | 2 +- source/event/event-spreadsheet.xml | 2 +- .../invariant-tests/isl-10.p1.pass.json | 23 +++++++++++++ .../invariant-tests/isl-11.f2.fail.json | 23 +++++++++++++ .../invariant-tests/isl-7.f2.fail.json | 32 +++++++++++++++++ .../invariant-tests/isl-8.f2.fail.json | 28 +++++++++++++++ .../structuredefinition-ImagingSelection.xml | 8 ++--- .../invariant-tests/ist-4.p1.pass.json | 21 ++++++++++++ .../structuredefinition-ImagingStudy.xml | 2 +- .../invariant-tests/mrp-3.p1.pass.json | 21 ++++++++++++ .../invariant-tests/mrp-4.p1.pass.json | 29 ++++++++++++++++ .../structuredefinition-MeasureReport.xml | 4 +-- .../invariant-tests/cnt-3.p1.pass.json | 6 ++++ .../invariant-tests/drt-1.f1.fail.json | 11 ++++++ .../invariant-tests/drt-1.p1.pass.json | 12 +++++++ .../invariant-tests/exp-2.f1.fail.json | 19 +++++++++++ .../invariant-tests/pld-3.p1.pass.json | 27 +++++++++++++++ .../invariant-tests/pld-6.p1.pass.json | 13 +++++++ .../structuredefinition-PlanDefinition.xml | 4 +-- .../invariant-tests/que-16.f1.fail.json | 10 ++++++ .../invariant-tests/que-5.p1.pass.json | 15 ++++++++ .../invariant-tests/que-5b.p1.pass.json | 11 ++++++ .../structuredefinition-Questionnaire.xml | 8 ++--- .../invariant-tests/qrs-2.f1.fail.json | 27 +++++++++++++++ .../invariant-tests/qrs-3.f1.fail.json | 9 +++++ ...ucturedefinition-QuestionnaireResponse.xml | 4 +-- .../invariant-tests/eld-12.f1.fail.json | 23 +++++++++++++ .../invariant-tests/eld-21.f1.fail.json | 34 +++++++++++++++++++ 42 files changed, 584 insertions(+), 30 deletions(-) create mode 100644 source/activitydefinition/invariant-tests/adf-2.p1.pass.json create mode 100644 source/bundle/invariant-tests/bdl-14.f2.fail.json create mode 100644 source/bundle/invariant-tests/bdl-16.p2.pass.json create mode 100644 source/bundle/invariant-tests/bdl-7.p1.pass.json create mode 100644 source/codesystem/invariant-tests/csd-1.f2.fail.json create mode 100644 source/codesystem/invariant-tests/csd-3.f3.fail.json create mode 100644 source/codesystem/invariant-tests/csd-6.p2.pass.json create mode 100644 source/imagingselection/invariant-tests/isl-10.p1.pass.json create mode 100644 source/imagingselection/invariant-tests/isl-11.f2.fail.json create mode 100644 source/imagingselection/invariant-tests/isl-7.f2.fail.json create mode 100644 source/imagingselection/invariant-tests/isl-8.f2.fail.json create mode 100644 source/imagingstudy/invariant-tests/ist-4.p1.pass.json create mode 100644 source/measurereport/invariant-tests/mrp-3.p1.pass.json create mode 100644 source/measurereport/invariant-tests/mrp-4.p1.pass.json create mode 100644 source/parameters/invariant-tests/cnt-3.p1.pass.json create mode 100644 source/parameters/invariant-tests/drt-1.f1.fail.json create mode 100644 source/parameters/invariant-tests/drt-1.p1.pass.json create mode 100644 source/plandefinition/invariant-tests/exp-2.f1.fail.json create mode 100644 source/plandefinition/invariant-tests/pld-3.p1.pass.json create mode 100644 source/plandefinition/invariant-tests/pld-6.p1.pass.json create mode 100644 source/questionnaire/invariant-tests/que-16.f1.fail.json create mode 100644 source/questionnaire/invariant-tests/que-5.p1.pass.json create mode 100644 source/questionnaire/invariant-tests/que-5b.p1.pass.json create mode 100644 source/questionnaireresponse/invariant-tests/qrs-2.f1.fail.json create mode 100644 source/questionnaireresponse/invariant-tests/qrs-3.f1.fail.json create mode 100644 source/structuredefinition/invariant-tests/eld-12.f1.fail.json create mode 100644 source/structuredefinition/invariant-tests/eld-21.f1.fail.json diff --git a/source/activitydefinition/invariant-tests/adf-2.p1.pass.json b/source/activitydefinition/invariant-tests/adf-2.p1.pass.json new file mode 100644 index 00000000000..98a348270d6 --- /dev/null +++ b/source/activitydefinition/invariant-tests/adf-2.p1.pass.json @@ -0,0 +1,13 @@ +{ + "resourceType": "ActivityDefinition", + "status": "active", + "relatedArtifact": [ + { + "type": "depends-on", + "resource": "http://x/Library/a", + "resourceReference": { + "reference": "Library/a" + } + } + ] +} diff --git a/source/activitydefinition/structuredefinition-ActivityDefinition.xml b/source/activitydefinition/structuredefinition-ActivityDefinition.xml index d208689589e..c2fc4fad9f8 100644 --- a/source/activitydefinition/structuredefinition-ActivityDefinition.xml +++ b/source/activitydefinition/structuredefinition-ActivityDefinition.xml @@ -830,7 +830,7 @@ - + diff --git a/source/bundle/invariant-tests/bdl-14.f2.fail.json b/source/bundle/invariant-tests/bdl-14.f2.fail.json new file mode 100644 index 00000000000..17a9dd1802f --- /dev/null +++ b/source/bundle/invariant-tests/bdl-14.f2.fail.json @@ -0,0 +1,30 @@ +{ + "resourceType": "Bundle", + "type": "history", + "entry": [ + { + "fullUrl": "http://x/Patient/1", + "request": { + "method": "GET", + "url": "Patient/1" + }, + "response": { + "status": "200" + } + }, + { + "fullUrl": "http://x/Patient/2", + "request": { + "method": "PATCH", + "url": "Patient/2" + }, + "resource": { + "resourceType": "Patient", + "id": "2" + }, + "response": { + "status": "200" + } + } + ] +} diff --git a/source/bundle/invariant-tests/bdl-16.p2.pass.json b/source/bundle/invariant-tests/bdl-16.p2.pass.json new file mode 100644 index 00000000000..3b4c00886bf --- /dev/null +++ b/source/bundle/invariant-tests/bdl-16.p2.pass.json @@ -0,0 +1,24 @@ +{ + "resourceType": "Bundle", + "type": "batch-response", + "entry": [ + { + "response": { + "status": "200" + } + } + ], + "issues": { + "resourceType": "OperationOutcome", + "issue": [ + { + "severity": "warning", + "code": "informational" + }, + { + "severity": "warning", + "code": "informational" + } + ] + } +} diff --git a/source/bundle/invariant-tests/bdl-7.p1.pass.json b/source/bundle/invariant-tests/bdl-7.p1.pass.json new file mode 100644 index 00000000000..6e3a9f61bee --- /dev/null +++ b/source/bundle/invariant-tests/bdl-7.p1.pass.json @@ -0,0 +1,34 @@ +{ + "resourceType": "Bundle", + "type": "collection", + "entry": [ + { + "fullUrl": "http://x/Observation/123", + "resource": { + "resourceType": "Observation", + "id": "123", + "status": "final", + "code": { + "text": "t" + }, + "meta": { + "versionId": "4" + } + } + }, + { + "fullUrl": "http://x/Observation/12", + "resource": { + "resourceType": "Observation", + "id": "12", + "status": "final", + "code": { + "text": "t" + }, + "meta": { + "versionId": "34" + } + } + } + ] +} diff --git a/source/bundle/structuredefinition-Bundle.xml b/source/bundle/structuredefinition-Bundle.xml index f070fd3dd17..1c4a83e24b8 100644 --- a/source/bundle/structuredefinition-Bundle.xml +++ b/source/bundle/structuredefinition-Bundle.xml @@ -107,7 +107,7 @@ - + @@ -129,7 +129,7 @@ - + @@ -171,7 +171,7 @@ - + @@ -185,7 +185,7 @@ - + diff --git a/source/codesystem/invariant-tests/csd-1.f2.fail.json b/source/codesystem/invariant-tests/csd-1.f2.fail.json new file mode 100644 index 00000000000..84909ab93cd --- /dev/null +++ b/source/codesystem/invariant-tests/csd-1.f2.fail.json @@ -0,0 +1,16 @@ +{ + "resourceType": "CodeSystem", + "url": "http://example.org/cs/csd1nested", + "status": "draft", + "content": "complete", + "concept": [ + { + "code": "parent", + "concept": [ + { + "code": "parent" + } + ] + } + ] +} diff --git a/source/codesystem/invariant-tests/csd-3.f3.fail.json b/source/codesystem/invariant-tests/csd-3.f3.fail.json new file mode 100644 index 00000000000..4f7b926825e --- /dev/null +++ b/source/codesystem/invariant-tests/csd-3.f3.fail.json @@ -0,0 +1,34 @@ +{ + "resourceType": "CodeSystem", + "url": "http://example.org/cs/csd3", + "status": "draft", + "content": "complete", + "property": [ + { + "code": "parent", + "type": "code" + }, + { + "code": "status", + "type": "string" + } + ], + "concept": [ + { + "code": "root" + }, + { + "code": "c1", + "property": [ + { + "code": "status", + "valueString": "a" + }, + { + "code": "parent", + "valueCode": "root" + } + ] + } + ] +} diff --git a/source/codesystem/invariant-tests/csd-6.p2.pass.json b/source/codesystem/invariant-tests/csd-6.p2.pass.json new file mode 100644 index 00000000000..014ee3fbfde --- /dev/null +++ b/source/codesystem/invariant-tests/csd-6.p2.pass.json @@ -0,0 +1,9 @@ +{ + "resourceType": "CodeSystem", "url": "http://example.org/cs/csd6-multi", "status": "draft", + "caseSensitive": true, "content": "complete", + "concept": [ + { "code": "A", "property": [ { "code": "alternateCode", "valueCode": "B" } ] }, + { "code": "B", "property": [ { "code": "alternateCode", "valueCode": "A" }, { "code": "alternateCode", "valueCode": "C" } ] }, + { "code": "C", "property": [ { "code": "alternateCode", "valueCode": "B" } ] } + ] +} diff --git a/source/codesystem/structuredefinition-CodeSystem.xml b/source/codesystem/structuredefinition-CodeSystem.xml index 6e1603902ff..06ec615ae6c 100644 --- a/source/codesystem/structuredefinition-CodeSystem.xml +++ b/source/codesystem/structuredefinition-CodeSystem.xml @@ -92,7 +92,7 @@ - + @@ -106,7 +106,7 @@ - + @@ -881,7 +881,7 @@ - + diff --git a/source/datatypes/count.xml b/source/datatypes/count.xml index ba6630429b2..502860b60d9 100644 --- a/source/datatypes/count.xml +++ b/source/datatypes/count.xml @@ -3209,7 +3209,7 @@ Count There SHALL be a code with a value of "1" if there is a value. If system is present, it SHALL be UCUM. If present, the value SHALL be a whole number. - (code.exists() or value.empty()) and (system.empty() or system = %ucum) and (code.empty() or code = '1') and (value.empty() or value.hasValue().not() or value.toString().contains('.').not()) and (value.empty() or value.hasValue().not() or value >= 0) + (code.exists() or value.empty()) and (system.empty() or system = %ucum) and (code.empty() or code = '1') and (value.empty() or value.hasValue().not() or value = value.round()) and (value.empty() or value.hasValue().not() or value >= 0) (f:code or not(f:value)) and (not(exists(f:system)) or (f:system/@value='http://unitsofmeasure.org' and f:code/@value='1')) and not(contains(f:value/@value, '.')) diff --git a/source/datatypes/duration.xml b/source/datatypes/duration.xml index 5ff9017279e..c1c1dcf0564 100644 --- a/source/datatypes/duration.xml +++ b/source/datatypes/duration.xml @@ -3302,7 +3302,7 @@ Duration There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM. - code.exists() implies ((system = %ucum) and value.exists()) + (value.exists() implies code.exists()) and (system.exists() implies system = %ucum) (f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org') diff --git a/source/datatypes/elementdefinition.xml b/source/datatypes/elementdefinition.xml index f2b8d45d0a6..7813162dc90 100644 --- a/source/datatypes/elementdefinition.xml +++ b/source/datatypes/elementdefinition.xml @@ -4699,7 +4699,7 @@ ElementDefinition.binding ValueSet SHALL start with http:// or https:// or urn: or # - valueSet.exists() implies (valueSet.startsWith('http:') or valueSet.startsWith('https') or valueSet.startsWith('urn:') or valueSet.startsWith('#')) + valueSet.exists() implies (valueSet.startsWith('http:') or valueSet.startsWith('https:') or valueSet.startsWith('urn:') or valueSet.startsWith('#')) (starts-with(string(f:valueSet/@value), 'http:') or starts-with(string(f:valueSet/@value), 'https:') or starts-with(string(f:valueSet/@value), 'urn:') or starts-with(string(f:valueSet/@value), 'x')) @@ -4789,7 +4789,7 @@ ElementDefinition.constraint Constraints should have an expression or else validators will not be able to enforce them - expression.exists() + expression.hasValue() exists(f:expression/@value) diff --git a/source/datatypes/expression.xml b/source/datatypes/expression.xml index d3a44ce5ff9..311a4364356 100644 --- a/source/datatypes/expression.xml +++ b/source/datatypes/expression.xml @@ -3457,7 +3457,7 @@ error Expression The name must be a valid variable name in most computer languages - name.hasValue() implies name.matches('[A-Za-z][A-Za-z0-9\\_]{0,63}') + name.hasValue() implies name.matches('^[A-Za-z][A-Za-z0-9\\_]{0,63}$') exists(f:expression) or exists(f:reference) diff --git a/source/documentreference/structuredefinition-DocumentReference.xml b/source/documentreference/structuredefinition-DocumentReference.xml index 5c8d722ed2e..e77fc8146c3 100644 --- a/source/documentreference/structuredefinition-DocumentReference.xml +++ b/source/documentreference/structuredefinition-DocumentReference.xml @@ -106,7 +106,7 @@ - + diff --git a/source/event/event-spreadsheet.xml b/source/event/event-spreadsheet.xml index 8f3ffa7de19..7d233ea4366 100644 --- a/source/event/event-spreadsheet.xml +++ b/source/event/event-spreadsheet.xml @@ -1762,7 +1762,7 @@ Event reason elements can only be specified if status is NOT 'not-done' - status!='not-done' or (reasonCode.exists().not() and reasonReference.exists().not()) + status!='not-done' or reason.exists().not() not(f:status/@value='not-done') or not(exists(f:reasonCode) or exists(f:reasonReference)) diff --git a/source/imagingselection/invariant-tests/isl-10.p1.pass.json b/source/imagingselection/invariant-tests/isl-10.p1.pass.json new file mode 100644 index 00000000000..6b48659f68c --- /dev/null +++ b/source/imagingselection/invariant-tests/isl-10.p1.pass.json @@ -0,0 +1,23 @@ +{ + "resourceType": "ImagingSelection", + "status": "available", + "code": { + "text": "s" + }, + "instance": [ + { + "uid": "a", + "frameNumber": [ + 1, + 2, + 3 + ] + }, + { + "uid": "b", + "segmentNumber": [ + 1 + ] + } + ] +} diff --git a/source/imagingselection/invariant-tests/isl-11.f2.fail.json b/source/imagingselection/invariant-tests/isl-11.f2.fail.json new file mode 100644 index 00000000000..c513c1f7e53 --- /dev/null +++ b/source/imagingselection/invariant-tests/isl-11.f2.fail.json @@ -0,0 +1,23 @@ +{ + "resourceType": "ImagingSelection", + "status": "available", + "code": { + "text": "r" + }, + "instance": [ + { + "uid": "a", + "waveFormChannel": [ + 1 + ] + }, + { + "uid": "b", + "waveFormChannel": [ + 1, + 2, + 3 + ] + } + ] +} diff --git a/source/imagingselection/invariant-tests/isl-7.f2.fail.json b/source/imagingselection/invariant-tests/isl-7.f2.fail.json new file mode 100644 index 00000000000..d6127647db1 --- /dev/null +++ b/source/imagingselection/invariant-tests/isl-7.f2.fail.json @@ -0,0 +1,32 @@ +{ + "resourceType": "ImagingSelection", + "status": "available", + "code": { + "text": "r" + }, + "instance": [ + { + "uid": "i", + "imageRegion2D": [ + { + "regionType": "polyline", + "coordinate": [ + 0.1, + 0.2, + 0.3 + ] + }, + { + "regionType": "polyline", + "coordinate": [ + 0.1, + 0.2, + 0.3, + 0.4, + 0.5 + ] + } + ] + } + ] +} diff --git a/source/imagingselection/invariant-tests/isl-8.f2.fail.json b/source/imagingselection/invariant-tests/isl-8.f2.fail.json new file mode 100644 index 00000000000..651785984c5 --- /dev/null +++ b/source/imagingselection/invariant-tests/isl-8.f2.fail.json @@ -0,0 +1,28 @@ +{ + "resourceType": "ImagingSelection", + "status": "available", + "code": { + "text": "r" + }, + "imageRegion3D": [ + { + "regionType": "polygon", + "coordinate": [ + 1, + 2, + 3, + 4 + ] + }, + { + "regionType": "polygon", + "coordinate": [ + 1, + 2, + 3, + 4, + 5 + ] + } + ] +} diff --git a/source/imagingselection/structuredefinition-ImagingSelection.xml b/source/imagingselection/structuredefinition-ImagingSelection.xml index ac810d99e43..f63f7f3ba95 100644 --- a/source/imagingselection/structuredefinition-ImagingSelection.xml +++ b/source/imagingselection/structuredefinition-ImagingSelection.xml @@ -126,14 +126,14 @@ - + - + @@ -149,14 +149,14 @@ - + - + diff --git a/source/imagingstudy/invariant-tests/ist-4.p1.pass.json b/source/imagingstudy/invariant-tests/ist-4.p1.pass.json new file mode 100644 index 00000000000..23388e413dd --- /dev/null +++ b/source/imagingstudy/invariant-tests/ist-4.p1.pass.json @@ -0,0 +1,21 @@ +{ + "resourceType": "ImagingStudy", + "status": "available", + "subject": { + "reference": "Patient/x" + }, + "numberOfInstances": 5, + "series": [ + { + "uid": "1.2.3", + "modality": { + "coding": [ + { + "system": "http://dicom.nema.org/resources/ontology/DCM", + "code": "CT" + } + ] + } + } + ] +} diff --git a/source/imagingstudy/structuredefinition-ImagingStudy.xml b/source/imagingstudy/structuredefinition-ImagingStudy.xml index a230d0e8571..c2e58f17672 100644 --- a/source/imagingstudy/structuredefinition-ImagingStudy.xml +++ b/source/imagingstudy/structuredefinition-ImagingStudy.xml @@ -110,7 +110,7 @@ - + diff --git a/source/measurereport/invariant-tests/mrp-3.p1.pass.json b/source/measurereport/invariant-tests/mrp-3.p1.pass.json new file mode 100644 index 00000000000..2523d661928 --- /dev/null +++ b/source/measurereport/invariant-tests/mrp-3.p1.pass.json @@ -0,0 +1,21 @@ +{ + "resourceType": "MeasureReport", + "status": "complete", + "type": "individual", + "measure": "http://x/Measure/m", + "period": { + "start": "2013-01-01", + "end": "2013-12-31" + }, + "group": [ + { + "population": [ + { + "code": { + "text": "initial-population" + } + } + ] + } + ] +} diff --git a/source/measurereport/invariant-tests/mrp-4.p1.pass.json b/source/measurereport/invariant-tests/mrp-4.p1.pass.json new file mode 100644 index 00000000000..a3541f01342 --- /dev/null +++ b/source/measurereport/invariant-tests/mrp-4.p1.pass.json @@ -0,0 +1,29 @@ +{ + "resourceType": "MeasureReport", + "status": "complete", + "type": "individual", + "measure": "http://x/Measure/m", + "period": { + "start": "2013-01-01", + "end": "2013-12-31" + }, + "group": [ + { + "stratifier": [ + { + "stratum": [ + { + "population": [ + { + "code": { + "text": "numerator" + } + } + ] + } + ] + } + ] + } + ] +} diff --git a/source/measurereport/structuredefinition-MeasureReport.xml b/source/measurereport/structuredefinition-MeasureReport.xml index 62504280ebd..3bad82846c4 100644 --- a/source/measurereport/structuredefinition-MeasureReport.xml +++ b/source/measurereport/structuredefinition-MeasureReport.xml @@ -662,7 +662,7 @@ - + @@ -1104,7 +1104,7 @@ - + diff --git a/source/parameters/invariant-tests/cnt-3.p1.pass.json b/source/parameters/invariant-tests/cnt-3.p1.pass.json new file mode 100644 index 00000000000..bc7d5ffb1d3 --- /dev/null +++ b/source/parameters/invariant-tests/cnt-3.p1.pass.json @@ -0,0 +1,6 @@ +{ + "resourceType": "Parameters", + "parameter": [ + { "name": "x", "valueCount": { "value": 5.0, "system": "http://unitsofmeasure.org", "code": "1" } } + ] +} diff --git a/source/parameters/invariant-tests/drt-1.f1.fail.json b/source/parameters/invariant-tests/drt-1.f1.fail.json new file mode 100644 index 00000000000..1e2e14a321e --- /dev/null +++ b/source/parameters/invariant-tests/drt-1.f1.fail.json @@ -0,0 +1,11 @@ +{ + "resourceType": "Parameters", + "parameter": [ + { + "name": "x", + "valueDuration": { + "value": 30 + } + } + ] +} diff --git a/source/parameters/invariant-tests/drt-1.p1.pass.json b/source/parameters/invariant-tests/drt-1.p1.pass.json new file mode 100644 index 00000000000..1093d51dec5 --- /dev/null +++ b/source/parameters/invariant-tests/drt-1.p1.pass.json @@ -0,0 +1,12 @@ +{ + "resourceType": "Parameters", + "parameter": [ + { + "name": "x", + "valueDuration": { + "value": 30, + "code": "min" + } + } + ] +} diff --git a/source/plandefinition/invariant-tests/exp-2.f1.fail.json b/source/plandefinition/invariant-tests/exp-2.f1.fail.json new file mode 100644 index 00000000000..edf6d20f188 --- /dev/null +++ b/source/plandefinition/invariant-tests/exp-2.f1.fail.json @@ -0,0 +1,19 @@ +{ + "resourceType": "PlanDefinition", + "status": "active", + "action": [ + { + "title": "a", + "condition": [ + { + "kind": "applicability", + "expression": { + "name": "9-bad name", + "language": "text/fhirpath", + "expression": "true" + } + } + ] + } + ] +} diff --git a/source/plandefinition/invariant-tests/pld-3.p1.pass.json b/source/plandefinition/invariant-tests/pld-3.p1.pass.json new file mode 100644 index 00000000000..73157beef88 --- /dev/null +++ b/source/plandefinition/invariant-tests/pld-3.p1.pass.json @@ -0,0 +1,27 @@ +{ + "resourceType": "PlanDefinition", + "status": "active", + "goal": [ + { + "id": "g1", + "description": { + "text": "x" + } + }, + { + "id": "g2", + "description": { + "text": "y" + } + } + ], + "action": [ + { + "title": "a", + "goalId": [ + "g1", + "g2" + ] + } + ] +} diff --git a/source/plandefinition/invariant-tests/pld-6.p1.pass.json b/source/plandefinition/invariant-tests/pld-6.p1.pass.json new file mode 100644 index 00000000000..7b9f0d4ac8d --- /dev/null +++ b/source/plandefinition/invariant-tests/pld-6.p1.pass.json @@ -0,0 +1,13 @@ +{ + "resourceType": "PlanDefinition", + "status": "active", + "relatedArtifact": [ + { + "type": "depends-on", + "resource": "http://x/Library/a", + "resourceReference": { + "reference": "Library/a" + } + } + ] +} diff --git a/source/plandefinition/structuredefinition-PlanDefinition.xml b/source/plandefinition/structuredefinition-PlanDefinition.xml index bc0cd485bc7..8655c7ee7b3 100644 --- a/source/plandefinition/structuredefinition-PlanDefinition.xml +++ b/source/plandefinition/structuredefinition-PlanDefinition.xml @@ -99,7 +99,7 @@ - + @@ -874,7 +874,7 @@ - + diff --git a/source/questionnaire/invariant-tests/que-16.f1.fail.json b/source/questionnaire/invariant-tests/que-16.f1.fail.json new file mode 100644 index 00000000000..82b49b5748a --- /dev/null +++ b/source/questionnaire/invariant-tests/que-16.f1.fail.json @@ -0,0 +1,10 @@ +{ + "resourceType": "Questionnaire", + "status": "active", + "item": [ + { + "linkId": "double space", + "type": "string" + } + ] +} diff --git a/source/questionnaire/invariant-tests/que-5.p1.pass.json b/source/questionnaire/invariant-tests/que-5.p1.pass.json new file mode 100644 index 00000000000..36d9f92bd29 --- /dev/null +++ b/source/questionnaire/invariant-tests/que-5.p1.pass.json @@ -0,0 +1,15 @@ +{ + "resourceType": "Questionnaire", + "status": "active", + "item": [ + { + "linkId": "u", + "type": "url", + "answerOption": [ + { + "valueUri": "http://example.org/a" + } + ] + } + ] +} diff --git a/source/questionnaire/invariant-tests/que-5b.p1.pass.json b/source/questionnaire/invariant-tests/que-5b.p1.pass.json new file mode 100644 index 00000000000..fb3c002ff22 --- /dev/null +++ b/source/questionnaire/invariant-tests/que-5b.p1.pass.json @@ -0,0 +1,11 @@ +{ + "resourceType": "Questionnaire", + "status": "active", + "item": [ + { + "linkId": "u", + "type": "url", + "answerValueSet": "http://example.org/vs" + } + ] +} diff --git a/source/questionnaire/structuredefinition-Questionnaire.xml b/source/questionnaire/structuredefinition-Questionnaire.xml index 3e9554fe9a9..99043f551ae 100644 --- a/source/questionnaire/structuredefinition-Questionnaire.xml +++ b/source/questionnaire/structuredefinition-Questionnaire.xml @@ -762,14 +762,14 @@ - + - - + + @@ -892,7 +892,7 @@ - + diff --git a/source/questionnaireresponse/invariant-tests/qrs-2.f1.fail.json b/source/questionnaireresponse/invariant-tests/qrs-2.f1.fail.json new file mode 100644 index 00000000000..c16480dd505 --- /dev/null +++ b/source/questionnaireresponse/invariant-tests/qrs-2.f1.fail.json @@ -0,0 +1,27 @@ +{ + "resourceType": "QuestionnaireResponse", + "status": "completed", + "item": [ + { + "linkId": "group", + "item": [ + { + "linkId": "dup", + "answer": [ + { + "valueString": "a" + } + ] + }, + { + "linkId": "dup", + "answer": [ + { + "valueString": "b" + } + ] + } + ] + } + ] +} diff --git a/source/questionnaireresponse/invariant-tests/qrs-3.f1.fail.json b/source/questionnaireresponse/invariant-tests/qrs-3.f1.fail.json new file mode 100644 index 00000000000..fec29be9044 --- /dev/null +++ b/source/questionnaireresponse/invariant-tests/qrs-3.f1.fail.json @@ -0,0 +1,9 @@ +{ + "resourceType": "QuestionnaireResponse", + "status": "completed", + "item": [ + { + "linkId": "double space" + } + ] +} diff --git a/source/questionnaireresponse/structuredefinition-QuestionnaireResponse.xml b/source/questionnaireresponse/structuredefinition-QuestionnaireResponse.xml index 24273257684..02f352a1c2f 100644 --- a/source/questionnaireresponse/structuredefinition-QuestionnaireResponse.xml +++ b/source/questionnaireresponse/structuredefinition-QuestionnaireResponse.xml @@ -397,7 +397,7 @@ - + @@ -421,7 +421,7 @@ - + diff --git a/source/structuredefinition/invariant-tests/eld-12.f1.fail.json b/source/structuredefinition/invariant-tests/eld-12.f1.fail.json new file mode 100644 index 00000000000..6c29ce98a77 --- /dev/null +++ b/source/structuredefinition/invariant-tests/eld-12.f1.fail.json @@ -0,0 +1,23 @@ +{ + "resourceType": "StructureDefinition", + "url": "http://example.org/sd/eld12", + "name": "Eld12", + "status": "draft", + "kind": "resource", + "abstract": false, + "type": "Observation", + "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation", + "derivation": "constraint", + "differential": { + "element": [ + { + "id": "Observation.status", + "path": "Observation.status", + "binding": { + "strength": "required", + "valueSet": "httpsfoo" + } + } + ] + } +} diff --git a/source/structuredefinition/invariant-tests/eld-21.f1.fail.json b/source/structuredefinition/invariant-tests/eld-21.f1.fail.json new file mode 100644 index 00000000000..0418f66273c --- /dev/null +++ b/source/structuredefinition/invariant-tests/eld-21.f1.fail.json @@ -0,0 +1,34 @@ +{ + "resourceType": "StructureDefinition", + "url": "http://example.org/sd/eld21", + "name": "Eld21", + "status": "draft", + "kind": "resource", + "abstract": false, + "type": "Patient", + "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Patient", + "derivation": "constraint", + "differential": { + "element": [ + { + "id": "Patient.name", + "path": "Patient.name", + "constraint": [ + { + "key": "x-1", + "severity": "error", + "human": "must be set", + "_expression": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason", + "valueCode": "unknown" + } + ] + } + } + ] + } + ] + } +}