diff --git a/validator/bundle-document-versioned-references-bad.json b/validator/bundle-document-versioned-references-bad.json new file mode 100644 index 00000000..44cd7cc8 --- /dev/null +++ b/validator/bundle-document-versioned-references-bad.json @@ -0,0 +1,137 @@ +{ + "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" + }, + "performer": [ + { + "reference": "Practitioner/PractitionerExample" + } + ], + "status": "final", + "code": { + "text" : "test" + }, + "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" + }, + "performer": [ + { + "reference": "Practitioner/PractitionerExample" + } + ], + "status": "final", + "code": { + "text" : "test" + }, + "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..215af633 --- /dev/null +++ b/validator/bundle-document-versioned-references-good.json @@ -0,0 +1,139 @@ +{ + "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" + }, + "performer": [ + { + "reference": "Practitioner/PractitionerExample" + } + ], + "status": "final", + "code": { + "text" : "test" + }, + "subject": { + "reference": "Patient/PatientExample" + }, + "effectiveDateTime": "2024-11-30", + "valueQuantity": { + "value": 170, + "code": "cm", + "system": "http://unitsofmeasure.org" + } + } + }, + { + "fullUrl": "http://example.org/Observation/ObservationExample", + "resource": { + "resourceType": "Observation", + "id": "ObservationExample", + "meta": { + "versionId": "2", + "lastUpdated": "2024-12-01T13:28:17.239+02:00" + }, + "performer": [ + { + "reference": "Practitioner/PractitionerExample" + } + ], + "status": "final", + "code": { + "text" : "test" + }, + "subject": { + "reference": "Patient/PatientExample" + }, + "effectiveDateTime": "2024-11-30", + "valueQuantity": { + "value": 170, + "code": "cm", + "system": "http://unitsofmeasure.org" + } + } + }, + { + "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/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",