use of com.google.api.services.healthcare.v1.model.Dataset 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());
}
use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.
the class FhirResourcePatch method fhirResourcePatch.
public static void fhirResourcePatch(String resourceName, String data) throws IOException, URISyntaxException {
// String resourceName =
// String.format(
// FHIR_NAME, "project-id", "region-id", "dataset-id", "store-id", "resource-type",
// "resource-id");
// The following data works with a Patient resource and is not intended to work with
// other types of FHIR resources. If necessary, supply new values for data that
// correspond to the FHIR resource you are patching.
// String data = "[{\"op\": \"replace\", \"path\": \"/active\", \"value\": false}]";
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
HttpClient httpClient = HttpClients.createDefault();
String uri = String.format("%sv1/%s", client.getRootUrl(), resourceName);
URIBuilder uriBuilder = new URIBuilder(uri).setParameter("access_token", getAccessToken());
StringEntity requestEntity = new StringEntity(data);
HttpUriRequest request = RequestBuilder.patch(uriBuilder.build()).setEntity(requestEntity).addHeader("Content-Type", "application/json-patch+json").addHeader("Accept-Charset", "utf-8").addHeader("Accept", "application/fhir+json; charset=utf-8").build();
// Execute the request and process the results.
HttpResponse response = httpClient.execute(request);
HttpEntity responseEntity = response.getEntity();
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
System.err.print(String.format("Exception patching FHIR resource: %s\n", response.getStatusLine().toString()));
responseEntity.writeTo(System.err);
throw new RuntimeException();
}
System.out.println("FHIR resource patched: ");
responseEntity.writeTo(System.out);
}
use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.
the class Hl7v2StoreCreate method hl7v2StoreCreate.
public static void hl7v2StoreCreate(String datasetName, String hl7v2StoreId) throws IOException {
// String datasetName =
// String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dataset-id");
// String hl7v2StoreId = "your-hl7v25-id"
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Configure the store to be created.
Map<String, String> labels = new HashMap<>();
labels.put("key1", "value1");
labels.put("key2", "value2");
Hl7V2Store content = new Hl7V2Store().setLabels(labels);
// Create request and configure any parameters.
Hl7V2Stores.Create request = client.projects().locations().datasets().hl7V2Stores().create(datasetName, content).setHl7V2StoreId(hl7v2StoreId);
// Execute the request and process the results.
Hl7V2Store response = request.execute();
System.out.println("Hl7V2Store store created: " + response.toPrettyString());
}
use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.
the class Hl7v2StoreGet method hl7v2eStoreGet.
public static void hl7v2eStoreGet(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.Get request = client.projects().locations().datasets().hl7V2Stores().get(hl7v2StoreName);
// Execute the request and process the results.
Hl7V2Store store = request.execute();
System.out.println("HL7v2 store retrieved: \n" + store.toPrettyString());
}
use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.
the class Hl7v2StoreGetIamPolicy method hl7v2StoreGetIamPolicy.
public static void hl7v2StoreGetIamPolicy(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.GetIamPolicy request = client.projects().locations().datasets().hl7V2Stores().getIamPolicy(hl7v2StoreName);
// Execute the request and process the results.
Policy policy = request.execute();
System.out.println("HL7v2 store IAMPolicy retrieved: \n" + policy.toPrettyString());
}
Aggregations