Search in sources :

Example 6 with FhirStore

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

the class FhirStoreCreate method fhirStoreCreate.

public static void fhirStoreCreate(String datasetName, String fhirStoreId) throws IOException {
    // String datasetName =
    // String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dataset-id");
    // String fhirStoreId = "your-fhir-id"
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Configure the FhirStore to be created.
    Map<String, String> labels = new HashMap<String, String>();
    labels.put("key1", "value1");
    labels.put("key2", "value2");
    String version = "STU3";
    FhirStore content = new FhirStore().setLabels(labels).setVersion(version);
    // Create request and configure any parameters.
    FhirStores.Create request = client.projects().locations().datasets().fhirStores().create(datasetName, content).setFhirStoreId(fhirStoreId);
    // Execute the request and process the results.
    FhirStore response = request.execute();
    System.out.println("FHIR store created: " + response.toPrettyString());
}
Also used : FhirStores(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores) HashMap(java.util.HashMap) FhirStore(com.google.api.services.healthcare.v1.model.FhirStore) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Example 7 with FhirStore

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

the class FhirStoreGet method fhirStoreGet.

public static void fhirStoreGet(String fhirStoreName) throws IOException {
    // String fhirStoreName =
    // String.format(
    // FHIR_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-fhir-id");
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Create request and configure any parameters.
    FhirStores.Get request = client.projects().locations().datasets().fhirStores().get(fhirStoreName);
    // Execute the request and process the results.
    FhirStore store = request.execute();
    System.out.println("FHIR store retrieved: \n" + store.toPrettyString());
}
Also used : FhirStores(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores) FhirStore(com.google.api.services.healthcare.v1.model.FhirStore) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Example 8 with FhirStore

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

the class HttpHealthcareApiClient method exportFhirResourceToGcs.

@Override
public Operation exportFhirResourceToGcs(String fhirStore, String gcsDestinationPrefix) throws IOException {
    GoogleCloudHealthcareV1FhirGcsDestination gcsDst = new GoogleCloudHealthcareV1FhirGcsDestination();
    gcsDst.setUriPrefix(gcsDestinationPrefix);
    ExportResourcesRequest exportRequest = new ExportResourcesRequest();
    exportRequest.setGcsDestination(gcsDst);
    return client.projects().locations().datasets().fhirStores().export(fhirStore, exportRequest).execute();
}
Also used : ExportResourcesRequest(com.google.api.services.healthcare.v1.model.ExportResourcesRequest) GoogleCloudHealthcareV1FhirGcsDestination(com.google.api.services.healthcare.v1.model.GoogleCloudHealthcareV1FhirGcsDestination)

Example 9 with FhirStore

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

the class HttpHealthcareApiClient method createFhirStore.

@Override
public FhirStore createFhirStore(String dataset, String name, String version, @Nullable String pubsubTopic) throws IOException {
    FhirStore store = new FhirStore();
    store.setVersion(version);
    store.setDisableReferentialIntegrity(true);
    store.setEnableUpdateCreate(true);
    if (pubsubTopic != null) {
        NotificationConfig notificationConfig = new NotificationConfig();
        notificationConfig.setPubsubTopic(pubsubTopic);
        store.setNotificationConfig(notificationConfig);
    }
    return client.projects().locations().datasets().fhirStores().create(dataset, store).setFhirStoreId(name).execute();
}
Also used : NotificationConfig(com.google.api.services.healthcare.v1.model.NotificationConfig) FhirStore(com.google.api.services.healthcare.v1.model.FhirStore)

Example 10 with FhirStore

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

the class HttpHealthcareApiClient method listAllFhirStores.

@Override
public List<FhirStore> listAllFhirStores(String dataset) throws IOException {
    ArrayList<FhirStore> fhirStores = new ArrayList<>();
    String pageToken = "";
    do {
        ListFhirStoresResponse resp = client.projects().locations().datasets().fhirStores().list(dataset).setPageToken(pageToken).execute();
        for (FhirStore fs : resp.getFhirStores()) {
            fhirStores.add(fs);
        }
        if (resp.getNextPageToken() == null) {
            break;
        }
        pageToken = resp.getNextPageToken();
    } while (!pageToken.equals(""));
    return fhirStores;
}
Also used : ArrayList(java.util.ArrayList) FhirStore(com.google.api.services.healthcare.v1.model.FhirStore) ListFhirStoresResponse(com.google.api.services.healthcare.v1.model.ListFhirStoresResponse)

Aggregations

FhirStore (com.google.api.services.healthcare.v1.model.FhirStore)6 CloudHealthcare (com.google.api.services.healthcare.v1.CloudHealthcare)4 FhirStores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores)4 ArrayList (java.util.ArrayList)3 HttpBody (com.google.api.services.healthcare.v1.model.HttpBody)2 ListFhirStoresResponse (com.google.api.services.healthcare.v1.model.ListFhirStoresResponse)2 NotificationConfig (com.google.api.services.healthcare.v1.model.NotificationConfig)2 Search (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores.Fhir.Search)1 ExportResourcesRequest (com.google.api.services.healthcare.v1.model.ExportResourcesRequest)1 GoogleCloudHealthcareV1FhirGcsDestination (com.google.api.services.healthcare.v1.model.GoogleCloudHealthcareV1FhirGcsDestination)1 GoogleCloudHealthcareV1FhirGcsSource (com.google.api.services.healthcare.v1.model.GoogleCloudHealthcareV1FhirGcsSource)1 ImportResourcesRequest (com.google.api.services.healthcare.v1.model.ImportResourcesRequest)1 SearchResourcesRequest (com.google.api.services.healthcare.v1.model.SearchResourcesRequest)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 HashMap (java.util.HashMap)1 HttpEntity (org.apache.http.HttpEntity)1 HttpResponse (org.apache.http.HttpResponse)1