Merge pull request #501 from tyfoni/fix_conv_30_50
Issue #453: add copying of aggregation mode for conversion from 50 to 30
This commit is contained in:
commit
a765223e7b
|
@ -1 +1,5 @@
|
||||||
|
* add copying of aggregation mode for conversion from 50 to 30
|
||||||
|
* add test for Observation conversion from 10 to 40
|
||||||
|
* add procedures conversion form dstu2 to r4
|
||||||
|
* add medication conversion from dstu2 to r4
|
||||||
* Adding Maven exec to test validation cli jar
|
* Adding Maven exec to test validation cli jar
|
|
@ -1828,6 +1828,10 @@ public class VersionConvertor_30_50 extends VersionConvertor_Base {
|
||||||
tgt.setProfile(u.getValue());
|
tgt.setProfile(u.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.AggregationMode> t : src.getAggregation()) {
|
||||||
|
org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode> a = convertAggregationMode(t);
|
||||||
|
if (!tgt.hasAggregation(a.getValue())) copyElement(t, tgt.addAggregation(a.getValue()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.AggregationMode> convertAggregationMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode> src) throws FHIRException {
|
static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.AggregationMode> convertAggregationMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode> src) throws FHIRException {
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package org.hl7.fhir.convertors.conv30_50;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.VersionConvertor_30_40;
|
||||||
|
import org.hl7.fhir.convertors.VersionConvertor_30_50;
|
||||||
|
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 StructureDefinition30_50Test {
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test r5 -> dstu3 device conversion.")
|
||||||
|
public void test1() throws IOException {
|
||||||
|
InputStream r5_input = this.getClass().getResourceAsStream("/0_structuredefinition_50.json");
|
||||||
|
InputStream dstu3_expected_output = this.getClass().getResourceAsStream("/0_structuredefinition_30.json");
|
||||||
|
|
||||||
|
org.hl7.fhir.r5.model.StructureDefinition r5_actual = (org.hl7.fhir.r5.model.StructureDefinition) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_input);
|
||||||
|
org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertor_30_50.convertResource(r5_actual, true);
|
||||||
|
|
||||||
|
org.hl7.fhir.dstu3.formats.JsonParser dstu3_parser = new org.hl7.fhir.dstu3.formats.JsonParser();
|
||||||
|
org.hl7.fhir.dstu3.model.Resource dstu3_expected = dstu3_parser.parse(dstu3_expected_output);
|
||||||
|
|
||||||
|
Assertions.assertTrue(dstu3_expected.equalsDeep(dstu3_conv),
|
||||||
|
"Failed comparing\n" + dstu3_parser.composeString(dstu3_expected) + "\nand\n" + dstu3_parser.composeString(dstu3_conv));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"resourceType": "StructureDefinition",
|
||||||
|
"id": "ehealth-observation",
|
||||||
|
"url": "http://ehealth.sundhed.dk/fhir/StructureDefinition/ehealth-observation",
|
||||||
|
"name": "ehealth-observation",
|
||||||
|
"title": "eHealth Observation",
|
||||||
|
"status": "draft",
|
||||||
|
"kind": "resource",
|
||||||
|
"abstract": "false",
|
||||||
|
"type": "Observation",
|
||||||
|
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation",
|
||||||
|
"derivation": "constraint",
|
||||||
|
"snapshot": {
|
||||||
|
"element": [
|
||||||
|
{
|
||||||
|
"id": "Observation.subject",
|
||||||
|
"path": "Observation.subject",
|
||||||
|
"min": "1",
|
||||||
|
"type": [
|
||||||
|
{
|
||||||
|
"code": "Reference",
|
||||||
|
"targetProfile": [
|
||||||
|
"http://ehealth.sundhed.dk/fhir/StructureDefinition/ehealth-patient"
|
||||||
|
],
|
||||||
|
"aggregation": [
|
||||||
|
"referenced"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"resourceType": "StructureDefinition",
|
||||||
|
"id": "ehealth-observation",
|
||||||
|
"url": "http://ehealth.sundhed.dk/fhir/StructureDefinition/ehealth-observation",
|
||||||
|
"name": "ehealth-observation",
|
||||||
|
"title": "eHealth Observation",
|
||||||
|
"status": "draft",
|
||||||
|
"kind": "resource",
|
||||||
|
"abstract": "false",
|
||||||
|
"type": "Observation",
|
||||||
|
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation",
|
||||||
|
"derivation": "constraint",
|
||||||
|
"snapshot": {
|
||||||
|
"element": [
|
||||||
|
{
|
||||||
|
"id": "Observation.subject",
|
||||||
|
"path": "Observation.subject",
|
||||||
|
"min": "1",
|
||||||
|
"type": [
|
||||||
|
{
|
||||||
|
"code": "Reference",
|
||||||
|
"targetProfile": [
|
||||||
|
"http://ehealth.sundhed.dk/fhir/StructureDefinition/ehealth-patient"
|
||||||
|
],
|
||||||
|
"aggregation": [
|
||||||
|
"referenced"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue