From 66827fae3cdf25c612b4e0bf315b8845bd0f6c55 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 6 Sep 2023 09:11:18 +1000 Subject: [PATCH] test cases for conceptmap validation --- validator/cm-cs.json | 46 +++++++++++++++++++ validator/cm-vs.json | 42 ++++++++++++++++++ validator/cm-vs2.json | 45 +++++++++++++++++++ validator/cm.json | 59 +++++++++++++++++++++++++ validator/manifest.json | 97 ++++++++++++++++++++++++++++++++++++++++- 5 files changed, 288 insertions(+), 1 deletion(-) create mode 100644 validator/cm-cs.json create mode 100644 validator/cm-vs.json create mode 100644 validator/cm-vs2.json create mode 100644 validator/cm.json diff --git a/validator/cm-cs.json b/validator/cm-cs.json new file mode 100644 index 00000000..489ce75f --- /dev/null +++ b/validator/cm-cs.json @@ -0,0 +1,46 @@ +{ + "resourceType" : "CodeSystem", + "id" : "ch-ig-example", + "text" : { + "status" : "generated", + "div" : "
Placeholder
" + }, + "url" : "http://fhir.ch/ig/ch-ig/CodeSystem/ch-ig-example", + "version" : "0.1.0", + "name" : "ChIgExample", + "title" : "CH IG Example", + "status" : "draft", + "experimental" : true, + "date" : "2023-09-05T12:08:22+00:00", + "publisher" : "HL7 Switzerland", + "contact" : [{ + "name" : "HL7 Switzerland", + "telecom" : [{ + "system" : "url", + "value" : "https://www.hl7.ch/" + }] + }], + "description" : "CH IG Example code system is just an example!", + "jurisdiction" : [{ + "coding" : [{ + "system" : "urn:iso:std:iso:3166", + "code" : "CHE" + }] + }], + "copyright" : "CC0-1.0", + "caseSensitive" : true, + "content" : "complete", + "count" : 3, + "concept" : [{ + "code" : "med", + "display" : "Example med" + }, + { + "code" : "pharm", + "display" : "Example pharm" + }, + { + "code" : "vac", + "display" : "Example vac" + }] +} \ No newline at end of file diff --git a/validator/cm-vs.json b/validator/cm-vs.json new file mode 100644 index 00000000..a6579fcd --- /dev/null +++ b/validator/cm-vs.json @@ -0,0 +1,42 @@ +{ + "resourceType" : "ValueSet", + "id" : "OrganizationType", + "text" : { + "status" : "generated", + "div" : "
Placeholder
" + }, + "url" : "http://fhir.ch/ig/ch-ig/ValueSet/ch-ig-example", + "version" : "0.1.0", + "name" : "OrganizationType", + "title" : "Organization Type", + "status" : "draft", + "experimental" : true, + "date" : "2023-09-05T12:08:22+00:00", + "publisher" : "HL7 Switzerland", + "contact" : [{ + "name" : "HL7 Switzerland", + "telecom" : [{ + "system" : "url", + "value" : "https://www.hl7.ch/" + }] + }], + "description" : "Test value set", + "jurisdiction" : [{ + "coding" : [{ + "system" : "urn:iso:std:iso:3166", + "code" : "CHE" + }] + }], + "copyright" : "CC0-1.0", + "compose" : { + "include" : [{ + "system" : "http://fhir.ch/ig/ch-ig/CodeSystem/ch-ig-example", + "concept" : [{ + "code" : "pharm" + }, + { + "code" : "vac" + }] + }] + } +} \ No newline at end of file diff --git a/validator/cm-vs2.json b/validator/cm-vs2.json new file mode 100644 index 00000000..ee401dd4 --- /dev/null +++ b/validator/cm-vs2.json @@ -0,0 +1,45 @@ +{ + "resourceType" : "ValueSet", + "id" : "OrganizationType", + "text" : { + "status" : "generated", + "div" : "
Placeholder
" + }, + "url" : "http://fhir.ch/ig/ch-ig/ValueSet/OrganizationType", + "version" : "0.1.0", + "name" : "OrganizationType", + "title" : "Organization Type", + "status" : "draft", + "experimental" : true, + "date" : "2023-09-05T12:08:22+00:00", + "publisher" : "HL7 Switzerland", + "contact" : [{ + "name" : "HL7 Switzerland", + "telecom" : [{ + "system" : "url", + "value" : "https://www.hl7.ch/" + }] + }], + "description" : "Test value set", + "jurisdiction" : [{ + "coding" : [{ + "system" : "urn:iso:std:iso:3166", + "code" : "CHE" + }] + }], + "copyright" : "CC0-1.0", + "compose" : { + "include" : [{ + "system" : "http://snomed.info/sct", + "version" : "http://snomed.info/sct/2011000195101", + "concept" : [{ + "code" : "288565001", + "display" : "Medical center (environment)" + }, + { + "code" : "264372000", + "display" : "Pharmacy (environment)" + }] + }] + } +} \ No newline at end of file diff --git a/validator/cm.json b/validator/cm.json new file mode 100644 index 00000000..76424672 --- /dev/null +++ b/validator/cm.json @@ -0,0 +1,59 @@ +{ + "resourceType" : "ConceptMap", + "id" : "OrganizationTypeToTest", + "text" : { + "status" : "extensions", + "div" : "
Placeholder
" + }, + "url" : "http://fhir.ch/ig/ch-ig/ConceptMap/OrganizationTypeToTest", + "version" : "0.1.0", + "name" : "OrganizationType", + "title" : "Organization Type Mapping", + "status" : "active", + "experimental" : true, + "date" : "2023-09-05T12:08:22+00:00", + "publisher" : "HL7 Switzerland", + "contact" : [{ + "name" : "HL7 Switzerland", + "telecom" : [{ + "system" : "url", + "value" : "https://www.hl7.ch/" + }] + }], + "description" : "Test ConceptMap", + "jurisdiction" : [{ + "coding" : [{ + "system" : "urn:iso:std:iso:3166", + "code" : "CHE" + }] + }], + "copyright" : "CC0-1.0", + "sourceCanonical" : "http://fhir.ch/ig/ch-ig/ValueSet/ch-ig-example", + "targetCanonical" : "http://fhir.ch/ig/ch-ig/ValueSet/OrganizationType", + "group" : [{ + "source" : "http://fhir.ch/ig/ch-ig/CodeSystem/ch-ig-example", + "target" : "http://snomed.info/sct", + "targetVersion" : "http://snomed.info/sct/2011000195101", + "element" : [{ + "code" : "med", + "target" : [{ + "code" : "264358009", + "equivalence" : "equivalent" + }] + }, + { + "code" : "vac", + "target" : [{ + "code" : "46224007", + "equivalence" : "equivalent" + }] + }, + { + "code" : "pharm", + "target" : [{ + "code" : "264372000", + "equivalence" : "equivalent" + }] + }] + }] +} \ No newline at end of file diff --git a/validator/manifest.json b/validator/manifest.json index a7153d19..dfe88fca 100644 --- a/validator/manifest.json +++ b/validator/manifest.json @@ -33645,7 +33645,102 @@ } }, { - "todo": "inactive codes: active, inactive, retired against all three valuesets, and without a value set", + "name": "cm", + "file": "cm.json", + "supporting": [ + "cm-vs.json", "cm-cs.json" + ], + "description": "ConceptMap maps something not in the value set", + "version" : "4.0", + "java": { + "outcome": { + "resourceType" : "OperationOutcome", + "issue" : [{ + "severity" : "error", + "code" : "required", + "details" : { + "text" : "The source code 'med' is not valid in the value set http://fhir.ch/ig/ch-ig/ValueSet/ch-ig-example|0.1.0" + }, + "diagnostics" : "[38,21]", + "expression" : ["ConceptMap.group[0].element[0].code"] + }] + } + } + }, + { + "name": "cm2", + "file": "cm.json", + "supporting": [ + "cm-vs2.json", "cm-cs.json" + ], + "description": "ConceptMap maps something not in the value set *in snomed*", + "version" : "4.0", + "java": { + "outcome": { + "resourceType" : "OperationOutcome", + "issue" : [{ + "severity" : "error", + "code" : "business-rule", + "details" : { + "text" : "The code '46224007' in the system http://snomed.info/sct version http://snomed.info/sct/2011000195101 is not valid in the value set 'http://fhir.ch/ig/ch-ig/ValueSet/OrganizationType'" + }, + "diagnostics" : "[47,28]", + "expression" : ["ConceptMap.group[0].element[1].target[0].code"] + }] + } + } + }, + { + "name": "mi-use-derived", + "file": "mi-use-derived.xml", + "supporting": [ + "mi-defn-base.xml", "mi-use-base.xml", "mi-defn-derived.xml" + ], + "description": "Profiling to a derived profile", + "version" : "5.0", + "java": { + "outcome": { + "resourceType": "OperationOutcome" + } + } + }, + { + "name": "mi-use-distinct", + "file": "mi-use-distinct.xml", + "supporting": [ + "mi-defn-base.xml", "mi-use-base.xml", "mi-defn-distinct.xml" + ], + "description": "Profiling to a distinct profile (illegal)", + "version" : "5.0", + "java": { + "outcome": { + "resourceType" : "OperationOutcome", + "issue" : [{ + "severity" : "error", + "code" : "exception", + "details" : { + "text" : "Error generating Snapshot: StructureDefinition http://hl7.org/fhir/test/StructureDefinition/mi-use-distinct at Observation.subject: invalid constrained type Reference(http://hl7.org/fhir/test/StructureDefinition/mi-defn-distinct) from Reference(http://hl7.org/fhir/test/StructureDefinition/mi-defn-base) in http://hl7.org/fhir/test/StructureDefinition/mi-use-distinct (this usually arises from a problem in the differential)" + }, + "expression" : ["StructureDefinition"] + }] + } + } + }, + { + "name": "mi-use-imposed", + "file": "mi-use-imposed.xml", + "supporting": [ + "mi-defn-base.xml", "mi-use-base.xml", "mi-defn-imposed.xml" + ], + "description": "Profiling to a imposed profile", + "version" : "5.0", + "java": { + "outcome": { + "resourceType": "OperationOutcome" + } + } + }, + { "name": "zzz", "file": "zzz.json", "description": "hack to close ups",