Search in sources :

Example 31 with Dataset

use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.

the class Hl7v2StoreList method hl7v2StoreList.

public static void hl7v2StoreList(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();
    // Results are paginated, so multiple queries may be required.
    String pageToken = null;
    List<Hl7V2Store> stores = new ArrayList<>();
    do {
        // Create request and configure any parameters.
        Hl7V2Stores.List request = client.projects().locations().datasets().hl7V2Stores().list(datasetName).setPageSize(// Specify pageSize up to 1000
        100).setPageToken(pageToken);
        // Execute response and collect results.
        ListHl7V2StoresResponse response = request.execute();
        stores.addAll(response.getHl7V2Stores());
        // Update the page token for the next request.
        pageToken = response.getNextPageToken();
    } while (pageToken != null);
    // Print results.
    System.out.printf("Retrieved %s HL7v2 stores: \n", stores.size());
    for (Hl7V2Store data : stores) {
        System.out.println("\t" + data.toPrettyString());
    }
}
Also used : Hl7V2Stores(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores) ArrayList(java.util.ArrayList) ListHl7V2StoresResponse(com.google.api.services.healthcare.v1.model.ListHl7V2StoresResponse) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare) Hl7V2Store(com.google.api.services.healthcare.v1.model.Hl7V2Store)

Example 32 with Dataset

use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.

the class DatasetDeIdentify method datasetDeIdentify.

public static void datasetDeIdentify(String srcDatasetName, String destDatasetName) throws IOException {
    // String srcDatasetName =
    // String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-src-dataset-id");
    // String destDatasetName =
    // String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dest-dataset-id");
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Configure what information needs to be De-Identified.
    // For more information on de-identifying using tags, please see the following:
    // https://cloud.google.com/healthcare/docs/how-tos/dicom-deidentify#de-identification_using_tags
    TagFilterList tags = new TagFilterList().setTags(Arrays.asList("PatientID"));
    DicomConfig dicomConfig = new DicomConfig().setKeepList(tags);
    DeidentifyConfig config = new DeidentifyConfig().setDicom(dicomConfig);
    // Create the de-identify request and configure any parameters.
    DeidentifyDatasetRequest deidentifyRequest = new DeidentifyDatasetRequest().setDestinationDataset(destDatasetName).setConfig(config);
    Datasets.Deidentify request = client.projects().locations().datasets().deidentify(srcDatasetName, deidentifyRequest);
    // Execute the request, wait for the operation to complete, and process the results.
    try {
        Operation operation = request.execute();
        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("De-identified Dataset created. Response content: " + operation.getResponse());
    } catch (Exception ex) {
        System.out.printf("Error during request execution: %s", ex.toString());
        ex.printStackTrace(System.out);
    }
}
Also used : Datasets(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets) DeidentifyDatasetRequest(com.google.api.services.healthcare.v1.model.DeidentifyDatasetRequest) DeidentifyConfig(com.google.api.services.healthcare.v1.model.DeidentifyConfig) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare) Operation(com.google.api.services.healthcare.v1.model.Operation) DicomConfig(com.google.api.services.healthcare.v1.model.DicomConfig) TagFilterList(com.google.api.services.healthcare.v1.model.TagFilterList) IOException(java.io.IOException)

Example 33 with Dataset

use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.

the class DatasetDelete method datasetDelete.

public static void datasetDelete(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.Delete request = client.projects().locations().datasets().delete(datasetName);
    // Execute the request and process the results.
    request.execute();
    System.out.println("Dataset deleted.");
}
Also used : Datasets(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Example 34 with Dataset

use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.

the class DatasetGetIamPolicy method datasetGetIamPolicy.

public static void datasetGetIamPolicy(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.GetIamPolicy request = client.projects().locations().datasets().getIamPolicy(datasetName);
    // Execute the request and process the results.
    Policy policy = request.execute();
    System.out.println("Dataset IAMPolicy retrieved: \n" + policy.toPrettyString());
}
Also used : Datasets(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets) Policy(com.google.api.services.healthcare.v1.model.Policy) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Example 35 with Dataset

use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.

the class DatasetList method datasetList.

public static void datasetList(String projectId, String regionId) throws IOException {
    // String projectId = "your-project-id";
    // String regionId = "us-central1";
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Results are paginated, so multiple queries may be required.
    String parentName = String.format("projects/%s/locations/%s", projectId, regionId);
    String pageToken = null;
    List<Dataset> datasets = new ArrayList<>();
    do {
        // Create request and configure any parameters.
        Datasets.List request = client.projects().locations().datasets().list(parentName).setPageSize(// Specify pageSize up to 1000
        100).setPageToken(pageToken);
        // Execute response and collect results.
        ListDatasetsResponse response = request.execute();
        datasets.addAll(response.getDatasets());
        // Update the page token for the next request.
        pageToken = response.getNextPageToken();
    } while (pageToken != null);
    // Print results.
    System.out.printf("Retrieved %s datasets: \n", datasets.size());
    for (Dataset data : datasets) {
        System.out.println("\t" + data.toPrettyString());
    }
}
Also used : Datasets(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets) Dataset(com.google.api.services.healthcare.v1.model.Dataset) ArrayList(java.util.ArrayList) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare) ListDatasetsResponse(com.google.api.services.healthcare.v1.model.ListDatasetsResponse)

Aggregations

CloudHealthcare (com.google.api.services.healthcare.v1.CloudHealthcare)57 DicomStores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.DicomStores)11 HttpEntity (org.apache.http.HttpEntity)11 HttpResponse (org.apache.http.HttpResponse)11 HttpClient (org.apache.http.client.HttpClient)11 HttpUriRequest (org.apache.http.client.methods.HttpUriRequest)11 URIBuilder (org.apache.http.client.utils.URIBuilder)11 FhirStores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores)9 Datasets (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets)8 Policy (com.google.api.services.healthcare.v1.model.Policy)8 Hl7V2Stores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores)7 FhirStore (com.google.api.services.healthcare.v1.model.FhirStore)6 Operation (com.google.api.services.healthcare.v1.model.Operation)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 HttpResponse (com.google.api.client.http.HttpResponse)5 Messages (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores.Messages)5 DicomStore (com.google.api.services.healthcare.v1.model.DicomStore)5 Message (com.google.api.services.healthcare.v1.model.Message)5 Binding (com.google.api.services.healthcare.v1.model.Binding)4