use of com.google.api.services.healthcare.v1.model.IngestMessageResponse 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());
}
use of com.google.api.services.healthcare.v1.model.IngestMessageResponse 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();
}
Aggregations