use of org.hl7.fhir.dstu3.model.ValueSet in project bunsen by cerner.
the class ValueSetsTest method testWithValueSetsFromDirectoryJson.
@Test
public void testWithValueSetsFromDirectoryJson() {
ValueSets valueSets = ValueSets.getEmpty(spark).withValueSetsFromDirectory("src/test/resources/json/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.dstu3.model.ValueSet in project bunsen by cerner.
the class ValueSetsTest method testAppendValueSets.
@Test
public void testAppendValueSets() {
ValueSets original = ValueSets.getEmpty(spark).withValueSets(valueSet("urn:cerner:valueset:valueset1", "1"), valueSet("urn:cerner:valueset:valueset2", "1"));
ValueSets valueSets = original.withValueSets(valueSet("urn:cerner:valueset:valueset3", "1"));
Assert.assertEquals(2, original.getValues().count());
Assert.assertEquals(3, valueSets.getValues().count());
ValueSet firstValueSet = valueSets.getValueSet("urn:cerner:valueset:valueset1", "1");
checkValueSet(firstValueSet, "urn:cerner:valueset:valueset1", "1");
ValueSet secondValueSet = valueSets.getValueSet("urn:cerner:valueset:valueset2", "1");
checkValueSet(secondValueSet, "urn:cerner:valueset:valueset2", "1");
ValueSet newValueSet = valueSets.getValueSet("urn:cerner:valueset:valueset3", "1");
checkValueSet(newValueSet, "urn:cerner:valueset:valueset3", "1");
}
use of org.hl7.fhir.dstu3.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.dstu3.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.dstu3.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());
}
Aggregations