Search in sources :

Example 1 with Hl7V2Stores

use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores 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 2 with Hl7V2Stores

use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores 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 3 with Hl7V2Stores

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

the class Hl7v2StorePatch method patchHl7v2Store.

public static void patchHl7v2Store(String hl7v2StoreName, String pubsubTopic) throws IOException {
    // String hl7v2StoreName =
    // String.format(
    // HL7v2_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-hl7v2-id");
    // String pubsubTopic = "projects/your-project-id/topics/your-pubsub-topic";
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Fetch the initial state of the HL7v2 store.
    Hl7V2Stores.Get getRequest = client.projects().locations().datasets().hl7V2Stores().get(hl7v2StoreName);
    Hl7V2Store store = getRequest.execute();
    Hl7V2NotificationConfig notificationConfig = new Hl7V2NotificationConfig();
    notificationConfig.setPubsubTopic(pubsubTopic);
    List<Hl7V2NotificationConfig> notificationConfigs = new ArrayList<Hl7V2NotificationConfig>();
    notificationConfigs.add(notificationConfig);
    // Update the Hl7v2Store fields as needed as needed. For a full list of Hl7v2Store fields, see:
    // https://cloud.google.com/healthcare/docs/reference/rest/v1/projects.locations.datasets.hl7V2Store#Hl7v2Store
    store.setNotificationConfigs(notificationConfigs);
    // Create request and configure any parameters.
    Hl7V2Stores.Patch request = client.projects().locations().datasets().hl7V2Stores().patch(hl7v2StoreName, store).setUpdateMask("notificationConfigs");
    // Execute the request and process the results.
    store = request.execute();
    System.out.println("HL7v2 store patched: \n" + store.toPrettyString());
}
Also used : Hl7V2Stores(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores) Hl7V2NotificationConfig(com.google.api.services.healthcare.v1.model.Hl7V2NotificationConfig) ArrayList(java.util.ArrayList) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare) Hl7V2Store(com.google.api.services.healthcare.v1.model.Hl7V2Store)

Example 4 with Hl7V2Stores

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

the class HL7v2MessageCreate method hl7v2MessageCreate.

public static void hl7v2MessageCreate(String hl7v2StoreName, String messageId, String filePath) throws IOException {
    // String hl7v2StoreName =
    // String.format(
    // HL7v2_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-hl7v2-id");
    // String messageId = "your-message-id";
    // String filePath = "path/to/file.txt";
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Load the data from file representing the message.
    List<String> lines = Files.readAllLines(Paths.get(filePath), Charset.defaultCharset());
    String data = String.join("\n", lines);
    Message message = new Message().setData(data).setName(messageId);
    CreateMessageRequest createRequest = new CreateMessageRequest().setMessage(message);
    // Create request and configure any parameters.
    Messages.Create request = client.projects().locations().datasets().hl7V2Stores().messages().create(hl7v2StoreName, createRequest);
    // Execute the request and process the results.
    Message response = request.execute();
    System.out.println("HL7v2 message created: " + 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) CreateMessageRequest(com.google.api.services.healthcare.v1.model.CreateMessageRequest)

Example 5 with Hl7V2Stores

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

the class Hl7v2StoreDelete method hl7v2StoreDelete.

public static void hl7v2StoreDelete(String hl7v2StoreName) 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();
    // Create request and configure any parameters.
    Hl7V2Stores.Delete request = client.projects().locations().datasets().hl7V2Stores().delete(hl7v2StoreName);
    // Execute the request and process the results.
    request.execute();
    System.out.println("HL7v2 store deleted.");
}
Also used : Hl7V2Stores(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Aggregations

CloudHealthcare (com.google.api.services.healthcare.v1.CloudHealthcare)13 Hl7V2Stores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores)7 Message (com.google.api.services.healthcare.v1.model.Message)6 Messages (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores.Messages)5 Hl7V2Store (com.google.api.services.healthcare.v1.model.Hl7V2Store)4 ListMessagesResponse (com.google.api.services.healthcare.v1.model.ListMessagesResponse)3 CreateMessageRequest (com.google.api.services.healthcare.v1.model.CreateMessageRequest)2 IngestMessageRequest (com.google.api.services.healthcare.v1.model.IngestMessageRequest)2 Policy (com.google.api.services.healthcare.v1.model.Policy)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Binding (com.google.api.services.healthcare.v1.model.Binding)1 Hl7V2NotificationConfig (com.google.api.services.healthcare.v1.model.Hl7V2NotificationConfig)1 IngestMessageResponse (com.google.api.services.healthcare.v1.model.IngestMessageResponse)1 ListHl7V2StoresResponse (com.google.api.services.healthcare.v1.model.ListHl7V2StoresResponse)1 SetIamPolicyRequest (com.google.api.services.healthcare.v1.model.SetIamPolicyRequest)1 Test (org.junit.Test)1