use of org.hl7.fhir.dstu3.model.ConceptMap in project bunsen by cerner.
the class ConceptMapsTest method testWithMapsFromDirectoryJson.
@Test
public void testWithMapsFromDirectoryJson() {
ConceptMaps maps = ConceptMaps.getEmpty(spark).withMapsFromDirectory("src/test/resources/json/conceptmaps");
ConceptMap genderMap = maps.getConceptMap("urn:cerner:poprec:fhir:conceptmap:demographics:gender", "0.0.1");
Assert.assertNotNull(genderMap);
Assert.assertEquals("urn:cerner:poprec:fhir:conceptmap:demographics:gender", genderMap.getUrl());
Assert.assertEquals("0.0.1", genderMap.getVersion());
}
use of org.hl7.fhir.dstu3.model.ConceptMap in project bunsen by cerner.
the class ConceptMapsTest method testWithDisjointMapsFromDirectory.
@Test
public void testWithDisjointMapsFromDirectory() {
String database = "test_conceptmaps_disjoint";
spark.sql("CREATE DATABASE " + database);
ConceptMaps.getEmpty(spark).withMapsFromDirectory("src/test/resources/xml/conceptmaps").writeToDatabase(database);
ConceptMaps maps = ConceptMaps.getFromDatabase(spark, database).withDisjointMapsFromDirectory("src/test/resources/xml/conceptmaps", database);
ConceptMap genderMap = maps.getConceptMap("urn:cerner:poprec:fhir:conceptmap:demographics:gender", "0.0.1");
Assert.assertEquals(1, maps.getMaps().count());
Assert.assertNotNull(genderMap);
Assert.assertEquals("urn:cerner:poprec:fhir:conceptmap:demographics:gender", genderMap.getUrl());
Assert.assertEquals("0.0.1", genderMap.getVersion());
}
use of org.hl7.fhir.dstu3.model.ConceptMap in project bunsen by cerner.
the class ConceptMapsTest method testExpandMappings.
@Test
public void testExpandMappings() {
ConceptMap conceptMap = ConceptMaps.getEmpty(spark).withConceptMaps(conceptMap("urn:cerner:conceptmap:map", "1")).getConceptMap("urn:cerner:conceptmap:map", "1");
List<Mapping> mappings = ConceptMaps.expandMappings(conceptMap);
Mapping expectedValue = new Mapping("urn:cerner:conceptmap:map", "1", "urn:source:valueset", "urn:target:valueset", "urn:source:system", "urn:source:code:a", "urn:target:system", "urn:target:code:1", Mapping.EQUIVALENT);
Assert.assertEquals(1, mappings.size());
Assert.assertEquals(expectedValue, mappings.get(0));
}
use of org.hl7.fhir.dstu3.model.ConceptMap in project bunsen by cerner.
the class ConceptMapsTest method testAppendMappings.
@Test
public void testAppendMappings() throws FHIRException {
ConceptMaps original = ConceptMaps.getEmpty(spark).withConceptMaps(conceptMap("urn:cerner:map:testmap", "1"), conceptMap("urn:cerner:map:othermap", "1"));
ConceptMaps maps = original.withConceptMaps(conceptMap("urn:cerner:map:newmap", "1"));
// The original should be unchanged.
Assert.assertEquals(2, original.getMappings().count());
Assert.assertEquals(3, maps.getMappings().count());
ConceptMap firstMap = maps.getConceptMap("urn:cerner:map:testmap", "1");
checkMap(firstMap, "urn:cerner:map:testmap", "1");
ConceptMap secondMap = maps.getConceptMap("urn:cerner:map:othermap", "1");
checkMap(secondMap, "urn:cerner:map:othermap", "1");
ConceptMap newMap = maps.getConceptMap("urn:cerner:map:newmap", "1");
checkMap(newMap, "urn:cerner:map:newmap", "1");
}
use of org.hl7.fhir.dstu3.model.ConceptMap in project bunsen by cerner.
the class ConceptMapsTest method testCreateSimpleMappings.
@Test
public void testCreateSimpleMappings() throws FHIRException {
ConceptMaps maps = ConceptMaps.getEmpty(spark).withConceptMaps(conceptMap("urn:cerner:map:testmap", "1"), conceptMap("urn:cerner:map:othermap", "1"));
Dataset<Mapping> mappings = maps.getMappings();
Assert.assertEquals(2, mappings.count());
ConceptMap firstMap = maps.getConceptMap("urn:cerner:map:testmap", "1");
checkMap(firstMap, "urn:cerner:map:testmap", "1");
ConceptMap secondMap = maps.getConceptMap("urn:cerner:map:othermap", "1");
checkMap(secondMap, "urn:cerner:map:othermap", "1");
}
Aggregations