public class ValueSets extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
VALUE_SETS_DATABASE
Default database name where the value sets information is stored.
|
static String |
VALUE_SETS_TABLE
Default table name where value sets metadata is stored.
|
static String |
VALUES_TABLE
Default table name where the expanded values information is stored.
|
| Modifier and Type | Method and Description |
|---|---|
static List<Value> |
expandValues(org.hl7.fhir.dstu3.model.ValueSet valueSet)
Given a value set, returns a list of value records it contains.
|
static ValueSets |
getDefault(org.apache.spark.sql.SparkSession spark)
Returns the collection of value sets from the default database and tables.
|
static ValueSets |
getEmpty(org.apache.spark.sql.SparkSession spark)
Returns an empty ValueSets instance.
|
static ValueSets |
getFromDatabase(org.apache.spark.sql.SparkSession spark,
String databaseName)
Returns the collection of value sets from the tables in the given database.
|
org.apache.spark.sql.Dataset<Value> |
getLatestValues(Set<String> uris,
boolean includeExperimental)
Returns a dataset with the latest values for each valueset of the given uris.
|
Map<String,String> |
getLatestVersions(boolean includeExperimental)
Returns the latest version of all value sets.
|
Map<String,String> |
getLatestVersions(Set<String> uris,
boolean includeExperimental)
Returns the latest versions of a given set of value sets.
|
static org.apache.spark.sql.Encoder<UrlAndVersion> |
getUrlAndVersionEncoder()
Returns the encoder for UrlAndVersion tuples.
|
static org.apache.spark.sql.Encoder<Value> |
getValueEncoder()
Returns the encoder for values.
|
org.apache.spark.sql.Dataset<Value> |
getValues()
Returns a dataset of all values in this collection.
|
org.apache.spark.sql.Dataset<Value> |
getValues(Map<String,String> uriToVersion)
Returns a dataset with the values for each element in the map of uri to version.
|
org.apache.spark.sql.Dataset<Value> |
getValues(String uri,
String version)
Returns the values for the given URI and version.
|
org.hl7.fhir.dstu3.model.ValueSet |
getValueSet(String uri,
String version)
Returns the value set with the given uri and version, or null if there is no such value set.
|
static org.apache.spark.sql.Encoder<org.hl7.fhir.dstu3.model.ValueSet> |
getValueSetEncoder()
Returns the encoder for value sets.
|
org.apache.spark.sql.Dataset<org.hl7.fhir.dstu3.model.ValueSet> |
getValueSets()
Returns a dataset of value sets to inspect metadata.
|
ValueSets |
withDisjointValueSetsFromDirectory(String path)
Returns all value sets that are disjoint with value sets stored in the default database and
adds them to our collection.
|
ValueSets |
withDisjointValueSetsFromDirectory(String path,
String database)
Returns all value sets that are disjoint with value sets stored in the given database and
adds them to our collection.
|
ValueSets |
withValueSets(org.apache.spark.sql.Dataset<org.hl7.fhir.dstu3.model.ValueSet> valueSets)
Returns a new ValueSets instance that includes the given value sets.
|
ValueSets |
withValueSets(List<org.hl7.fhir.dstu3.model.ValueSet> valueSets) |
ValueSets |
withValueSets(org.hl7.fhir.dstu3.model.ValueSet... valueSets)
Returns a new ValueSets instance that includes the given value sets.
|
ValueSets |
withValueSetsFromDirectory(String path)
Reads all value sets from a given directory and adds them to our collection.
|
void |
writeToDatabase()
Writes the the value sets to the default database "ontologies" using default table names:
"values", and "valuesets".
|
void |
writeToDatabase(String database)
Writes the value sets to the given database using default table names: "values", "valuesets",
and "ancestors".
|
void |
writeToTables(String valuesTable,
String valueSetTable)
Writes value sets to the given tables.
|
public static final String VALUE_SETS_DATABASE
public static final String VALUES_TABLE
public static final String VALUE_SETS_TABLE
public static org.apache.spark.sql.Encoder<Value> getValueEncoder()
public static org.apache.spark.sql.Encoder<org.hl7.fhir.dstu3.model.ValueSet> getValueSetEncoder()
public static org.apache.spark.sql.Encoder<UrlAndVersion> getUrlAndVersionEncoder()
public static ValueSets getDefault(org.apache.spark.sql.SparkSession spark)
spark - the spark sessionpublic static ValueSets getFromDatabase(org.apache.spark.sql.SparkSession spark, String databaseName)
spark - the spark sessiondatabaseName - name of the database containing the value sets and values tablespublic static ValueSets getEmpty(org.apache.spark.sql.SparkSession spark)
spark - the spark sessionpublic org.apache.spark.sql.Dataset<Value> getValues()
public org.apache.spark.sql.Dataset<Value> getValues(String uri, String version)
uri - the uri of the value set for which we get valuesversion - the version of the value set for which we get valuespublic org.apache.spark.sql.Dataset<Value> getValues(Map<String,String> uriToVersion)
uriToVersion - a map of value set URI to the version to loadpublic Map<String,String> getLatestVersions(boolean includeExperimental)
includeExperimental - whether to include value sets marked as experimentalpublic Map<String,String> getLatestVersions(Set<String> uris, boolean includeExperimental)
uris - a set of URIs for which to retrieve the latest versions, or null to load them allincludeExperimental - whether to include value sets marked as experimentalpublic org.apache.spark.sql.Dataset<Value> getLatestValues(Set<String> uris, boolean includeExperimental)
uris - URIs for the value setsincludeExperimental - whether to include value sets marked as experimentalpublic org.hl7.fhir.dstu3.model.ValueSet getValueSet(String uri, String version)
uri - the uri of the value set to returnversion - the version of the value set to returnpublic org.apache.spark.sql.Dataset<org.hl7.fhir.dstu3.model.ValueSet> getValueSets()
getValues() method to query values in depth.public ValueSets withValueSetsFromDirectory(String path)
path - a path from which value sets will be loadedpublic ValueSets withDisjointValueSetsFromDirectory(String path)
path - a path from which disjoint value sets will be loadedpublic ValueSets withDisjointValueSetsFromDirectory(String path, String database)
path - a path from which disjoint value sets will be loadeddatabase - the database to check value sets againstpublic ValueSets withValueSets(org.hl7.fhir.dstu3.model.ValueSet... valueSets)
valueSets - the value sets to add to the returned collection.public ValueSets withValueSets(org.apache.spark.sql.Dataset<org.hl7.fhir.dstu3.model.ValueSet> valueSets)
valueSets - the value sets to add to the returned collection.public static List<Value> expandValues(org.hl7.fhir.dstu3.model.ValueSet valueSet)
valueSet - a value setpublic void writeToDatabase()
public void writeToDatabase(String database)
database - the name of the database to which the value sets are savedpublic void writeToTables(String valuesTable, String valueSetTable)
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.
valuesTable - name of the table to which the value records are savedvalueSetTable - name of the table to which the value set metadata is savedCopyright © 2018. All rights reserved.