Search in sources :

Example 6 with Datasets

use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.

the class HL7v2MessageIngest method hl7v2MessageIngest.

public static void hl7v2MessageIngest(String hl7v2StoreName, String filePath) throws IOException {
    // String hl7v2StoreName =
    // String.format(
    // HL7v2_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-hl7v2-id");
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Load the data from file and format it into an ingest request.
    List<String> lines = Files.readAllLines(Paths.get(filePath), Charset.defaultCharset());
    String data = String.join("\n", lines);
    Message message = new Message().setData(data);
    IngestMessageRequest ingestRequest = new IngestMessageRequest().setMessage(message);
    // Create request and configure any parameters.
    Messages.Ingest request = client.projects().locations().datasets().hl7V2Stores().messages().ingest(hl7v2StoreName, ingestRequest);
    // Execute the request and process the results.
    IngestMessageResponse response = request.execute();
    System.out.println("HL7v2 message ingested: " + response.toPrettyString());
}
Also used : Messages(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores.Messages) Message(com.google.api.services.healthcare.v1.model.Message) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare) IngestMessageRequest(com.google.api.services.healthcare.v1.model.IngestMessageRequest) IngestMessageResponse(com.google.api.services.healthcare.v1.model.IngestMessageResponse)

Example 7 with Datasets

use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.

the class HL7v2MessagePatch method hl7v2MessagePatch.

public static void hl7v2MessagePatch(String hl7v2MessageName) throws IOException {
    // String hl7v2MessageName =
    // String.format(
    // MESSAGE_NAME, "project-id", "region-id", "dataset-id", "hl7v2-id", "message-id");
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Fetch the initial state of the message.
    Messages.Get getRequest = client.projects().locations().datasets().hl7V2Stores().messages().get(hl7v2MessageName);
    Message message = getRequest.execute();
    // Update the Message fields as needed as needed. For a full list of Message fields, see:
    // https://cloud.google.com/healthcare/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.messages
    Map<String, String> labels = new HashMap<>();
    labels.put("key1", "value1");
    labels.put("key2", "value2");
    message.setLabels(labels);
    // Create request and configure any parameters.
    Messages.Patch request = client.projects().locations().datasets().hl7V2Stores().messages().patch(hl7v2MessageName, message).setUpdateMask("labels");
    // Execute the request and process the results.
    message = request.execute();
    System.out.println("HL7v2 message patched: \n" + message.toPrettyString());
}
Also used : Messages(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores.Messages) Message(com.google.api.services.healthcare.v1.model.Message) HashMap(java.util.HashMap) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Example 8 with Datasets

use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.

the class DicomStoreGet method dicomeStoreGet.

public static void dicomeStoreGet(String dicomStoreName) throws IOException {
    // String dicomStoreName =
    // String.format(
    // DICOM_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-dicom-id");
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Create request and configure any parameters.
    DicomStores.Get request = client.projects().locations().datasets().dicomStores().get(dicomStoreName);
    // Execute the request and process the results.
    DicomStore store = request.execute();
    System.out.println("DICOM store retrieved: \n" + store.toPrettyString());
}
Also used : DicomStores(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.DicomStores) DicomStore(com.google.api.services.healthcare.v1.model.DicomStore) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Example 9 with Datasets

use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.

the class DicomStoreGetIamPolicy method dicomStoreGetIamPolicy.

public static void dicomStoreGetIamPolicy(String dicomStoreName) throws IOException {
    // String dicomStoreName =
    // String.format(
    // DICOM_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-dicom-id");
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Create request and configure any parameters.
    DicomStores.GetIamPolicy request = client.projects().locations().datasets().dicomStores().getIamPolicy(dicomStoreName);
    // Execute the request and process the results.
    Policy policy = request.execute();
    System.out.println("DICOM store IAMPolicy retrieved: \n" + policy.toPrettyString());
}
Also used : Policy(com.google.api.services.healthcare.v1.model.Policy) DicomStores(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.DicomStores) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Example 10 with Datasets

use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.

the class DicomStoreImport method dicomStoreImport.

public static void dicomStoreImport(String dicomStoreName, String gcsUri) throws IOException {
    // String dicomStoreName =
    // String.format(
    // DICOM_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-dicom-id");
    // String gcsUri = "gs://your-bucket-id/path/to/destination/dir"
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Configure where the store should be imported from.
    GoogleCloudHealthcareV1DicomGcsSource gcsSource = new GoogleCloudHealthcareV1DicomGcsSource().setUri(gcsUri);
    ImportDicomDataRequest importRequest = new ImportDicomDataRequest().setGcsSource(gcsSource);
    // Create request and configure any parameters.
    DicomStores.CloudHealthcareImport request = client.projects().locations().datasets().dicomStores().healthcareImport(dicomStoreName, importRequest);
    // Execute the request, wait for the operation to complete, and process the results.
    try {
        Operation operation = request.execute();
        while (operation.getDone() == null || !operation.getDone()) {
            // Update the status of the operation with another request.
            // Pause for 500ms between requests.
            Thread.sleep(500);
            operation = client.projects().locations().datasets().operations().get(operation.getName()).execute();
        }
        System.out.println("DICOM store import complete." + operation.getResponse());
    } catch (Exception ex) {
        System.out.printf("Error during request execution: %s", ex.toString());
        ex.printStackTrace(System.out);
    }
}
Also used : GoogleCloudHealthcareV1DicomGcsSource(com.google.api.services.healthcare.v1.model.GoogleCloudHealthcareV1DicomGcsSource) DicomStores(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.DicomStores) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare) ImportDicomDataRequest(com.google.api.services.healthcare.v1.model.ImportDicomDataRequest) Operation(com.google.api.services.healthcare.v1.model.Operation) IOException(java.io.IOException)

Aggregations

CloudHealthcare (com.google.api.services.healthcare.v1.CloudHealthcare)46 DicomStores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.DicomStores)11 FhirStores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores)9 Datasets (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets)8 Policy (com.google.api.services.healthcare.v1.model.Policy)8 Hl7V2Stores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores)7 FhirStore (com.google.api.services.healthcare.v1.model.FhirStore)6 Message (com.google.api.services.healthcare.v1.model.Message)6 Operation (com.google.api.services.healthcare.v1.model.Operation)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 HttpResponse (com.google.api.client.http.HttpResponse)5 Messages (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores.Messages)5 DicomStore (com.google.api.services.healthcare.v1.model.DicomStore)5 Binding (com.google.api.services.healthcare.v1.model.Binding)4 Dataset (com.google.api.services.healthcare.v1.model.Dataset)4 Hl7V2Store (com.google.api.services.healthcare.v1.model.Hl7V2Store)4 NotificationConfig (com.google.api.services.healthcare.v1.model.NotificationConfig)4 SetIamPolicyRequest (com.google.api.services.healthcare.v1.model.SetIamPolicyRequest)4 HashMap (java.util.HashMap)4