-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
6 changed files
with
251 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...l7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv40_50/ValueSet40_50Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.hl7.fhir.convertors.conv40_50; | ||
|
||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; | ||
import org.hl7.fhir.r5.formats.IParser.OutputStyle; | ||
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 ValueSet40_50Test { | ||
|
||
|
||
@Test | ||
@DisplayName("Test ValueSet R4 <-> R5 with property extensions") | ||
public void testValueExpressionConversion40_10() throws IOException { | ||
InputStream r4_stream = this.getClass().getResourceAsStream("/value_set_r4.json"); | ||
org.hl7.fhir.r4.model.ValueSet r4_input = (org.hl7.fhir.r4.model.ValueSet) new org.hl7.fhir.r4.formats.JsonParser().parse(r4_stream); | ||
|
||
InputStream r5_stream = this.getClass().getResourceAsStream("/value_set_r5.json"); | ||
org.hl7.fhir.r5.model.ValueSet r5_input = (org.hl7.fhir.r5.model.ValueSet) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_stream); | ||
|
||
org.hl7.fhir.r5.model.ValueSet r5_output = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_40_50.convertResource(r4_input); | ||
org.hl7.fhir.r4.model.ValueSet r4_output = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(r5_input); | ||
|
||
org.hl7.fhir.r5.formats.JsonParser r5_parser = new org.hl7.fhir.r5.formats.JsonParser(); | ||
String r5_in = r5_parser.setOutputStyle(OutputStyle.PRETTY).composeString(r5_input); | ||
String r5_out = r5_parser.composeString(r5_output); | ||
boolean pass = r5_input.equalsDeep(r5_output); | ||
if (!pass) { | ||
System.out.println("R5. Expected out ->\n"+ r5_in + "\n\nActual out ->\n" + r5_out); | ||
} | ||
Assertions.assertTrue(pass); | ||
|
||
org.hl7.fhir.r4.formats.JsonParser r4_parser = new org.hl7.fhir.r4.formats.JsonParser(); | ||
String r4_in = r4_parser.composeString(r4_input); | ||
String r4_out = r4_parser.composeString(r4_output); | ||
pass = r4_input.equalsDeep(r4_output); | ||
if (!pass) { | ||
System.out.println("R4. Expected out ->\n"+ r4_in + "\n\nActual out ->\n" + r4_out); | ||
} | ||
Assertions.assertTrue(pass); | ||
} | ||
|
||
|
||
} |
103 changes: 103 additions & 0 deletions
103
org.hl7.fhir.convertors/src/test/resources/value_set_r4.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
{ | ||
"resourceType" : "ValueSet", | ||
"id" : "VSPHQ9", | ||
"url" : "http://example.org/ValueSet/VSPHQ9", | ||
"name" : "VSPHQ9", | ||
"status" : "active", | ||
"immutable" : true, | ||
"compose" : { | ||
"include" : [{ | ||
"system" : "http://example.org/CodeSystem/CSPHQ9", | ||
"concept" : [{ | ||
"code" : "Not-at-all", | ||
"display" : "Not at all" | ||
}, | ||
{ | ||
"code" : "Several-days", | ||
"display" : "Several days" | ||
}, | ||
{ | ||
"code" : "More than half the days", | ||
"display" : "More than half the days" | ||
}, | ||
{ | ||
"code" : "Nearly every day", | ||
"display" : "Nearly every day" | ||
}] | ||
}] | ||
}, | ||
"expansion" : { | ||
"extension" : [{ | ||
"extension" : [{ | ||
"url" : "code", | ||
"valueCode" : "itemWeight" | ||
}, | ||
{ | ||
"url" : "uri", | ||
"valueUri" : "http://hl7.org/fhir/concept-properties#itemWeight" | ||
}], | ||
"url" : "http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.property" | ||
}], | ||
"timestamp" : "2024-12-06T22:52:00-07:00", | ||
"contains" : [{ | ||
"extension" : [{ | ||
"extension" : [{ | ||
"url" : "code", | ||
"valueCode" : "itemWeight" | ||
}, | ||
{ | ||
"url" : "value[x]", | ||
"valueDecimal" : 0 | ||
}], | ||
"url" : "http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property" | ||
}], | ||
"code" : "not-at-all", | ||
"display" : "Not at all" | ||
}, | ||
{ | ||
"extension" : [{ | ||
"extension" : [{ | ||
"url" : "code", | ||
"valueCode" : "itemWeight" | ||
}, | ||
{ | ||
"url" : "value[x]", | ||
"valueDecimal" : 1 | ||
}], | ||
"url" : "http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property" | ||
}], | ||
"code" : "Several-days", | ||
"display" : "Several days" | ||
}, | ||
{ | ||
"extension" : [{ | ||
"extension" : [{ | ||
"url" : "code", | ||
"valueCode" : "itemWeight" | ||
}, | ||
{ | ||
"url" : "value[x]", | ||
"valueDecimal" : 2 | ||
}], | ||
"url" : "http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property" | ||
}], | ||
"code" : "More than half the days", | ||
"display" : "More than half the days" | ||
}, | ||
{ | ||
"extension" : [{ | ||
"extension" : [{ | ||
"url" : "code", | ||
"valueCode" : "itemWeight" | ||
}, | ||
{ | ||
"url" : "value[x]", | ||
"valueDecimal" : 4 | ||
}], | ||
"url" : "http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property" | ||
}], | ||
"code" : "Nearly every day", | ||
"display" : "Nearly every day" | ||
}] | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
org.hl7.fhir.convertors/src/test/resources/value_set_r5.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"resourceType" : "ValueSet", | ||
"id" : "VSPHQ9", | ||
"url" : "http://example.org/ValueSet/VSPHQ9", | ||
"name" : "VSPHQ9", | ||
"status" : "active", | ||
"immutable" : true, | ||
"compose" : { | ||
"include" : [{ | ||
"system" : "http://example.org/CodeSystem/CSPHQ9", | ||
"concept" : [{ | ||
"code" : "Not-at-all", | ||
"display" : "Not at all" | ||
}, | ||
{ | ||
"code" : "Several-days", | ||
"display" : "Several days" | ||
}, | ||
{ | ||
"code" : "More than half the days", | ||
"display" : "More than half the days" | ||
}, | ||
{ | ||
"code" : "Nearly every day", | ||
"display" : "Nearly every day" | ||
}] | ||
}] | ||
}, | ||
"expansion" : { | ||
"timestamp" : "2024-12-06T22:52:00-07:00", | ||
"property" : [{ | ||
"code" : "itemWeight", | ||
"uri" : "http://hl7.org/fhir/concept-properties#itemWeight" | ||
}], | ||
"contains" : [{ | ||
"code" : "not-at-all", | ||
"display" : "Not at all", | ||
"property" : [{ | ||
"code" : "itemWeight", | ||
"valueDecimal" : 0 | ||
}] | ||
}, | ||
{ | ||
"code" : "Several-days", | ||
"display" : "Several days", | ||
"property" : [{ | ||
"code" : "itemWeight", | ||
"valueDecimal" : 1 | ||
}] | ||
}, | ||
{ | ||
"code" : "More than half the days", | ||
"display" : "More than half the days", | ||
"property" : [{ | ||
"code" : "itemWeight", | ||
"valueDecimal" : 2 | ||
}] | ||
}, | ||
{ | ||
"code" : "Nearly every day", | ||
"display" : "Nearly every day", | ||
"property" : [{ | ||
"code" : "itemWeight", | ||
"valueDecimal" : 4 | ||
}] | ||
}] | ||
} | ||
} |