use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.
the class DatasetCreate method datasetCreate.
public static void datasetCreate(String projectId, String regionId, String datasetId) throws IOException {
// String projectId = "your-project-id";
// String regionId = "us-central1";
// String datasetId = "your-dataset-id";
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Configure the dataset to be created.
Dataset dataset = new Dataset();
dataset.setTimeZone("America/Chicago");
// Create request and configure any parameters.
String parentName = String.format("projects/%s/locations/%s", projectId, regionId);
Datasets.Create request = client.projects().locations().datasets().create(parentName, dataset);
request.setDatasetId(datasetId);
// Execute the request, wait for the operation to complete, and process the results.
try {
Operation operation = request.execute();
System.out.println(operation.toPrettyString());
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("Dataset created. Response content: " + operation.getResponse());
} catch (Exception ex) {
System.out.printf("Error during request execution: %s\n", ex.toString());
ex.printStackTrace(System.out);
}
}
use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.
the class DatasetGet method datasetGet.
public static void datasetGet(String datasetName) throws IOException {
// String datasetName =
// String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dataset-id");
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Create request and configure any parameters.
Datasets.Get request = client.projects().locations().datasets().get(datasetName);
// Execute the request and process the results.
Dataset dataset = request.execute();
System.out.println("Dataset retrieved: \n" + dataset.toPrettyString());
}
use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.
the class DicomStoreDelete method deleteDicomStore.
public static void deleteDicomStore(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.Delete request = client.projects().locations().datasets().dicomStores().delete(dicomStoreName);
// Execute the request and process the results.
request.execute();
System.out.println("DICOM store deleted.");
}
use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.
the class FhirResourceUpdate method fhirResourceUpdate.
public static void fhirResourceUpdate(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.put(uriBuilder.build()).setEntity(requestEntity).addHeader("Content-Type", "application/fhir+json;charset=utf-8").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 updating FHIR resource: %s\n", response.getStatusLine().toString()));
responseEntity.writeTo(System.err);
throw new RuntimeException();
}
System.out.println("FHIR resource updated: ");
responseEntity.writeTo(System.out);
}
use of com.google.api.services.healthcare.v1.model.Dataset 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.");
}
Aggregations