Class HttpHealthcareApiClient
java.lang.Object
org.apache.beam.sdk.io.gcp.healthcare.HttpHealthcareApiClient
- All Implemented Interfaces:
Serializable
,HealthcareApiClient
A client that talks to the Cloud Healthcare API through HTTP requests. This client is created
mainly to encapsulate the unserializable dependencies, since most generated classes are not
serializable in the HTTP client.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
The type FhirResourcePagesIterator for methods which return paged output.static class
WrapsHttpResponse
in an exception with a statusCode field for use withHealthcareIOError
.static class
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new Http healthcare api client.Instantiates a new Http healthcare api client. -
Method Summary
Modifier and TypeMethodDescriptioncreateDicomStore
(String dataset, String name) Create a DicomStore.createDicomStore
(String dataset, String name, @Nullable String pubsubTopic) Create a DicomStore with a PubSub listener.createFhirStore
(String dataset, String name, String version) Create FHIR Store.Create FHIR Store with a PubSub topic listener.createHL7v2Message
(String hl7v2Store, Message msg) Creates an HL7v2 message.createHL7v2Store
(String dataset, String name) Create hl 7 v 2 store hl 7 v 2 store.deidentifyFhirStore
(String sourcefhirStore, String destinationFhirStore, DeidentifyConfig deidConfig) Deidentify a GCP FHIR Store and write the result into a new FHIR Store.deleteDicomStore
(String name) Delete a Dicom Store.deleteFhirStore
(String name) Delete Fhir store.deleteHL7v2Message
(String msgName) Deletes an HL7v2 message.deleteHL7v2Store
(String name) Deletes an HL7v2 store.executeFhirBundle
(String fhirStore, String bundle) Execute fhir bundle http body.exportFhirResourceToBigQuery
(String fhirStore, String bigQueryDatasetUri) Export a FHIR Resource to BigQuery.exportFhirResourceToGcs
(String fhirStore, String gcsDestinationPrefix) Export a FHIR Resource to GCS.getEarliestHL7v2SendTime
(String hl7v2Store, @Nullable String filter) Gets the earliest HL7v2 send time.getHL7v2Message
(String msgName) Gets HL7v2 message.getHL7v2Store
(String storeName) Gets HL7v2 store.com.google.api.client.json.JsonFactory
getLatestHL7v2SendTime
(String hl7v2Store, @Nullable String filter) Gets the latest HL7v2 send time.Fhir get patient everything http body.importFhirResource
(String fhirStore, String gcsSourcePath, @Nullable String contentStructure) Importing a FHIR resource from GCS.ingestHL7v2Message
(String hl7v2Store, Message msg) Ingest an HL7v2 message.listAllFhirStores
(String dataset) List all FHIR stores in a dataset.makeHL7v2ListRequest
(String hl7v2Store, @Nullable String filter, @Nullable String orderBy, @Nullable String pageToken) Make hl 7 v 2 list request list messages response.makeSendTimeBoundHL7v2ListRequest
(String hl7v2Store, Instant start, @Nullable Instant end, @Nullable String otherFilter, @Nullable String orderBy, @Nullable String pageToken) Time Bound HL7v2 list request.pollOperation
(Operation operation, Long sleepMs) Poll operation.readFhirResource
(String resourceName) Read fhir resource http body.retrieveDicomStudyMetadata
(String dicomWebPath) Retrieve DicomStudyMetadata.searchFhirResource
(String fhirStore, String resourceType, @Nullable Map<String, Object> parameters, String pageToken) Search fhir resource http body.uploadToDicomStore
(String webPath, String filePath) Upload to a Dicom Store.
-
Constructor Details
-
HttpHealthcareApiClient
Instantiates a new Http healthcare api client.- Throws:
IOException
- the io exception
-
HttpHealthcareApiClient
Instantiates a new Http healthcare api client.- Parameters:
client
- the client- Throws:
IOException
- the io exception
-
-
Method Details
-
getJsonFactory
public com.google.api.client.json.JsonFactory getJsonFactory() -
createHL7v2Store
Description copied from interface:HealthcareApiClient
Create hl 7 v 2 store hl 7 v 2 store.- Specified by:
createHL7v2Store
in interfaceHealthcareApiClient
- Parameters:
dataset
- The dataset to create the HL7v2 store in.name
- The name of the store to be created.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.
-
createFhirStore
Description copied from interface:HealthcareApiClient
Create FHIR Store.- Specified by:
createFhirStore
in interfaceHealthcareApiClient
- Parameters:
dataset
- The name of the Dataset for the FHIR store to be created in.name
- The name of the FHIR store.version
- The version of the FHIR store (DSTU2, STU3, R4).- Throws:
IOException
- The IO Exception.
-
createFhirStore
public FhirStore createFhirStore(String dataset, String name, String version, @Nullable String pubsubTopic) throws IOException Description copied from interface:HealthcareApiClient
Create FHIR Store with a PubSub topic listener.- Specified by:
createFhirStore
in interfaceHealthcareApiClient
- Parameters:
dataset
- The name of Dataset for the FHIR store to be created in.name
- The name of the FHIR store.version
- The version of the FHIR store (DSTU2, STU3, R4).pubsubTopic
- The pubsub topic listening to the FHIR store.- Throws:
IOException
- The IO Exception.
-
listAllFhirStores
Description copied from interface:HealthcareApiClient
List all FHIR stores in a dataset.- Specified by:
listAllFhirStores
in interfaceHealthcareApiClient
- Parameters:
dataset
- The dataset, in the format: projects/project_id/locations/location_id/datasets/dataset_id- Returns:
- A list of all FHIR stores in the dataset.
- Throws:
IOException
- The IO Exception.
-
deleteHL7v2Store
Description copied from interface:HealthcareApiClient
Deletes an HL7v2 store.- Specified by:
deleteHL7v2Store
in interfaceHealthcareApiClient
- Parameters:
name
- The HL7v2 store to be deleted.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.
-
deleteFhirStore
Description copied from interface:HealthcareApiClient
Delete Fhir store.- Specified by:
deleteFhirStore
in interfaceHealthcareApiClient
- Parameters:
name
- The FHIR store to be deleted.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.
-
retrieveDicomStudyMetadata
Description copied from interface:HealthcareApiClient
Retrieve DicomStudyMetadata.- Specified by:
retrieveDicomStudyMetadata
in interfaceHealthcareApiClient
- Parameters:
dicomWebPath
- The Dicom Web Path to retrieve the metadata from.- Returns:
- The study metadata.
- Throws:
IOException
- The IO Exception.
-
createDicomStore
Description copied from interface:HealthcareApiClient
Create a DicomStore.- Specified by:
createDicomStore
in interfaceHealthcareApiClient
- Parameters:
dataset
- The dataset that the Dicom Store should be in, in the format: projects/project_id/locations/location_id/datasets/dataset_id.name
- The name of the Dicom Store to be created.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.
-
deleteDicomStore
Description copied from interface:HealthcareApiClient
Delete a Dicom Store.- Specified by:
deleteDicomStore
in interfaceHealthcareApiClient
- Parameters:
name
- The name of the Dicom Store to be deleted.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.
-
uploadToDicomStore
public Empty uploadToDicomStore(String webPath, String filePath) throws IOException, URISyntaxException Description copied from interface:HealthcareApiClient
Upload to a Dicom Store.- Specified by:
uploadToDicomStore
in interfaceHealthcareApiClient
- Parameters:
webPath
- String format of webPath to upload into.filePath
- filePath of file to upload.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.URISyntaxException
-
createDicomStore
public DicomStore createDicomStore(String dataset, String name, @Nullable String pubsubTopic) throws IOException Description copied from interface:HealthcareApiClient
Create a DicomStore with a PubSub listener.- Specified by:
createDicomStore
in interfaceHealthcareApiClient
- Parameters:
dataset
- The dataset that the Dicom Store should be in, in the format: projects/project_id/locations/location_id/datasets/dataset_idname
- The name of the Dicom Store to be created.pubsubTopic
- Name of PubSub topic connected with the Dicom store.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.
-
getEarliestHL7v2SendTime
public Instant getEarliestHL7v2SendTime(String hl7v2Store, @Nullable String filter) throws IOException Description copied from interface:HealthcareApiClient
Gets the earliest HL7v2 send time.- Specified by:
getEarliestHL7v2SendTime
in interfaceHealthcareApiClient
- Parameters:
hl7v2Store
- The HL7v2 store.filter
- the filter to be matched on.- Returns:
- The earliest HL7v2 send time.
- Throws:
IOException
- The IO Exception.
-
getLatestHL7v2SendTime
public Instant getLatestHL7v2SendTime(String hl7v2Store, @Nullable String filter) throws IOException Description copied from interface:HealthcareApiClient
Gets the latest HL7v2 send time.- Specified by:
getLatestHL7v2SendTime
in interfaceHealthcareApiClient
- Parameters:
hl7v2Store
- The HL7v2 store.filter
- The filter to be matched on.- Returns:
- The latest HL7v2 send time.
- Throws:
IOException
- The IO Exception.
-
makeSendTimeBoundHL7v2ListRequest
public ListMessagesResponse makeSendTimeBoundHL7v2ListRequest(String hl7v2Store, Instant start, @Nullable Instant end, @Nullable String otherFilter, @Nullable String orderBy, @Nullable String pageToken) throws IOException Description copied from interface:HealthcareApiClient
Time Bound HL7v2 list request.- Specified by:
makeSendTimeBoundHL7v2ListRequest
in interfaceHealthcareApiClient
- Parameters:
hl7v2Store
- The HL7v2 store.start
- Start time.end
- End time.otherFilter
- The filter outside of the sendTime.orderBy
- Order by.pageToken
- The page token.- Returns:
- HTTP List response.
- Throws:
IOException
- The IO Exception.
-
makeHL7v2ListRequest
public ListMessagesResponse makeHL7v2ListRequest(String hl7v2Store, @Nullable String filter, @Nullable String orderBy, @Nullable String pageToken) throws IOException Description copied from interface:HealthcareApiClient
Make hl 7 v 2 list request list messages response.- Specified by:
makeHL7v2ListRequest
in interfaceHealthcareApiClient
- Parameters:
hl7v2Store
- The HL7v2 Store.filter
- The Filter.orderBy
- Order by.pageToken
- The Page Token.- Returns:
- HTTP List response.
- Throws:
IOException
- The IO Exception.
-
getHL7v2Message
Gets HL7v2 message.- Specified by:
getHL7v2Message
in interfaceHealthcareApiClient
- Parameters:
msgName
- the msg name- Returns:
- the message
- Throws:
IOException
- the io exceptionParseException
- the parse exception
-
deleteHL7v2Message
Description copied from interface:HealthcareApiClient
Deletes an HL7v2 message.- Specified by:
deleteHL7v2Message
in interfaceHealthcareApiClient
- Parameters:
msgName
- The message name to be deleted.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.
-
getHL7v2Store
Gets HL7v2 store.- Specified by:
getHL7v2Store
in interfaceHealthcareApiClient
- Parameters:
storeName
- the store name- Returns:
- the HL7v2 store
- Throws:
IOException
- the io exception
-
ingestHL7v2Message
Description copied from interface:HealthcareApiClient
Ingest an HL7v2 message.- Specified by:
ingestHL7v2Message
in interfaceHealthcareApiClient
- Parameters:
hl7v2Store
- The HL7v2 store of the message.msg
- The message.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.
-
createHL7v2Message
Description copied from interface:HealthcareApiClient
Creates an HL7v2 message.- Specified by:
createHL7v2Message
in interfaceHealthcareApiClient
- Parameters:
hl7v2Store
- The HL7v2 store to create a message in.msg
- The message to create.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.
-
importFhirResource
public Operation importFhirResource(String fhirStore, String gcsSourcePath, @Nullable String contentStructure) throws IOException Description copied from interface:HealthcareApiClient
Importing a FHIR resource from GCS.- Specified by:
importFhirResource
in interfaceHealthcareApiClient
- Parameters:
fhirStore
- the FhirStore to import into.gcsSourcePath
- the GCS Path of resource.contentStructure
- The content structure.- Returns:
- Empty.
- Throws:
IOException
- the io exception
-
exportFhirResourceToGcs
public Operation exportFhirResourceToGcs(String fhirStore, String gcsDestinationPrefix) throws IOException Description copied from interface:HealthcareApiClient
Export a FHIR Resource to GCS.- Specified by:
exportFhirResourceToGcs
in interfaceHealthcareApiClient
- Parameters:
fhirStore
- the FhirStore of the resource.gcsDestinationPrefix
- GCS Destination Prefix to export to.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.
-
exportFhirResourceToBigQuery
public Operation exportFhirResourceToBigQuery(String fhirStore, String bigQueryDatasetUri) throws IOException Description copied from interface:HealthcareApiClient
Export a FHIR Resource to BigQuery.- Specified by:
exportFhirResourceToBigQuery
in interfaceHealthcareApiClient
- Parameters:
fhirStore
- the FhirStore of the resource.bigQueryDatasetUri
- The BQ Dataset URI to export to.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.
-
deidentifyFhirStore
public Operation deidentifyFhirStore(String sourcefhirStore, String destinationFhirStore, DeidentifyConfig deidConfig) throws IOException Description copied from interface:HealthcareApiClient
Deidentify a GCP FHIR Store and write the result into a new FHIR Store.- Specified by:
deidentifyFhirStore
in interfaceHealthcareApiClient
- Parameters:
sourcefhirStore
- the FhirStore to be deidentified.destinationFhirStore
- the FhirStore that the deidentified data will be written to.deidConfig
- the deidCongig specifying form of deidentification.- Returns:
- Empty.
- Throws:
IOException
- The IO Exception.
-
pollOperation
public Operation pollOperation(Operation operation, Long sleepMs) throws InterruptedException, IOException Description copied from interface:HealthcareApiClient
Poll operation.- Specified by:
pollOperation
in interfaceHealthcareApiClient
- Parameters:
operation
- to be polled.sleepMs
- length of time to wait between requests.- Returns:
- HTTP Request (that returns status of operation).
- Throws:
IOException
- The IO Exception.InterruptedException
-
executeFhirBundle
Description copied from interface:HealthcareApiClient
Execute fhir bundle http body.- Specified by:
executeFhirBundle
in interfaceHealthcareApiClient
- Parameters:
fhirStore
- the fhir storebundle
- the bundle- Returns:
- the http body
- Throws:
IOException
- The IO Exception.
-
readFhirResource
Description copied from interface:HealthcareApiClient
Read fhir resource http body.- Specified by:
readFhirResource
in interfaceHealthcareApiClient
- Parameters:
resourceName
- the resource name, in format projects/{p}/locations/{l}/datasets/{d}/fhirStores/{f}/fhir/{resourceType}/{id}- Returns:
- the http body
- Throws:
IOException
- The IO Exception.
-
searchFhirResource
public HttpBody searchFhirResource(String fhirStore, String resourceType, @Nullable Map<String, Object> parameters, String pageToken) throws IOExceptionDescription copied from interface:HealthcareApiClient
Search fhir resource http body.- Specified by:
searchFhirResource
in interfaceHealthcareApiClient
- Parameters:
fhirStore
- the fhir storeresourceType
- the resource typeparameters
- The parameters (in the form of key-value pairs).- Returns:
- the http body
- Throws:
IOException
- The IO Exception.
-
getPatientEverything
public HttpBody getPatientEverything(String resourceName, @Nullable Map<String, Object> filters, String pageToken) throws IOExceptionDescription copied from interface:HealthcareApiClient
Fhir get patient everything http body.- Specified by:
getPatientEverything
in interfaceHealthcareApiClient
- Parameters:
resourceName
- the resource name, in format projects/{p}/locations/{l}/datasets/{d}/fhirStores/{f}/fhir/{resourceType}/{id}filters
- optional request filters (in key value pairs).- Returns:
- the http body
- Throws:
IOException
- The IO Exception.
-