public class Bundles extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Bundles.BundleContainer
A wrapper class for bundles that supports the use of Bundles from various
FHIR versions in Spark RDDs.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> |
extractEntry(org.apache.spark.sql.SparkSession spark,
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> bundles,
Class resourceClass)
Extracts the given resource type from the RDD of bundles and returns
it as a Dataset of that type.
|
org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> |
extractEntry(org.apache.spark.sql.SparkSession spark,
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> bundles,
Class resourceClass,
List<Class> containedClasses)
Extracts the given resource type from the RDD of bundles and returns
it as a Dataset of that type, including any declared resources contained
to the parent resource.
|
org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> |
extractEntry(org.apache.spark.sql.SparkSession spark,
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> bundles,
String resourceTypeUrl)
Extracts the given resource type from the RDD of bundles and returns
it as a Dataset of that type.
|
org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> |
extractEntry(org.apache.spark.sql.SparkSession spark,
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> bundles,
String resourceTypeUrl,
List<String> containedClassesUrls)
Extracts the given resource type from the RDD of bundles and returns
it as a Dataset of that type, including any declared resources contained
to the parent resource.
|
static Bundles |
forR4() |
static Bundles |
forStu3() |
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> |
fromJson(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> jsonBundles,
String column)
Returns an RDD of bundles loaded from the given dataset that has JSON-encoded
bundles in the given column.
|
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> |
fromJson(org.apache.spark.sql.Dataset<String> jsonBundles)
Returns an RDD of bundles loaded from the given dataset of JSON-encoded
bundles.
|
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> |
fromXml(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> xmlBundles,
String column)
Returns an RDD of bundles loaded from the given dataset that has XML-encoded
bundles in the given column.
|
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> |
fromXml(org.apache.spark.sql.Dataset<String> xmlBundles)
Returns an RDD of bundles loaded from the given dataset of XML-encoded
bundles.
|
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> |
loadFromDirectory(org.apache.spark.sql.SparkSession spark,
String path,
int minPartitions)
Returns an RDD of bundles loaded from the given path.
|
void |
saveAsDatabase(org.apache.spark.sql.SparkSession spark,
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> bundles,
String database,
String... resourceNames)
Saves an RDD of bundles as a database, where each table
has the resource name.
|
public static Bundles forStu3()
public static Bundles forR4()
public org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> loadFromDirectory(org.apache.spark.sql.SparkSession spark, String path, int minPartitions)
spark - the spark sessionpath - a path to a directory of FHIR BundlesminPartitions - a suggested value for the minimal number of partitionspublic org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> fromJson(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> jsonBundles, String column)
jsonBundles - a dataset of JSON-encoded bundlescolumn - the column in which the JSON bundle is storedpublic org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> fromJson(org.apache.spark.sql.Dataset<String> jsonBundles)
jsonBundles - a dataset of JSON-encoded bundlespublic org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> fromXml(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> xmlBundles, String column)
xmlBundles - a dataset of XML-encoded bundlescolumn - the column in which the XML bundle is storedpublic org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> fromXml(org.apache.spark.sql.Dataset<String> xmlBundles)
xmlBundles - a dataset of XML-encoded bundlespublic org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> extractEntry(org.apache.spark.sql.SparkSession spark,
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> bundles,
Class resourceClass)
spark - the spark sessionbundles - an RDD of FHIR BundlesresourceClass - the type of resource to extract.public org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> extractEntry(org.apache.spark.sql.SparkSession spark,
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> bundles,
String resourceTypeUrl)
spark - the spark sessionbundles - an RDD of FHIR BundlesresourceTypeUrl - the URL identifying the FHIR resource type or profile.public org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> extractEntry(org.apache.spark.sql.SparkSession spark,
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> bundles,
Class resourceClass,
List<Class> containedClasses)
spark - the spark sessionbundles - the RDD of FHIR BundlesresourceClass - the type of resource to extract.containedClasses - the List of type of the resources contained to the
parent resource.public org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> extractEntry(org.apache.spark.sql.SparkSession spark,
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> bundles,
String resourceTypeUrl,
List<String> containedClassesUrls)
spark - the spark sessionbundles - the RDD of FHIR BundlesresourceTypeUrl - the url of the resourcecontainedClassesUrls - the list of urls of the resources contained to the parent resourcepublic void saveAsDatabase(org.apache.spark.sql.SparkSession spark,
org.apache.spark.api.java.JavaRDD<Bundles.BundleContainer> bundles,
String database,
String... resourceNames)
Note this will access the given RDD of bundles once per resource name,
so consumers with enough memory should consider calling
JavaRDD.cache() so that RDD is not recomputed for each.
spark - the spark sessionbundles - an RDD of FHIR Bundlesdatabase - the name of the database to write toresourceNames - names of resources to be extracted from the bundle and writtenCopyright © 2020. All rights reserved.