use of org.hl7.fhir.r4b.model.ValueSet in project bunsen by cerner.
the class ValueSetsTest method testWriteToNewTables.
@Test
public void testWriteToNewTables() {
String database = "test_valuesets_write";
spark.sql("CREATE DATABASE " + database);
ValueSets valueSets = ValueSets.getEmpty(spark).withValueSetsFromDirectory("src/test/resources/xml/valuesets");
valueSets.writeToDatabase(database);
ValueSets reloadedValueSets = ValueSets.getFromDatabase(spark, database);
ValueSet marriedValueSet = reloadedValueSets.getValueSet("urn:cerner:bunsen:valueset:married_maritalstatus", "0.0.1");
Assert.assertNotNull(marriedValueSet);
Assert.assertEquals("urn:cerner:bunsen:valueset:married_maritalstatus", marriedValueSet.getUrl());
Assert.assertEquals("0.0.1", marriedValueSet.getVersion());
Assert.assertEquals(1, marriedValueSet.getCompose().getInclude().size());
}
use of org.hl7.fhir.r4b.model.ValueSet in project bunsen by cerner.
the class ValueSetsTest method valueSet.
private static ValueSet valueSet(String valueSetUrl, String valueSetVersion, String... codes) {
ValueSet valueSet = new ValueSet();
valueSet.setUrl(valueSetUrl);
valueSet.setVersion(valueSetVersion);
valueSet.setExperimental(true);
ConceptSetComponent inclusion = valueSet.getCompose().addInclude();
inclusion.setSystem("urn:cerner:system").setVersion("1");
for (String code : codes) {
inclusion.addConcept().setCode(code);
}
return valueSet;
}
use of org.hl7.fhir.r4b.model.ValueSet in project bunsen by cerner.
the class ValueSetsTest method testWithDisjointValueSetsFromDirectory.
@Test
public void testWithDisjointValueSetsFromDirectory() {
String database = "test_valuesets_disjoint";
spark.sql("CREATE DATABASE " + database);
ValueSets.getEmpty(spark).withValueSetsFromDirectory("src/test/resources/xml/valuesets").writeToDatabase(database);
ValueSets valueSets = ValueSets.getFromDatabase(spark, database).withDisjointValueSetsFromDirectory("src/test/resources/xml/valuesets", database);
ValueSet marriedValueSet = valueSets.getValueSet("urn:cerner:bunsen:valueset:married_maritalstatus", "0.0.1");
Assert.assertEquals(1, valueSets.getValueSets().count());
Assert.assertNotNull(marriedValueSet);
Assert.assertEquals("urn:cerner:bunsen:valueset:married_maritalstatus", marriedValueSet.getUrl());
Assert.assertEquals("0.0.1", marriedValueSet.getVersion());
}
use of org.hl7.fhir.r4b.model.ValueSet in project bunsen by cerner.
the class ValueSetsTest method testWithValueSetsFromDirectoryXml.
@Test
public void testWithValueSetsFromDirectoryXml() {
ValueSets valueSets = ValueSets.getEmpty(spark).withValueSetsFromDirectory("src/test/resources/xml/valuesets");
ValueSet marriedValueSet = valueSets.getValueSet("urn:cerner:bunsen:valueset:married_maritalstatus", "0.0.1");
Assert.assertNotNull(marriedValueSet);
Assert.assertEquals("urn:cerner:bunsen:valueset:married_maritalstatus", marriedValueSet.getUrl());
Assert.assertEquals("0.0.1", marriedValueSet.getVersion());
}
use of org.hl7.fhir.r4b.model.ValueSet in project bunsen by cerner.
the class ValueSetsTest method testExpandValues.
@Test
public void testExpandValues() {
ValueSet valueSet = ValueSets.getEmpty(spark).withValueSets(valueSet("urn:cerner:valueset:valueset", "1")).getValueSet("urn:cerner:valueset:valueset", "1");
List<Value> values = ValueSets.expandValues(valueSet);
Value expectedValue = new Value("urn:cerner:valueset:valueset", "1", "urn:cerner:system", "1", "a");
Assert.assertEquals(1, values.size());
Assert.assertEquals(expectedValue, values.get(0));
}
Aggregations