From 72e24329b9020b9dbf24dd1f1017135e7d61459d Mon Sep 17 00:00:00 2001 From: sebg-mio42 Date: Tue, 10 Dec 2024 14:15:52 +0100 Subject: [PATCH 1/3] added test bundles for Bundle versioned reference resolution --- ...dle-document-versioned-references-bad.json | 169 +++++++++++++++++ ...le-document-versioned-references-good.json | 173 ++++++++++++++++++ 2 files changed, 342 insertions(+) create mode 100644 validator/bundle-document-versioned-references-bad.json create mode 100644 validator/bundle-document-versioned-references-good.json diff --git a/validator/bundle-document-versioned-references-bad.json b/validator/bundle-document-versioned-references-bad.json new file mode 100644 index 00000000..d270536b --- /dev/null +++ b/validator/bundle-document-versioned-references-bad.json @@ -0,0 +1,169 @@ +{ + "resourceType": "Bundle", + "id": "BundleExample1", + "identifier": { + "system": "urn:ietf:rfc:3986", + "value": "urn:uuid:ba2d1426-ed83-4d55-8032-c6345382c92b" + }, + "entry": [ + { + "fullUrl": "http://example.org/Composition/CompositionExample1", + "resource": { + "resourceType": "Composition", + "id": "CompositionExample1", + "author": [ + { + "reference": "Practitioner/PractitionerExample" + } + ], + "section": [ + { + "entry": [ + { + "reference": "Observation/ObservationExample/_history/3" + }, + { + "reference": "Observation/ObservationExample" + } + ] + } + ], + "status": "final", + "type": { + "coding": [ + { + "code": "18776-5", + "system": "http://loinc.org", + "display": "Plan of care note" + } + ] + }, + "subject": { + "reference": "Patient/PatientExample" + }, + "date": "2024-12-01", + "title": "Document example" + } + }, + { + "fullUrl": "http://example.org/Observation/ObservationExample", + "resource": { + "resourceType": "Observation", + "id": "ObservationExample", + "meta": { + "versionId": "1", + "lastUpdated": "2024-11-30T13:28:17.239+02:00" + }, + "category": [ + { + "coding": [ + { + "code": "vital-signs", + "system": "http://terminology.hl7.org/CodeSystem/observation-category" + } + ] + } + ], + "performer": [ + { + "reference": "Practitioner/PractitionerExample" + } + ], + "status": "final", + "code": { + "coding": [ + { + "code": "8302-2", + "system": "http://loinc.org", + "display": "Body height" + } + ] + }, + "subject": { + "reference": "Patient/PatientExample" + }, + "effectiveDateTime": "2024-11-30", + "valueQuantity": { + "value": 170, + "code": "cm", + "system": "http://unitsofmeasure.org", + "unit": "cm" + } + } + }, + { + "fullUrl": "http://example.org/Observation/ObservationExample", + "resource": { + "resourceType": "Observation", + "id": "ObservationExample", + "meta": { + "versionId": "2", + "lastUpdated": "2024-12-01T13:28:17.239+02:00" + }, + "category": [ + { + "coding": [ + { + "code": "vital-signs", + "system": "http://terminology.hl7.org/CodeSystem/observation-category" + } + ] + } + ], + "performer": [ + { + "reference": "Practitioner/PractitionerExample" + } + ], + "status": "final", + "code": { + "coding": [ + { + "code": "8302-2", + "system": "http://loinc.org", + "display": "Body height" + } + ] + }, + "subject": { + "reference": "Patient/PatientExample" + }, + "effectiveDateTime": "2024-11-30", + "valueQuantity": { + "value": 170, + "code": "cm", + "system": "http://unitsofmeasure.org", + "unit": "cm" + } + } + }, + { + "fullUrl": "http://example.org/Patient/PatientExample", + "resource": { + "resourceType": "Patient", + "id": "PatientExample", + "name": [ + { + "given": ["James"], + "family": "Toad" + } + ] + } + }, + { + "fullUrl": "http://example.org/Practitioner/PractitionerExample", + "resource": { + "resourceType": "Practitioner", + "id": "PractitionerExample", + "name": [ + { + "given": ["Gina"], + "family": "Pond" + } + ] + } + } + ], + "type": "document", + "timestamp": "2024-12-01T13:28:17.239+02:00" +} diff --git a/validator/bundle-document-versioned-references-good.json b/validator/bundle-document-versioned-references-good.json new file mode 100644 index 00000000..783e715f --- /dev/null +++ b/validator/bundle-document-versioned-references-good.json @@ -0,0 +1,173 @@ +{ + "resourceType": "Bundle", + "id": "BundleExample1", + "identifier": { + "system": "urn:ietf:rfc:3986", + "value": "urn:uuid:ba2d1426-ed83-4d55-8032-c6345382c92b" + }, + "entry": [ + { + "fullUrl": "http://example.org/Composition/CompositionExample1", + "resource": { + "resourceType": "Composition", + "id": "CompositionExample1", + "author": [ + { + "reference": "Practitioner/PractitionerExample" + } + ], + "section": [ + { + "entry": [ + { + "reference": "Observation/ObservationExample/_history/1" + }, + { + "reference": "Observation/ObservationExample/_history/2" + } + ] + } + ], + "status": "final", + "type": { + "coding": [ + { + "code": "18776-5", + "system": "http://loinc.org", + "display": "Plan of care note" + } + ] + }, + "subject": { + "reference": "Patient/PatientExample" + }, + "date": "2024-12-01", + "title": "Document example" + } + }, + { + "fullUrl": "http://example.org/Observation/ObservationExample", + "resource": { + "resourceType": "Observation", + "id": "ObservationExample", + "meta": { + "versionId": "1", + "lastUpdated": "2024-11-30T13:28:17.239+02:00" + }, + "category": [ + { + "coding": [ + { + "code": "vital-signs", + "system": "http://terminology.hl7.org/CodeSystem/observation-category" + } + ] + } + ], + "performer": [ + { + "reference": "Practitioner/PractitionerExample" + } + ], + "status": "final", + "code": { + "coding": [ + { + "code": "8302-2", + "system": "http://loinc.org", + "display": "Body height" + } + ] + }, + "subject": { + "reference": "Patient/PatientExample" + }, + "effectiveDateTime": "2024-11-30", + "valueQuantity": { + "value": 170, + "code": "cm", + "system": "http://unitsofmeasure.org", + "unit": "cm" + } + } + }, + { + "fullUrl": "http://example.org/Observation/ObservationExample", + "resource": { + "resourceType": "Observation", + "id": "ObservationExample", + "meta": { + "versionId": "2", + "lastUpdated": "2024-12-01T13:28:17.239+02:00" + }, + "category": [ + { + "coding": [ + { + "code": "vital-signs", + "system": "http://terminology.hl7.org/CodeSystem/observation-category" + } + ] + } + ], + "performer": [ + { + "reference": "Practitioner/PractitionerExample" + } + ], + "status": "final", + "code": { + "coding": [ + { + "code": "8302-2", + "system": "http://loinc.org", + "display": "Body height" + } + ] + }, + "subject": { + "reference": "Patient/PatientExample" + }, + "effectiveDateTime": "2024-11-30", + "valueQuantity": { + "value": 170, + "code": "cm", + "system": "http://unitsofmeasure.org", + "unit": "cm" + } + } + }, + { + "fullUrl": "http://example.org/Patient/PatientExample", + "resource": { + "resourceType": "Patient", + "id": "PatientExample", + "name": [ + { + "given": [ + "James" + ], + "family": "Toad" + } + ] + } + }, + { + "fullUrl": "http://example.org/Practitioner/PractitionerExample", + "resource": { + "resourceType": "Practitioner", + "id": "PractitionerExample", + "name": [ + { + "given": [ + "Gina" + ], + "family": "Pond" + } + ] + } + } + ], + "type": "document", + "timestamp": "2024-12-01T13:28:17.239+02:00" +} From 5aea292de4c8989cb4237bce6596e19cd9a2e4ed Mon Sep 17 00:00:00 2001 From: sebg-mio42 Date: Tue, 10 Dec 2024 16:13:19 +0100 Subject: [PATCH 2/3] simplified bundles for versioned reference test cases --- ...dle-document-versioned-references-bad.json | 36 +--------------- ...le-document-versioned-references-good.json | 42 ++----------------- 2 files changed, 6 insertions(+), 72 deletions(-) diff --git a/validator/bundle-document-versioned-references-bad.json b/validator/bundle-document-versioned-references-bad.json index d270536b..44cd7cc8 100644 --- a/validator/bundle-document-versioned-references-bad.json +++ b/validator/bundle-document-versioned-references-bad.json @@ -54,16 +54,6 @@ "versionId": "1", "lastUpdated": "2024-11-30T13:28:17.239+02:00" }, - "category": [ - { - "coding": [ - { - "code": "vital-signs", - "system": "http://terminology.hl7.org/CodeSystem/observation-category" - } - ] - } - ], "performer": [ { "reference": "Practitioner/PractitionerExample" @@ -71,13 +61,7 @@ ], "status": "final", "code": { - "coding": [ - { - "code": "8302-2", - "system": "http://loinc.org", - "display": "Body height" - } - ] + "text" : "test" }, "subject": { "reference": "Patient/PatientExample" @@ -100,16 +84,6 @@ "versionId": "2", "lastUpdated": "2024-12-01T13:28:17.239+02:00" }, - "category": [ - { - "coding": [ - { - "code": "vital-signs", - "system": "http://terminology.hl7.org/CodeSystem/observation-category" - } - ] - } - ], "performer": [ { "reference": "Practitioner/PractitionerExample" @@ -117,13 +91,7 @@ ], "status": "final", "code": { - "coding": [ - { - "code": "8302-2", - "system": "http://loinc.org", - "display": "Body height" - } - ] + "text" : "test" }, "subject": { "reference": "Patient/PatientExample" diff --git a/validator/bundle-document-versioned-references-good.json b/validator/bundle-document-versioned-references-good.json index 783e715f..215af633 100644 --- a/validator/bundle-document-versioned-references-good.json +++ b/validator/bundle-document-versioned-references-good.json @@ -54,16 +54,6 @@ "versionId": "1", "lastUpdated": "2024-11-30T13:28:17.239+02:00" }, - "category": [ - { - "coding": [ - { - "code": "vital-signs", - "system": "http://terminology.hl7.org/CodeSystem/observation-category" - } - ] - } - ], "performer": [ { "reference": "Practitioner/PractitionerExample" @@ -71,13 +61,7 @@ ], "status": "final", "code": { - "coding": [ - { - "code": "8302-2", - "system": "http://loinc.org", - "display": "Body height" - } - ] + "text" : "test" }, "subject": { "reference": "Patient/PatientExample" @@ -86,8 +70,7 @@ "valueQuantity": { "value": 170, "code": "cm", - "system": "http://unitsofmeasure.org", - "unit": "cm" + "system": "http://unitsofmeasure.org" } } }, @@ -100,16 +83,6 @@ "versionId": "2", "lastUpdated": "2024-12-01T13:28:17.239+02:00" }, - "category": [ - { - "coding": [ - { - "code": "vital-signs", - "system": "http://terminology.hl7.org/CodeSystem/observation-category" - } - ] - } - ], "performer": [ { "reference": "Practitioner/PractitionerExample" @@ -117,13 +90,7 @@ ], "status": "final", "code": { - "coding": [ - { - "code": "8302-2", - "system": "http://loinc.org", - "display": "Body height" - } - ] + "text" : "test" }, "subject": { "reference": "Patient/PatientExample" @@ -132,8 +99,7 @@ "valueQuantity": { "value": 170, "code": "cm", - "system": "http://unitsofmeasure.org", - "unit": "cm" + "system": "http://unitsofmeasure.org" } } }, From 4f5ed7def550882e59dea72b9b3b6965ef09603f Mon Sep 17 00:00:00 2001 From: sebg-mio42 Date: Tue, 10 Dec 2024 16:14:17 +0100 Subject: [PATCH 3/3] added test cases for versioned references in bundles --- validator/manifest.json | 87 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/validator/manifest.json b/validator/manifest.json index ea765cbe..5bbc3a4b 100644 --- a/validator/manifest.json +++ b/validator/manifest.json @@ -756,6 +756,93 @@ "output": [] } }, + { + "name": "bundle-document-versioned-references-good", + "file": "bundle-document-versioned-references-good.json", + "version": "4.0", + "java": { + "errorCount": 0, + "output": [] + } + }, + { + "name": "bundle-document-versioned-references-bad", + "file": "bundle-document-versioned-references-bad.json", + "version": "4.0", + "java": { + "outcome": { + "resourceType" : "OperationOutcome", + "issue" : [{ + "severity" : "warning", + "code" : "required", + "details" : { + "text" : "The bundle contains no match for http://example.org/Observation/ObservationExample by the rules of Bundle reference resolution, but it has multiple resources that match Observation/ObservationExample/_history/3 by resource type and id" + }, + "expression" : ["Bundle.entry[0].resource/*Composition/CompositionExample1*/.section[0].entry[0]"] + }, + { + "severity" : "warning", + "code" : "required", + "details" : { + "text" : "Entry 1 matches the reference Observation/ObservationExample/_history/3 by type and id but it's fullUrl http://example.org/Observation/ObservationExample does not match the full target URL http://example.org/Observation/ObservationExample by Bundle resolution rules" + }, + "expression" : ["Bundle.entry[0].resource/*Composition/CompositionExample1*/.section[0].entry[0]"] + }, + { + "severity" : "warning", + "code" : "required", + "details" : { + "text" : "Entry 2 matches the reference Observation/ObservationExample/_history/3 by type and id but it's fullUrl http://example.org/Observation/ObservationExample does not match the full target URL http://example.org/Observation/ObservationExample by Bundle resolution rules" + }, + "expression" : ["Bundle.entry[0].resource/*Composition/CompositionExample1*/.section[0].entry[0]"] + }, + { + "severity" : "error", + "code" : "forbidden", + "details" : { + "text" : "Multiple matches in bundle for reference Observation/ObservationExample" + }, + "expression" : ["Bundle.entry[0].resource/*Composition/CompositionExample1*/.section[0].entry[1]"] + }, + { + "severity" : "error", + "code" : "invalid", + "details" : { + "text" : "Can't find 'Observation/ObservationExample/_history/3' in the bundle (Section Entry). Note that there are 2 resources in the bundle with the same type and id, but they do not match because of the fullUrl based rules around matching relative references (one of ``http://example.org/Observation/ObservationExample``)" + }, + "diagnostics" : "[22,16]", + "expression" : ["Bundle.entry[1].resource.section[1].entry[1]"] + }, + { + "severity" : "error", + "code" : "invalid", + "details" : { + "text" : "Found 2 matches for 'Observation/ObservationExample' in the bundle (Section Entry)" + }, + "diagnostics" : "[25,16]", + "expression" : ["Bundle.entry[1].resource.section[1].entry[2]"] + }, + { + "severity" : "warning", + "code" : "invalid", + "details" : { + "text" : "Entry 'http://example.org/Observation/ObservationExample' isn't reachable by traversing forwards from the Composition. Only Provenance is approved to be used this way (R4 section 3.3.1)" + }, + "diagnostics" : "[48,6]", + "expression" : ["Bundle.entry[6]"] + }, + { + "severity" : "warning", + "code" : "invalid", + "details" : { + "text" : "Entry 'http://example.org/Observation/ObservationExample' isn't reachable by traversing forwards from the Composition. Only Provenance is approved to be used this way (R4 section 3.3.1)" + }, + "diagnostics" : "[78,6]", + "expression" : ["Bundle.entry[6]"] + }] + } + } + }, { "name": "bundle-documentation-miss-last-updated", "file": "bundle-documentation-miss-last-updated.json",