Fix bug converting extension context = Resource (R4 <-> R5 conversion)
This commit is contained in:
parent
caf4632464
commit
d8db639884
|
@ -356,6 +356,6 @@ public class StructureDefinition30_40 {
|
|||
}
|
||||
|
||||
static public boolean isResource300(String tn) {
|
||||
return Utilities.existsInList(tn, "Account", "ActivityDefinition", "AllergyIntolerance", "AdverseEvent", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", "ChargeItem", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "Contract", "Coverage", "DataElement", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceRequest", "DeviceUseStatement", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "Endpoint", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "GuidanceResponse", "HealthcareService", "ImagingManifest", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RequestGroup", "ResearchStudy", "ResearchSubject", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "ServiceDefinition", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "TestReport", "ValueSet", "VisionPrescription");
|
||||
return Utilities.existsInList(tn, "Resource", "DomainResource", "Account", "ActivityDefinition", "AllergyIntolerance", "AdverseEvent", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", "ChargeItem", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "Contract", "Coverage", "DataElement", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceRequest", "DeviceUseStatement", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "Endpoint", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "GuidanceResponse", "HealthcareService", "ImagingManifest", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RequestGroup", "ResearchStudy", "ResearchSubject", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "ServiceDefinition", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "TestReport", "ValueSet", "VisionPrescription");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package org.hl7.fhir.convertors.conv30_40;
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.dstu3.model.StructureDefinition;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class Extension30_40Test {
|
||||
|
||||
private void convert(String filename) throws FHIRFormatError, IOException {
|
||||
InputStream r3_input = this.getClass().getResourceAsStream("/"+filename);
|
||||
|
||||
org.hl7.fhir.dstu3.model.StructureDefinition r3_source = (org.hl7.fhir.dstu3.model.StructureDefinition) new org.hl7.fhir.dstu3.formats.JsonParser().parse(r3_input);
|
||||
org.hl7.fhir.r4.model.Resource r4 = VersionConvertorFactory_30_40.convertResource(r3_source, new BaseAdvisor_30_40(false));
|
||||
org.hl7.fhir.dstu3.model.StructureDefinition r3_roundtrip = (StructureDefinition) VersionConvertorFactory_30_40.convertResource(r4, new BaseAdvisor_30_40(false));
|
||||
|
||||
Assertions.assertTrue(r3_source.getContextType().equals(r3_roundtrip.getContextType()),
|
||||
"Failed comparing " + r3_source.getContextType() + " and " + r3_roundtrip.getContextType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtension_r3_res_base() throws IOException {
|
||||
convert("extension_r3_res_base.json");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testExtension_r3_res_path() throws IOException {
|
||||
convert("extension_r3_res_path.json");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtension_r3_dt_base() throws IOException {
|
||||
convert("extension_r3_dt_base.json");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtension_r3_dt_path() throws IOException {
|
||||
convert("extension_r3_dt_path.json");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
{
|
||||
"resourceType": "StructureDefinition",
|
||||
"id": "coding-sctdescid",
|
||||
"extension": [
|
||||
{
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
|
||||
"valueCode": "fhir"
|
||||
},
|
||||
{
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
|
||||
"valueInteger": 1
|
||||
}
|
||||
],
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/coding-sctdescid",
|
||||
"name": "sctdescid",
|
||||
"status": "draft",
|
||||
"date": "2015-02-28",
|
||||
"publisher": "Health Level Seven, Inc. - FHIR Core WG",
|
||||
"contact": [
|
||||
{
|
||||
"telecom": [
|
||||
{
|
||||
"system": "url",
|
||||
"value": "http://hl7.org/special/committees/FHIR"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"description": "The SNOMED CT Description ID for the display.",
|
||||
"fhirVersion": "3.0.2",
|
||||
"mapping": [
|
||||
{
|
||||
"identity": "v2",
|
||||
"uri": "http://hl7.org/v2",
|
||||
"name": "HL7 v2 Mapping"
|
||||
},
|
||||
{
|
||||
"identity": "rim",
|
||||
"uri": "http://hl7.org/v3",
|
||||
"name": "RIM Mapping"
|
||||
}
|
||||
],
|
||||
"kind": "complex-type",
|
||||
"abstract": false,
|
||||
"contextType": "datatype",
|
||||
"context": [
|
||||
"Coding"
|
||||
],
|
||||
"type": "Extension",
|
||||
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Extension",
|
||||
"derivation": "constraint",
|
||||
"differential": {
|
||||
"element": [
|
||||
{
|
||||
"id": "Extension",
|
||||
"path": "Extension",
|
||||
"short": "SNOMED CT Description ID",
|
||||
"definition": "The SNOMED CT Description ID for the display.",
|
||||
"min": 0,
|
||||
"max": "1",
|
||||
"mapping": [
|
||||
{
|
||||
"identity": "v2",
|
||||
"map": "N/A"
|
||||
},
|
||||
{
|
||||
"identity": "rim",
|
||||
"map": "n/a"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "Extension.extension",
|
||||
"path": "Extension.extension",
|
||||
"max": "0"
|
||||
},
|
||||
{
|
||||
"id": "Extension.url",
|
||||
"path": "Extension.url",
|
||||
"type": [
|
||||
{
|
||||
"code": "uri"
|
||||
}
|
||||
],
|
||||
"fixedUri": "http://hl7.org/fhir/StructureDefinition/coding-sctdescid"
|
||||
},
|
||||
{
|
||||
"id": "Extension.valueId",
|
||||
"path": "Extension.valueId",
|
||||
"type": [
|
||||
{
|
||||
"code": "id"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
{
|
||||
"resourceType": "StructureDefinition",
|
||||
"id": "elementdefinition-equivalence",
|
||||
"extension": [
|
||||
{
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
|
||||
"valueCode": "fhir"
|
||||
},
|
||||
{
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
|
||||
"valueInteger": 1
|
||||
}
|
||||
],
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-equivalence",
|
||||
"name": "equivalence",
|
||||
"status": "draft",
|
||||
"date": "2015-02-28",
|
||||
"publisher": "Health Level Seven, Inc. - FHIR Core WG",
|
||||
"contact": [
|
||||
{
|
||||
"telecom": [
|
||||
{
|
||||
"system": "url",
|
||||
"value": "http://hl7.org/special/committees/FHIR"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"description": "The level of equivalence between the element containing the mapping and the element mapped to.",
|
||||
"fhirVersion": "3.0.2",
|
||||
"mapping": [
|
||||
{
|
||||
"identity": "rim",
|
||||
"uri": "http://hl7.org/v3",
|
||||
"name": "RIM Mapping"
|
||||
}
|
||||
],
|
||||
"kind": "complex-type",
|
||||
"abstract": false,
|
||||
"contextType": "datatype",
|
||||
"context": [
|
||||
"ElementDefinition.mapping"
|
||||
],
|
||||
"type": "Extension",
|
||||
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Extension",
|
||||
"derivation": "constraint",
|
||||
"differential": {
|
||||
"element": [
|
||||
{
|
||||
"id": "Extension",
|
||||
"path": "Extension",
|
||||
"short": "equivalent | equal | wider | subsumes | narrower | specializes | inexact | unmatched | disjoint",
|
||||
"definition": "The level of equivalence between the element containing the mapping and the element mapped to.",
|
||||
"min": 0,
|
||||
"max": "1",
|
||||
"mapping": [
|
||||
{
|
||||
"identity": "rim",
|
||||
"map": "N/A (MIF territory)"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "Extension.extension",
|
||||
"path": "Extension.extension",
|
||||
"max": "0"
|
||||
},
|
||||
{
|
||||
"id": "Extension.url",
|
||||
"path": "Extension.url",
|
||||
"type": [
|
||||
{
|
||||
"code": "uri"
|
||||
}
|
||||
],
|
||||
"fixedUri": "http://hl7.org/fhir/StructureDefinition/elementdefinition-equivalence"
|
||||
},
|
||||
{
|
||||
"id": "Extension.valueCode",
|
||||
"path": "Extension.valueCode",
|
||||
"type": [
|
||||
{
|
||||
"code": "code"
|
||||
}
|
||||
],
|
||||
"binding": {
|
||||
"extension": [
|
||||
{
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
|
||||
"valueString": "ConceptMapEquivalence"
|
||||
},
|
||||
{
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-isCommonBinding",
|
||||
"valueBoolean": true
|
||||
}
|
||||
],
|
||||
"strength": "required",
|
||||
"description": "The degree of equivalence between concepts.",
|
||||
"valueSetReference": {
|
||||
"reference": "http://hl7.org/fhir/ValueSet/concept-map-equivalence"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
{
|
||||
"resourceType": "StructureDefinition",
|
||||
"id": "capabilitystatement-supported-system",
|
||||
"extension": [
|
||||
{
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
|
||||
"valueCode": "fhir"
|
||||
},
|
||||
{
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
|
||||
"valueInteger": 1
|
||||
}
|
||||
],
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/capabilitystatement-supported-system",
|
||||
"name": "supported-system",
|
||||
"title": "Supported Code System",
|
||||
"status": "draft",
|
||||
"date": "2014-04-12",
|
||||
"publisher": "Health Level Seven, Inc. - [WG Name] WG",
|
||||
"contact": [
|
||||
{
|
||||
"telecom": [
|
||||
{
|
||||
"system": "url",
|
||||
"value": "http://hl7.org/special/committees/fhir.htm"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"description": "A code system that is supported by the system that is not defined in a value set resource.",
|
||||
"fhirVersion": "3.0.2",
|
||||
"mapping": [
|
||||
{
|
||||
"identity": "rim",
|
||||
"uri": "http://hl7.org/v3",
|
||||
"name": "RIM Mapping"
|
||||
}
|
||||
],
|
||||
"kind": "complex-type",
|
||||
"abstract": false,
|
||||
"contextType": "resource",
|
||||
"context": [
|
||||
"Resource"
|
||||
],
|
||||
"type": "Extension",
|
||||
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Extension",
|
||||
"derivation": "constraint",
|
||||
"differential": {
|
||||
"element": [
|
||||
{
|
||||
"id": "Extension",
|
||||
"path": "Extension",
|
||||
"short": "Code system not defined in a value set",
|
||||
"definition": "A code system that is supported by the system that is not defined in a value set resource.",
|
||||
"comment": "Typically, this is a large terminology such as LOINC, SNOMED CT.",
|
||||
"min": 0,
|
||||
"max": "*",
|
||||
"isModifier": false
|
||||
},
|
||||
{
|
||||
"id": "Extension.extension",
|
||||
"path": "Extension.extension",
|
||||
"max": "0"
|
||||
},
|
||||
{
|
||||
"id": "Extension.url",
|
||||
"path": "Extension.url",
|
||||
"type": [
|
||||
{
|
||||
"code": "uri"
|
||||
}
|
||||
],
|
||||
"fixedUri": "http://hl7.org/fhir/StructureDefinition/capabilitystatement-supported-system"
|
||||
},
|
||||
{
|
||||
"id": "Extension.valueUri",
|
||||
"path": "Extension.valueUri",
|
||||
"type": [
|
||||
{
|
||||
"code": "uri"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
{
|
||||
"resourceType": "StructureDefinition",
|
||||
"id": "capabilitystatement-websocket",
|
||||
"extension": [
|
||||
{
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
|
||||
"valueCode": "fhir"
|
||||
},
|
||||
{
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
|
||||
"valueInteger": 1
|
||||
}
|
||||
],
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/capabilitystatement-websocket",
|
||||
"name": "websocket",
|
||||
"title": "WebSocket",
|
||||
"status": "draft",
|
||||
"date": "2014-04-12",
|
||||
"publisher": "Health Level Seven, Inc. - [WG Name] WG",
|
||||
"contact": [
|
||||
{
|
||||
"telecom": [
|
||||
{
|
||||
"system": "url",
|
||||
"value": "http://hl7.org/special/committees/fhir.htm"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"description": "Where the server provides its web socket end-point.",
|
||||
"fhirVersion": "3.0.2",
|
||||
"mapping": [
|
||||
{
|
||||
"identity": "rim",
|
||||
"uri": "http://hl7.org/v3",
|
||||
"name": "RIM Mapping"
|
||||
}
|
||||
],
|
||||
"kind": "complex-type",
|
||||
"abstract": false,
|
||||
"contextType": "resource",
|
||||
"context": [
|
||||
"CapabilityStatement.rest"
|
||||
],
|
||||
"type": "Extension",
|
||||
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Extension",
|
||||
"derivation": "constraint",
|
||||
"differential": {
|
||||
"element": [
|
||||
{
|
||||
"id": "Extension",
|
||||
"path": "Extension",
|
||||
"short": "Where server websocket end point is found",
|
||||
"definition": "Where the server provides its web socket end-point.",
|
||||
"comment": "Used for web-socket based subscriptions.",
|
||||
"min": 0,
|
||||
"max": "1",
|
||||
"isModifier": false
|
||||
},
|
||||
{
|
||||
"id": "Extension.extension",
|
||||
"path": "Extension.extension",
|
||||
"max": "0"
|
||||
},
|
||||
{
|
||||
"id": "Extension.url",
|
||||
"path": "Extension.url",
|
||||
"type": [
|
||||
{
|
||||
"code": "uri"
|
||||
}
|
||||
],
|
||||
"fixedUri": "http://hl7.org/fhir/StructureDefinition/capabilitystatement-websocket"
|
||||
},
|
||||
{
|
||||
"id": "Extension.valueUri",
|
||||
"path": "Extension.valueUri",
|
||||
"type": [
|
||||
{
|
||||
"code": "uri"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue