public class ConceptMaps extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CONCEPT_MAP_TABLE
Defalt table name where concept maps are stored.
|
static String |
MAPPING_DATABASE
Default database name where mapping information is stored.
|
static String |
MAPPING_TABLE
Default table name where expanded mapping information is stored.
|
| Modifier and Type | Method and Description |
|---|---|
static List<Mapping> |
expandMappings(org.hl7.fhir.dstu3.model.ConceptMap map)
Given a concept map, returns a list of mapping records it contains.
|
org.hl7.fhir.dstu3.model.ConceptMap |
getConceptMap(String uri,
String version)
Returns the concept map with the given uri and version, or null if there is no such map.
|
static org.apache.spark.sql.Encoder<org.hl7.fhir.dstu3.model.ConceptMap> |
getConceptMapEncoder()
Returns the encoder for concept maps.
|
static ConceptMaps |
getDefault(org.apache.spark.sql.SparkSession spark)
Returns the collection of concept maps from the default database and tables.
|
static ConceptMaps |
getEmpty(org.apache.spark.sql.SparkSession spark)
Returns an empty ConceptMaps instance.
|
static ConceptMaps |
getFromDatabase(org.apache.spark.sql.SparkSession spark,
String databaseName)
Returns the collection of concept maps from the tables in the given database.
|
org.apache.spark.sql.Dataset<Mapping> |
getLatestMappings(Set<String> uris,
boolean includeExperimental)
Returns a dataset with the latest mappings for each valueset here.
|
Map<String,String> |
getLatestVersions(boolean includeExperimental)
Returns the latest versions of all concept maps.
|
Map<String,String> |
getLatestVersions(Set<String> urls,
boolean includeExperimental)
Returns the latest versions of a given set of concept maps.
|
static org.apache.spark.sql.Encoder<Mapping> |
getMappingEncoder()
Returns the encoder for mappings.
|
org.apache.spark.sql.Dataset<Mapping> |
getMappings()
Returns a dataset of all mappings in this collection.
|
org.apache.spark.sql.Dataset<Mapping> |
getMappings(Map<String,String> uriToVersion)
Returns a dataset with the mappings for each uri and version.
|
org.apache.spark.sql.Dataset<Mapping> |
getMappings(String uri,
String version)
Returns the mappings for the given URI and version.
|
org.apache.spark.sql.Dataset<org.hl7.fhir.dstu3.model.ConceptMap> |
getMaps()
Returns a dataset of concept maps to inspect metadata.
|
static org.apache.spark.sql.Encoder<UrlAndVersion> |
getUrlAndVersionEncoder()
Returns the encoder for UrlAndVersion tuples.
|
ConceptMaps |
withConceptMaps(org.hl7.fhir.dstu3.model.ConceptMap... conceptMap)
Returns a new ConceptMaps instance that includes the given map.
|
ConceptMaps |
withConceptMaps(org.apache.spark.sql.Dataset<org.hl7.fhir.dstu3.model.ConceptMap> conceptMaps)
Returns a new ConceptMaps instance that includes the given maps.
|
ConceptMaps |
withConceptMaps(List<org.hl7.fhir.dstu3.model.ConceptMap> conceptMaps)
Returns a new ConceptMaps instance that includes the given maps.
|
ConceptMaps |
withDisjointMapsFromDirectory(String path)
Returns all concept maps that are disjoint with concept maps stored in the default database and
adds them to our collection.
|
ConceptMaps |
withDisjointMapsFromDirectory(String path,
String database)
Returns all concept maps that are disjoint with concept maps stored in the default database and
adds them to our collection.
|
ConceptMaps |
withExpandedMap(org.hl7.fhir.dstu3.model.ConceptMap conceptMap,
org.apache.spark.sql.Dataset<Mapping> mappings)
Returns a new ConceptMaps instance that includes the given map and expanded mappings.
|
ConceptMaps |
withMapsFromDirectory(String path)
Reads all concept maps from a given directory and adds them to
our collection.
|
void |
writeToDatabase(String database)
Writes the updated concept maps to a database using the default "mappings" and "conceptmaps"
table names.
|
void |
writeToTables(String mappingsTable,
String conceptMapTable)
Writes mappings to the given tables.
|
public static final String MAPPING_DATABASE
public static final String MAPPING_TABLE
public static final String CONCEPT_MAP_TABLE
public static org.apache.spark.sql.Encoder<Mapping> getMappingEncoder()
public static org.apache.spark.sql.Encoder<org.hl7.fhir.dstu3.model.ConceptMap> getConceptMapEncoder()
public static org.apache.spark.sql.Encoder<UrlAndVersion> getUrlAndVersionEncoder()
public static ConceptMaps getDefault(org.apache.spark.sql.SparkSession spark)
spark - the spark sessionpublic static ConceptMaps getFromDatabase(org.apache.spark.sql.SparkSession spark, String databaseName)
spark - the spark sessiondatabaseName - name of the database containing the conceptmaps and mappings tables.public static ConceptMaps getEmpty(org.apache.spark.sql.SparkSession spark)
spark - the spark sessionpublic static List<Mapping> expandMappings(org.hl7.fhir.dstu3.model.ConceptMap map)
map - a concept mappublic ConceptMaps withConceptMaps(org.apache.spark.sql.Dataset<org.hl7.fhir.dstu3.model.ConceptMap> conceptMaps)
conceptMaps - concept maps to add to the returned collection.public ConceptMaps withConceptMaps(org.hl7.fhir.dstu3.model.ConceptMap... conceptMap)
conceptMap - concept maps to addpublic ConceptMaps withConceptMaps(List<org.hl7.fhir.dstu3.model.ConceptMap> conceptMaps)
conceptMaps - concept maps to addpublic ConceptMaps withExpandedMap(org.hl7.fhir.dstu3.model.ConceptMap conceptMap, org.apache.spark.sql.Dataset<Mapping> mappings)
conceptMap - concept map to addmappings - dataset of mappings to add to addpublic ConceptMaps withMapsFromDirectory(String path)
path - a path from which concept maps will be loadedpublic ConceptMaps withDisjointMapsFromDirectory(String path)
path - a path from which disjoint concept maps will be loadedpublic ConceptMaps withDisjointMapsFromDirectory(String path, String database)
path - a path from which disjoint concept maps will be loadeddatabase - the database to check concept maps againstpublic org.hl7.fhir.dstu3.model.ConceptMap getConceptMap(String uri, String version)
uri - the uri of the map to returnversion - the version of the map to returnpublic org.apache.spark.sql.Dataset<org.hl7.fhir.dstu3.model.ConceptMap> getMaps()
getMappings() method to query mappings
in depth.public org.apache.spark.sql.Dataset<Mapping> getMappings()
public org.apache.spark.sql.Dataset<Mapping> getMappings(String uri, String version)
uri - the uri of the concept map for which we get mappingsversion - the version of the concept map for which we get mappingspublic org.apache.spark.sql.Dataset<Mapping> getMappings(Map<String,String> uriToVersion)
uriToVersion - a map of concept map URI to the version to loadpublic org.apache.spark.sql.Dataset<Mapping> getLatestMappings(Set<String> uris, boolean includeExperimental)
uris - URIs for the value setsincludeExperimental - include valuesets labeled as experimentalpublic Map<String,String> getLatestVersions(boolean includeExperimental)
includeExperimental - flag to include concept maps marked as experimentalpublic Map<String,String> getLatestVersions(Set<String> urls, boolean includeExperimental)
urls - a set of URLs to retrieve the latest version for, or null to load them all.includeExperimental - flag to include concept maps marked as experimentalpublic void writeToDatabase(String database)
database - the database name to which the concepts are saved.public void writeToTables(String mappingsTable, String conceptMapTable)
Warning: these updates are likely not atomic due to the lack of transactional semantics in the underlying data store. Concurrent users may see previous items removed before new ones are added, or items appear separately than others. This is intended for use in a user-specific sandbox or staging environment.
mappingsTable - name of the table containing the mapping recordsconceptMapTable - name of the table containing the concept map metadataCopyright © 2018. All rights reserved.