use of com.cerner.bunsen.spark.codes.Mapping 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");
}
use of com.cerner.bunsen.spark.codes.Mapping in project bunsen by cerner.
the class ConceptMapsTest method testLoadExpandedMappings.
@Test
public void testLoadExpandedMappings() throws FHIRException {
ConceptMap map = conceptMap("urn:cerner:map:testmap", "1");
// Explicitly create a mapping dataset to simulate an ETL load from an external source.
Mapping mapping = new Mapping();
mapping.setConceptMapUri(map.getUrl());
mapping.setConceptMapVersion(map.getVersion());
mapping.setSourceValueSet("urn:source:valueset");
mapping.setTargetValue("urn:target:valueset");
mapping.setSourceSystem("urn:source:system");
mapping.setSourceValue("urn:source:code:a");
mapping.setTargetSystem("urn:target:system");
mapping.setTargetValue("urn:target:code:1");
Dataset<Mapping> mappings = spark.createDataset(Arrays.asList(mapping), ConceptMaps.getMappingEncoder());
ConceptMaps maps = ConceptMaps.getEmpty(spark).withExpandedMap(map, mappings);
Dataset<Mapping> loadedMappings = maps.getMappings();
Assert.assertEquals(1, loadedMappings.count());
Mapping loadedMapping = loadedMappings.head();
Assert.assertEquals(mapping, loadedMapping);
}
Aggregations