Search in sources :

Example 1 with IngestMessageRequest

use of com.google.api.services.healthcare.v1.model.IngestMessageRequest 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 IngestMessageRequest

use of com.google.api.services.healthcare.v1.model.IngestMessageRequest in project beam by apache.

the class HttpHealthcareApiClient method ingestHL7v2Message.

@Override
public IngestMessageResponse ingestHL7v2Message(String hl7v2Store, Message msg) throws IOException {
    IngestMessageRequest ingestMessageRequest = new IngestMessageRequest();
    ingestMessageRequest.setMessage(msg);
    return client.projects().locations().datasets().hl7V2Stores().messages().ingest(hl7v2Store, ingestMessageRequest).execute();
}
Also used : IngestMessageRequest(com.google.api.services.healthcare.v1.model.IngestMessageRequest)

Aggregations

IngestMessageRequest (com.google.api.services.healthcare.v1.model.IngestMessageRequest)2 CloudHealthcare (com.google.api.services.healthcare.v1.CloudHealthcare)1 Messages (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores.Messages)1 IngestMessageResponse (com.google.api.services.healthcare.v1.model.IngestMessageResponse)1 Message (com.google.api.services.healthcare.v1.model.Message)1