FHIR-Speicher erstellen und verwalten

Auf dieser Seite wird erläutert, wie Sie FHIR-Speicher (Fast Healthcare Interoperability Resources) erstellen, bearbeiten, anzeigen, auflisten und löschen. FHIR-Speicher enthalten FHIR-Ressourcen wie Anspruchsressourcen, Patientenressourcen, Medizinressourcen und mehr.

Die Cloud Healthcare API unterstützt die folgenden FHIR-Versionen:

FHIR-Speicher erstellen

Bevor Sie einen FHIR-Speicher erstellen können, müssen Sie ein Dataset erstellen.

Die folgenden Beispiele zeigen, wie Sie einen FHIR-Speicher mit der Methode projects.locations.datasets.fhirStores.create erstellen.

Console

Führen Sie die folgenden Schritte aus, um einen FHIR-Speicher zu erstellen:

  1. Rufen Sie in der Google Cloud Console die Seite Datasets auf.

    Zu „Datasets“

  2. Wählen Sie das Dataset, in dem Sie einen FHIR-Speicher erstellen möchten.
  3. Klicken Sie auf Datenspeicher erstellen.
  4. Wählen Sie FHIR als Datenspeichertyp aus.
  5. Geben Sie einen Namen ein, der in Ihrem Dataset nur einmal vorkommt. Wenn der Name nicht eindeutig ist, schlägt das Erstellen des FHIR-Speichers fehl.
  6. Klicken Sie auf Next (Weiter).
  7. So konfigurieren Sie Ihren FHIR-Speicher:
    1. Wählen Sie für den FHIR-Speicher die FHIR-Version aus, entweder DSTU2, STU3 oder R4.
    2. Wählen Sie die entsprechenden erweiterten Einstellungen aus:
      • Create update create. (Erstellen von Updates zulassen): Wählen Sie diese Option aus, um das Erstellen einer neuen Ressource mithilfe eines Aktualisierungsvorgangs mit einer benutzerdefinierten ID zuzulassen.
      • Referenzielle Integritätsprüfungen: Hiermit aktivieren Sie die referenzielle Integrität in diesem Store. Dies kann nach dem Erstellen des Speichers nicht mehr geändert werden.
      • Ressourcenversionsverwaltung: Wählen Sie diese Option aus, um frühere Versionen von Ressourcen automatisch aufzuzeichnen. Dies kann nach dem Erstellen des Speichers nicht mehr geändert werden.
    3. Wählen Sie aus den folgenden Feldern die entsprechenden Einstellungen für die Profilvalidierung aus. Weitere Informationen finden Sie unter ValidationConfig:
      • Profilvalidierung aktivieren: Wählen Sie diese Option aus, um die Profilvalidierung zu aktivieren. Wenn Sie einen Implementierungsleitfaden erzwingen möchten, der in Ihrem FHIR-Speicher aktiviert ist, müssen Sie die Profilvalidierung aktivieren.
      • Validierung der Pflichtfelder aktivieren: Wählen Sie diese Option aus, um die Validierung von Ressourcenfeldern für die Strukturdefinitionen in Ihrem FHIR-Profil zu aktivieren.
      • Prüfung des Referenztyps aktivieren: Wählen Sie diese Option aus, um die Validierung des Referenztyps zu aktivieren.
      • FHIRPath-Validierung aktivieren: Wählen Sie diese Option aus, um die FHIRPath-Kompatibilitätsprüfung zu aktivieren.
    4. Klicken Sie auf Next (Weiter).
  8. Optional: So aktivieren Sie Implementierungsleitfäden in Ihrem FHIR-Speicher:
    1. Klicken Sie auf Implementierungsleitfäden aktivieren.
    2. Klicken Sie auf die Liste Implementierungsleitfäden und maximieren Sie sie.
    3. Wählen Sie die entsprechenden Implementierungsleitfäden aus der Liste aus.

      Jeder Implementierungsleitfaden unterstützt eine bestimmte FHIR-Version. Die Liste enthält nur die Implementierungsleitfäden, die mit der ausgewählten FHIR-Speicherversion kompatibel sind.

    4. Klicken Sie auf Benutzerdefinierten IG aus Cloud Storage importieren, um ein Validierungs-Bundle für benutzerdefinierte Profile aus einem Cloud Storage-Speicherort zu importieren.
    5. Wählen Sie im Bereich Objekt auswählen eine Profilvalidierungs-Bundle-Ressource von einem Cloud Storage-Speicherort aus. Weitere Informationen finden Sie unter Implementierungsleitfäden über die Google Cloud Console aktivieren.
    6. Klicken Sie auf Auswählen.
      • Die ausgewählten Implementierungsleitfäden sind in einer Tabelle mit Version, URL und Status aufgeführt.
      • Wenn Sie Implementierungsleitfäden, aber keine Profilvalidierung aktiviert haben, tritt der Implementierungsleitfaden nicht in Kraft.
      • Klicken Sie auf Next (Weiter).
  9. Optional: So exportieren Sie Ressourcenänderungen jedes Mal nach BigQuery, wenn die FHIR-Ressourcen in Ihrem Speicher erstellt, aktualisiert, gepatcht oder gelöscht werden:
    1. Klicken Sie auf Ressourcenänderungen in BigQuery streamen.
    2. Klicken Sie auf Streamingkonfiguration hinzufügen. Weitere Informationen zum BigQuery-Streaming finden Sie unter FHIR-Ressourcenänderungen in BigQuery streamen.
    3. Wählen Sie die Tiefenebene auf dem Schieberegler Rekursive Strukturtiefe aus, um die Tiefe für alle rekursiven Strukturen im Ausgabeschema festzulegen. Der Standardwert für die rekursive Tiefe ist 2.
    4. Klicken Sie auf Fertig, um die Streamingkonfiguration zu speichern.
    5. Klicken Sie auf Next (Weiter).
  10. Optional: So konfigurieren Sie ein Pub/Sub-Thema für den FHIR-Speicher:
    1. Klicken Sie auf Cloud Pub/Sub-Benachrichtigungen erhalten.
    2. Klicken Sie auf Cloud Pub/Sub-Thema hinzufügen und wählen Sie den Namen des Themas aus.

      Wenn Sie ein Pub/Sub-Thema angeben, geben Sie den qualifizierten URI zum Thema ein, wie im folgenden Beispiel gezeigt:

      projects/PROJECT_ID/topics/PUBSUB_TOPIC
      

    3. Klicken Sie auf Next (Weiter).
  11. Optional: So fügen Sie dem Store Labels hinzu:
    1. Klicken Sie auf Labels hinzufügen, um Ihre Datenspeicher zu organisieren.
    2. Geben Sie Schlüssel und Wert für das Label ein. Weitere Informationen zu Ressourcenlabels finden Sie unter Ressourcenlabels verwenden.
    3. Klicken Sie auf Erstellen.

Der neue FHIR-Speicher wird in der Liste angezeigt.

gcloud

Führen Sie den Befehl gcloud healthcare fhir-stores create aus, um einen FHIR-Speicher im Dataset zu erstellen.

Bevor Sie die folgenden Befehlsdaten verwenden, ersetzen Sie die folgenden Werte:

  • LOCATION ist der Standort des Datasets
  • DATASET_ID: das übergeordnete Dataset des FHIR-Speichers
  • FHIR_STORE_ID ist eine Kennzeichnung für den FHIR-Speicher. Die FHIR-Speicher-ID muss Folgendes enthalten:
    • Eine im eigenen Dataset eindeutige ID
    • Einen Unicode-String mit 1 bis 256 Zeichen, der Folgendes umfasst:
      • Nummern
      • Buchstaben
      • Unterstriche
      • Bindestriche
      • Punkte
  • FHIR_STORE_VERSION ist die FHIR-Version des FHIR-Speichers Verfügbare Optionen sind DSTU2, STU3 oder R4.

Führen Sie den folgenden Befehl aus:

Linux, macOS oder Cloud Shell

gcloud healthcare fhir-stores create FHIR_STORE_ID \
  --dataset=DATASET_ID \
  --location=LOCATION \
  --version=FHIR_STORE_VERSION

Windows (PowerShell)

gcloud healthcare fhir-stores create FHIR_STORE_ID `
  --dataset=DATASET_ID `
  --location=LOCATION `
  --version=FHIR_STORE_VERSION

Windows (cmd.exe)

gcloud healthcare fhir-stores create FHIR_STORE_ID ^
  --dataset=DATASET_ID ^
  --location=LOCATION ^
  --version=FHIR_STORE_VERSION

Sie sollten eine Antwort ähnlich der folgenden erhalten:

Antwort

Created fhirStore [FHIR_STORE_ID].

REST

Bevor Sie die Anfragedaten verwenden, ersetzen Sie die folgenden Werte:

  • PROJECT_ID ist die ID Ihres Google Cloud-Projekts
  • LOCATION ist der Standort des Datasets
  • DATASET_ID: das übergeordnete Dataset des FHIR-Speichers
  • FHIR_STORE_ID ist eine Kennzeichnung für den FHIR-Speicher. Die FHIR-Speicher-ID muss Folgendes enthalten:
    • Eine im eigenen Dataset eindeutige ID
    • Einen Unicode-String mit 1 bis 256 Zeichen, der Folgendes umfasst:
      • Nummern
      • Buchstaben
      • Unterstriche
      • Bindestriche
      • Punkte
  • FHIR_STORE_VERSION ist die FHIR-Version des FHIR-Speichers Verfügbare Optionen sind DSTU2, STU3 oder R4.

JSON-Text anfordern:

{
  "version": "FHIR_STORE_VERSION"
}

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json. Führen Sie folgenden Befehl im Terminal aus, um diese Datei im aktuellen Verzeichnis zu erstellen oder zu überschreiben:

cat > request.json << 'EOF'
{
  "version": "FHIR_STORE_VERSION"
}
EOF

Führen Sie dann folgenden Befehl aus, um Ihre REST-Anfrage zu senden:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores?fhirStoreId=FHIR_STORE_ID"

PowerShell

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json. Führen Sie folgenden Befehl im Terminal aus, um diese Datei im aktuellen Verzeichnis zu erstellen oder zu überschreiben:

@'
{
  "version": "FHIR_STORE_VERSION"
}
'@  | Out-File -FilePath request.json -Encoding utf8

Führen Sie dann folgenden Befehl aus, um Ihre REST-Anfrage zu senden:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores?fhirStoreId=FHIR_STORE_ID" | Select-Object -Expand Content

APIs Explorer

Kopieren Sie den Anfragetext und öffnen Sie die Referenzseite für Methoden. Der API Explorer wird rechts auf der Seite geöffnet. Sie können mit diesem Tool interagieren, um Anfragen zu senden. Fügen Sie den Anfragetext in dieses Tool ein, füllen Sie alle Pflichtfelder aus und klicken Sie auf Ausführen.

Sie sollten in etwa folgende JSON-Antwort erhalten:

Go

import (
	"context"
	"fmt"
	"io"

	healthcare "google.golang.org/api/healthcare/v1"
)

// createFHIRStore creates an FHIR store.
func createFHIRStore(w io.Writer, projectID, location, datasetID, fhirStoreID string) error {
	ctx := context.Background()

	healthcareService, err := healthcare.NewService(ctx)
	if err != nil {
		return fmt.Errorf("healthcare.NewService: %w", err)
	}

	storesService := healthcareService.Projects.Locations.Datasets.FhirStores

	parent := fmt.Sprintf("projects/%s/locations/%s/datasets/%s", projectID, location, datasetID)
	version := "R4"

	resp, err := storesService.Create(parent, &healthcare.FhirStore{Version: version}).FhirStoreId(fhirStoreID).Do()
	if err != nil {
		return fmt.Errorf("Create: %w", err)
	}

	fmt.Fprintf(w, "Created FHIR store: %q\n", resp.Name)
	return nil
}

Java

import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.healthcare.v1.CloudHealthcare;
import com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores;
import com.google.api.services.healthcare.v1.CloudHealthcareScopes;
import com.google.api.services.healthcare.v1.model.FhirStore;
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.oauth2.GoogleCredentials;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class FhirStoreCreate {
  private static final String DATASET_NAME = "projects/%s/locations/%s/datasets/%s";
  private static final JsonFactory JSON_FACTORY = new GsonFactory();
  private static final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport();

  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<>();
    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());
  }

  private static CloudHealthcare createClient() throws IOException {
    // Use Application Default Credentials (ADC) to authenticate the requests
    // For more information see https://cloud.google.com/docs/authentication/production
    GoogleCredentials credential =
        GoogleCredentials.getApplicationDefault()
            .createScoped(Collections.singleton(CloudHealthcareScopes.CLOUD_PLATFORM));

    // Create a HttpRequestInitializer, which will provide a baseline configuration to all requests.
    HttpRequestInitializer requestInitializer =
        request -> {
          new HttpCredentialsAdapter(credential).initialize(request);
          request.setConnectTimeout(60000); // 1 minute connect timeout
          request.setReadTimeout(60000); // 1 minute read timeout
        };

    // Build the client for interacting with the service.
    return new CloudHealthcare.Builder(HTTP_TRANSPORT, JSON_FACTORY, requestInitializer)
        .setApplicationName("your-application-name")
        .build();
  }
}

Node.js

const google = require('@googleapis/healthcare');
const healthcare = google.healthcare({
  version: 'v1',
  auth: new google.auth.GoogleAuth({
    scopes: ['https://www.googleapis.com/auth/cloud-platform'],
  }),
});

const createFhirStore = async () => {
  // TODO(developer): uncomment these lines before running the sample
  // const cloudRegion = 'us-central1';
  // const projectId = 'adjective-noun-123';
  // const datasetId = 'my-dataset';
  // const fhirStoreId = 'my-fhir-store';
  // const version = 'STU3';
  const parent = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}`;
  const request = {
    parent,
    fhirStoreId,
    resource: {
      version,
    },
  };

  await healthcare.projects.locations.datasets.fhirStores.create(request);
  console.log(`Created FHIR store: ${fhirStoreId}`);
};

createFhirStore();

Python

def create_fhir_store(project_id, location, dataset_id, fhir_store_id, version):
    """Creates a new FHIR store within the parent dataset.

    See https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/healthcare/api-client/v1/fhir
    before running the sample."""
    # Imports the Google API Discovery Service.
    from googleapiclient import discovery

    api_version = "v1"
    service_name = "healthcare"
    # Returns an authorized API client by discovering the Healthcare API
    # and using GOOGLE_APPLICATION_CREDENTIALS environment variable.
    client = discovery.build(service_name, api_version)

    # TODO(developer): Uncomment these lines and replace with your values.
    # project_id = 'my-project'  # replace with your GCP project ID
    # location = 'us-central1'  # replace with the parent dataset's location
    # dataset_id = 'my-dataset'  # replace with the FHIR store's parent dataset ID
    # fhir_store_id = 'my-fhir-store'  # replace with the FHIR store's ID
    # version = 'R4'  # replace with the FHIR store version
    fhir_store_parent = "projects/{}/locations/{}/datasets/{}".format(
        project_id, location, dataset_id
    )

    body = {"version": version}

    request = (
        client.projects()
        .locations()
        .datasets()
        .fhirStores()
        .create(parent=fhir_store_parent, body=body, fhirStoreId=fhir_store_id)
    )

    response = request.execute()
    print(f"Created FHIR store: {fhir_store_id}")

    return response

Einen FHIR-Speicher bearbeiten

In folgenden Beispielen wird gezeigt, wie Sie einen FHIR-Speicher bearbeiten. Sie können einen FHIR-Speicher bearbeiten, um Attribute wie die Folgenden zu ändern:

  • Das Pub/Sub-Thema, an das die Cloud Healthcare API Benachrichtigungen über Änderungen des FHIR-Speichers sendet.
  • Die Labels des FHIR-Speichers. Labels sind Schlüssel/Wert-Paare, mit denen Sie Ihre Google Cloud-Ressourcen organisieren können.
Wenn Sie ein Pub/Sub-Thema angeben, geben Sie den qualifizierten URI zum Thema ein, wie im folgenden Beispiel gezeigt:
projects/PROJECT_ID/topics/PUBSUB_TOPIC
Damit Benachrichtigungen gesendet werden, müssen Sie dem Dienstkonto Cloud Healthcare Service Agent zusätzliche Berechtigungen erteilen. Weitere Informationen finden Sie unter Pub/Sub-Berechtigungen für DICOM-, FHIR- und HL7v2-Speicher.

Console

Führen Sie die folgenden Schritte aus, um einen FHIR-Speicher zu bearbeiten:

  1. Rufen Sie in der Google Cloud Console die Seite Datasets auf.
    Zu den Datasets

  2. Wählen Sie das Dataset mit dem FHIR-Speicher aus, den Sie bearbeiten möchten.

  3. Wählen Sie in der Liste Datenspeicher den FHIR-Speicher aus, den Sie bearbeiten möchten.

  4. Klicken Sie zum Bearbeiten der Konfiguration des Speichers auf FHIR-Speicherkonfiguration.

    Weitere Informationen zu den Konfigurationsoptionen des FHIR-Speichers finden Sie unter FHIR-Speicher erstellen.

  5. Klicken Sie zum Bearbeiten der Implementierungsleitfäden des Speichers auf Implementierungsleitfäden und wählen Sie die entsprechenden Implementierungsleitfäden aus oder importieren Sie einen benutzerdefinierten Implementierungsleitfaden aus Cloud Storage. Weitere Informationen finden Sie unter Implementierungsleitfäden über die Google Cloud Console aktivieren.

    Wenn Sie die Implementierungsleitfäden bearbeiten oder die aktivierten Implementierungsleitfäden erzwingen möchten, müssen Sie im Abschnitt FHIR-Speicherkonfiguration die Profilvalidierung aktivieren.

  6. Klicken Sie auf Neue Streaming-Konfiguration hinzufügen im Feld Dataset, um jedes Mal Ressourcenänderungen nach BigQuery zu exportieren, wenn die FHIR-Ressourcen in Ihrem Speicher erstellt, aktualisiert, gepatcht oder gelöscht werden.

  7. Wählen Sie ein BigQuery-Dataset aus, an das Ressourcenänderungen gestreamt werden sollen. Weitere Informationen zu BigQuery-Streaming finden Sie unter FHIR-Ressourcenänderungen in BigQuery streamen.

  8. Wenn Sie für alle rekursiven Strukturen im Ausgabeschema die Tiefe festlegen möchten, klicken Sie im Schieberegler Rekursive Strukturtiefe auf die entsprechende Tiefe. Standardmäßig ist die rekursive Tiefe 2.

  9. Wenn Sie Ressourcenänderungen nur für bestimmte Ressourcentypen exportieren möchten, wählen Sie die Ressourcentypen aus der Liste FHIR-Ressourcentypen auswählen aus.

  10. Wählen Sie im Abschnitt Cloud Pub/Sub-Benachrichtigungen einen Themennamen aus, um ein Pub/Sub-Thema für den Datenspeicher zu konfigurieren. Wenn Sie ein Pub/Sub-Thema angeben, geben Sie den qualifizierten URI zum Thema ein, wie im folgenden Beispiel gezeigt:

    projects/PROJECT_ID/topics/PUBSUB_TOPIC
    

  11. Um dem Speicher ein oder mehrere Labels hinzuzufügen, klicken Sie auf Labels und auf Label hinzufügen. Geben Sie dann das Schlüssel/Wert-Label ein. Weitere Informationen zu Ressourcenlabel finden Sie unter Ressourcenlabel verwenden.

  12. Klicken Sie auf Speichern.

gcloud

Führen Sie den Befehl gcloud healthcare fhir-stores update aus, um einen FHIR-Speicher zu bearbeiten.

Bevor Sie die folgenden Befehlsdaten verwenden, ersetzen Sie die folgenden Werte:

  • LOCATION ist der Standort des Datasets
  • DATASET_ID: das übergeordnete Dataset des FHIR-Speichers
  • FHIR_STORE_ID: die FHIR-Speicher-ID
  • PUBSUB_TOPIC_ID: ein Pub/Sub-Thema, in dem Nachrichten veröffentlicht werden, wenn ein Ereignis in einem Datenspeicher auftritt

Führen Sie den folgenden Befehl aus:

Linux, macOS oder Cloud Shell

gcloud healthcare fhir-stores update FHIR_STORE_ID \
  --dataset=DATASET_ID \
  --location=LOCATION \
  --pubsub-topic=projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID

Windows (PowerShell)

gcloud healthcare fhir-stores update FHIR_STORE_ID `
  --dataset=DATASET_ID `
  --location=LOCATION `
  --pubsub-topic=projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID

Windows (cmd.exe)

gcloud healthcare fhir-stores update FHIR_STORE_ID ^
  --dataset=DATASET_ID ^
  --location=LOCATION ^
  --pubsub-topic=projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID

Sie sollten eine Antwort ähnlich der folgenden erhalten:

Antwort

Updated fhirStore [FHIR_STORE_ID].
name: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID
notificationConfig:
 pubsubTopic: projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID
version: FHIR_STORE_VERSION

REST

Verwenden Sie zum Bearbeiten eines FHIR-Speichers die Methode projects.locations.datasets.fhirStores.patch.

Bevor Sie die Anfragedaten verwenden, ersetzen Sie die folgenden Werte:

  • PROJECT_ID ist die ID Ihres Google Cloud-Projekts
  • LOCATION ist der Standort des Datasets
  • DATASET_ID: das übergeordnete Dataset des FHIR-Speichers
  • FHIR_STORE_ID: die FHIR-Speicher-ID
  • PUBSUB_TOPIC_ID: die ID des Pub/Sub-Themas. Informationen zum Ermitteln der Daten, die in Pub/Sub-Benachrichtigungen enthalten sein sollen, finden Sie unter FHIR-Pub/Sub-Benachrichtigungen.
  • KEY1 ist der erste Labelschlüssel
  • VALUE1 ist der erste Labelwert
  • KEY2 ist der zweite Labelschlüssel
  • VALUE2 ist der zweite Labelwert

JSON-Text anfordern:

{
  "notificationConfig": {
    "pubsubTopic": "projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID"
  },
  "labels": {
    "KEY1": "VALUE1",
    "KEY2": "VALUE2"
  }
}

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json. Führen Sie folgenden Befehl im Terminal aus, um diese Datei im aktuellen Verzeichnis zu erstellen oder zu überschreiben:

cat > request.json << 'EOF'
{
  "notificationConfig": {
    "pubsubTopic": "projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID"
  },
  "labels": {
    "KEY1": "VALUE1",
    "KEY2": "VALUE2"
  }
}
EOF

Führen Sie dann folgenden Befehl aus, um Ihre REST-Anfrage zu senden:

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID?updateMask=notificationConfig,labels"

PowerShell

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json. Führen Sie folgenden Befehl im Terminal aus, um diese Datei im aktuellen Verzeichnis zu erstellen oder zu überschreiben:

@'
{
  "notificationConfig": {
    "pubsubTopic": "projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID"
  },
  "labels": {
    "KEY1": "VALUE1",
    "KEY2": "VALUE2"
  }
}
'@  | Out-File -FilePath request.json -Encoding utf8

Führen Sie dann folgenden Befehl aus, um Ihre REST-Anfrage zu senden:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID?updateMask=notificationConfig,labels" | Select-Object -Expand Content

APIs Explorer

Kopieren Sie den Anfragetext und öffnen Sie die Referenzseite für Methoden. Der API Explorer wird rechts auf der Seite geöffnet. Sie können mit diesem Tool interagieren, um Anfragen zu senden. Fügen Sie den Anfragetext in dieses Tool ein, füllen Sie alle Pflichtfelder aus und klicken Sie auf Ausführen.

Sie sollten in etwa folgende JSON-Antwort erhalten:

Go

import (
	"context"
	"fmt"
	"io"

	healthcare "google.golang.org/api/healthcare/v1"
)

// patchFHIRStore updates (patches) a FHIR store by updating its Pub/sub topic name.
func patchFHIRStore(w io.Writer, projectID, location, datasetID, fhirStoreID, topicName string) error {
	ctx := context.Background()

	healthcareService, err := healthcare.NewService(ctx)
	if err != nil {
		return fmt.Errorf("healthcare.NewService: %w", err)
	}

	storesService := healthcareService.Projects.Locations.Datasets.FhirStores

	name := fmt.Sprintf("projects/%s/locations/%s/datasets/%s/fhirStores/%s", projectID, location, datasetID, fhirStoreID)

	if _, err := storesService.Patch(name, &healthcare.FhirStore{
		NotificationConfig: &healthcare.NotificationConfig{
			PubsubTopic: topicName, // format is "projects/*/locations/*/topics/*"
		},
	}).UpdateMask("notificationConfig").Do(); err != nil {
		return fmt.Errorf("Patch: %w", err)
	}

	fmt.Fprintf(w, "Patched FHIR store %s with Pub/sub topic %s\n", datasetID, topicName)

	return nil
}

Java

import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.healthcare.v1.CloudHealthcare;
import com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores;
import com.google.api.services.healthcare.v1.CloudHealthcareScopes;
import com.google.api.services.healthcare.v1.model.FhirStore;
import com.google.api.services.healthcare.v1.model.NotificationConfig;
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.oauth2.GoogleCredentials;
import java.io.IOException;
import java.util.Collections;

public class FhirStorePatch {
  private static final String FHIR_NAME = "projects/%s/locations/%s/datasets/%s/fhirStores/%s";
  private static final JsonFactory JSON_FACTORY = new GsonFactory();
  private static final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport();

  public static void fhirStorePatch(String fhirStoreName, String pubsubTopic) throws IOException {
    // String fhirStoreName =
    //    String.format(
    //        FHIR_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-fhir-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 FHIR store.
    FhirStores.Get getRequest =
        client.projects().locations().datasets().fhirStores().get(fhirStoreName);
    FhirStore store = getRequest.execute();

    // Update the FhirStore fields as needed as needed. For a full list of FhirStore fields, see:
    // https://cloud.google.com/healthcare/docs/reference/rest/v1/projects.locations.datasets.fhirStores#FhirStore
    store.setNotificationConfig(new NotificationConfig().setPubsubTopic(pubsubTopic));

    // Create request and configure any parameters.
    FhirStores.Patch request =
        client
            .projects()
            .locations()
            .datasets()
            .fhirStores()
            .patch(fhirStoreName, store)
            .setUpdateMask("notificationConfig");

    // Execute the request and process the results.
    store = request.execute();
    System.out.println("Fhir store patched: \n" + store.toPrettyString());
  }

  private static CloudHealthcare createClient() throws IOException {
    // Use Application Default Credentials (ADC) to authenticate the requests
    // For more information see https://cloud.google.com/docs/authentication/production
    GoogleCredentials credential =
        GoogleCredentials.getApplicationDefault()
            .createScoped(Collections.singleton(CloudHealthcareScopes.CLOUD_PLATFORM));

    // Create a HttpRequestInitializer, which will provide a baseline configuration to all requests.
    HttpRequestInitializer requestInitializer =
        request -> {
          new HttpCredentialsAdapter(credential).initialize(request);
          request.setConnectTimeout(60000); // 1 minute connect timeout
          request.setReadTimeout(60000); // 1 minute read timeout
        };

    // Build the client for interacting with the service.
    return new CloudHealthcare.Builder(HTTP_TRANSPORT, JSON_FACTORY, requestInitializer)
        .setApplicationName("your-application-name")
        .build();
  }
}

Node.js

const google = require('@googleapis/healthcare');
const healthcare = google.healthcare({
  version: 'v1',
  auth: new google.auth.GoogleAuth({
    scopes: ['https://www.googleapis.com/auth/cloud-platform'],
  }),
});

const patchFhirStore = async () => {
  // TODO(developer): uncomment these lines before running the sample
  // const cloudRegion = 'us-central1';
  // const projectId = 'adjective-noun-123';
  // const datasetId = 'my-dataset';
  // const fhirStoreId = 'my-fhir-store';
  // const pubsubTopic = 'my-topic'
  const name = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/fhirStores/${fhirStoreId}`;
  const request = {
    name,
    updateMask: 'notificationConfig',
    resource: {
      notificationConfig: {
        pubsubTopic: `projects/${projectId}/topics/${pubsubTopic}`,
      },
    },
  };

  await healthcare.projects.locations.datasets.fhirStores.patch(request);
  console.log(
    `Patched FHIR store ${fhirStoreId} with Cloud Pub/Sub topic ${pubsubTopic}`
  );
};

patchFhirStore();

Python

def patch_fhir_store(project_id, location, dataset_id, fhir_store_id):
    """Updates the FHIR store.

    See https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/healthcare/api-client/v1/fhir
    before running the sample."""
    # Imports the Google API Discovery Service.
    from googleapiclient import discovery

    api_version = "v1"
    service_name = "healthcare"
    # Instantiates an authorized API client by discovering the Healthcare API
    # and using GOOGLE_APPLICATION_CREDENTIALS environment variable.
    client = discovery.build(service_name, api_version)

    # TODO(developer): Uncomment these lines and replace with your values.
    # project_id = 'my-project'  # replace with your GCP project ID
    # location = 'us-central1'  # replace with the dataset's location
    # dataset_id = 'my-dataset'  # replace with your dataset ID
    # fhir_store_id = 'my-fhir-store'  # replace with the FHIR store's ID
    fhir_store_parent = "projects/{}/locations/{}/datasets/{}".format(
        project_id, location, dataset_id
    )
    fhir_store_name = f"{fhir_store_parent}/fhirStores/{fhir_store_id}"

    # TODO(developer): Replace with the full URI of an existing Pub/Sub topic
    patch = {"notificationConfig": None}

    request = (
        client.projects()
        .locations()
        .datasets()
        .fhirStores()
        .patch(name=fhir_store_name, updateMask="notificationConfig", body=patch)
    )

    response = request.execute()
    print(f"Patched FHIR store {fhir_store_id} with Cloud Pub/Sub topic: None")

    return response

FHIR-Speicherdetails abrufen

In den folgenden Beispielen wird gezeigt, wie Sie Details zu einem FHIR-Speicher abrufen können.

Console

So sehen Sie sich die Details eines FHIR-Speichers an:

  1. Rufen Sie in der Google Cloud Console die Seite „Datasets” auf.

    Zu „Datasets“

  2. Wählen Sie das Dataset aus, das den FHIR-Speicher enthält.
  3. Klicken Sie auf den Namen des FHIR-Speichers.

gcloud

Führen Sie den Befehl gcloud healthcare fhir-stores describe aus, um Details zu einem FHIR-Speicher abzurufen.

Bevor Sie die folgenden Befehlsdaten verwenden, ersetzen Sie die folgenden Werte:

  • LOCATION ist der Standort des Datasets
  • DATASET_ID: das übergeordnete Dataset des FHIR-Speichers
  • FHIR_STORE_ID ist die FHIR-Speicher-ID

Führen Sie den folgenden Befehl aus:

Linux, macOS oder Cloud Shell

gcloud healthcare fhir-stores describe FHIR_STORE_ID \
 --dataset=DATASET_ID \
 --location=LOCATION

Windows (PowerShell)

gcloud healthcare fhir-stores describe FHIR_STORE_ID `
 --dataset=DATASET_ID `
 --location=LOCATION

Windows (cmd.exe)

gcloud healthcare fhir-stores describe FHIR_STORE_ID ^
 --dataset=DATASET_ID ^
 --location=LOCATION

Sie sollten eine Antwort ähnlich der folgenden erhalten:

Wenn Sie in der Ressource FhirStore Felder konfiguriert haben, werden diese auch in der Antwort angezeigt.

Antwort

...
name: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID
...
version: FHIR_STORE_VERSION

REST

Details zu einem FHIR-Speicher erhalten Sie mit der Methode projects.locations.datasets.fhirStores.get.

Bevor Sie die Anfragedaten verwenden, ersetzen Sie die folgenden Werte:

  • PROJECT_ID ist die ID Ihres Google Cloud-Projekts
  • LOCATION ist der Standort des Datasets
  • DATASET_ID: das übergeordnete Dataset des FHIR-Speichers
  • FHIR_STORE_ID ist die FHIR-Speicher-ID

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Führen Sie folgenden Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID"

PowerShell

Führen Sie folgenden Befehl aus:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID" | Select-Object -Expand Content

APIs Explorer

Öffnen Sie die Methodenreferenzseite. Der API Explorer wird rechts auf der Seite geöffnet. Sie können mit diesem Tool interagieren, um Anfragen zu senden. Füllen Sie die Pflichtfelder aus und klicken Sie auf Ausführen.

Sie sollten eine Antwort ähnlich der folgenden erhalten:

Wenn Sie in der Ressource FhirStore Felder konfiguriert haben, werden diese auch in der Antwort angezeigt.

Go

import (
	"context"
	"fmt"
	"io"

	healthcare "google.golang.org/api/healthcare/v1"
)

// getFHIRStore gets an FHIR store.
func getFHIRStore(w io.Writer, projectID, location, datasetID, fhirStoreID string) error {
	ctx := context.Background()

	healthcareService, err := healthcare.NewService(ctx)
	if err != nil {
		return fmt.Errorf("healthcare.NewService: %w", err)
	}

	storesService := healthcareService.Projects.Locations.Datasets.FhirStores

	name := fmt.Sprintf("projects/%s/locations/%s/datasets/%s/fhirStores/%s", projectID, location, datasetID, fhirStoreID)

	store, err := storesService.Get(name).Do()
	if err != nil {
		return fmt.Errorf("Get: %w", err)
	}

	fmt.Fprintf(w, "Got FHIR store: %q\n", store.Name)
	return nil
}

Java

import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.healthcare.v1.CloudHealthcare;
import com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores;
import com.google.api.services.healthcare.v1.CloudHealthcareScopes;
import com.google.api.services.healthcare.v1.model.FhirStore;
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.oauth2.GoogleCredentials;
import java.io.IOException;
import java.util.Collections;

public class FhirStoreGet {
  private static final String FHIR_NAME = "projects/%s/locations/%s/datasets/%s/fhirStores/%s";
  private static final JsonFactory JSON_FACTORY = new GsonFactory();
  private static final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport();

  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());
  }

  private static CloudHealthcare createClient() throws IOException {
    // Use Application Default Credentials (ADC) to authenticate the requests
    // For more information see https://cloud.google.com/docs/authentication/production
    GoogleCredentials credential =
        GoogleCredentials.getApplicationDefault()
            .createScoped(Collections.singleton(CloudHealthcareScopes.CLOUD_PLATFORM));

    // Create a HttpRequestInitializer, which will provide a baseline configuration to all requests.
    HttpRequestInitializer requestInitializer =
        request -> {
          new HttpCredentialsAdapter(credential).initialize(request);
          request.setConnectTimeout(60000); // 1 minute connect timeout
          request.setReadTimeout(60000); // 1 minute read timeout
        };

    // Build the client for interacting with the service.
    return new CloudHealthcare.Builder(HTTP_TRANSPORT, JSON_FACTORY, requestInitializer)
        .setApplicationName("your-application-name")
        .build();
  }
}

Node.js

const google = require('@googleapis/healthcare');
const healthcare = google.healthcare({
  version: 'v1',
  auth: new google.auth.GoogleAuth({
    scopes: ['https://www.googleapis.com/auth/cloud-platform'],
  }),
});

const getFhirStore = async () => {
  // TODO(developer): uncomment these lines before running the sample
  // const cloudRegion = 'us-central1';
  // const projectId = 'adjective-noun-123';
  // const datasetId = 'my-dataset';
  // const fhirStoreId = 'my-fhir-store';
  const name = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/fhirStores/${fhirStoreId}`;
  const request = {name};

  const fhirStore =
    await healthcare.projects.locations.datasets.fhirStores.get(request);
  console.log(fhirStore.data);
};

getFhirStore();

Python

def get_fhir_store(project_id, location, dataset_id, fhir_store_id):
    """Gets the specified FHIR store.

    See https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/healthcare/api-client/v1/fhir
    before running the sample."""
    # Imports the Google API Discovery Service.
    from googleapiclient import discovery

    # Imports Python's built-in "json" module
    import json

    api_version = "v1"
    service_name = "healthcare"
    # Instantiates an authorized API client by discovering the Healthcare API
    # and using GOOGLE_APPLICATION_CREDENTIALS environment variable.
    client = discovery.build(service_name, api_version)

    # TODO(developer): Uncomment these lines and replace with your values.
    # project_id = 'my-project'  # replace with your GCP project ID
    # location = 'us-central1'  # replace with the parent dataset's location
    # dataset_id = 'my-dataset'  # replace with the FHIR store's parent dataset
    # fhir_store_id = 'my-fhir-store'  # replace with the FHIR store's ID
    fhir_store_parent = "projects/{}/locations/{}/datasets/{}".format(
        project_id, location, dataset_id
    )
    fhir_store_name = f"{fhir_store_parent}/fhirStores/{fhir_store_id}"

    fhir_stores = client.projects().locations().datasets().fhirStores()
    fhir_store = fhir_stores.get(name=fhir_store_name).execute()

    print(json.dumps(fhir_store, indent=2))
    return fhir_store

FHIR-Speicher in einem Dataset auflisten

In den folgenden Beispielen wird gezeigt, wie Sie die FHIR-Speicher in einem Dataset auflisten.

Console

So zeigen Sie die Datenspeicher in einem Dataset an:

  1. Rufen Sie in der Google Cloud Console die Seite Datasets auf.

    Zu „Datasets“

  2. Wählen Sie das Dataset aus, das den Datenspeicher enthält, den Sie anzeigen möchten.

gcloud

Führen Sie den Befehl gcloud healthcare fhir-stores list aus, um Details zu einem FHIR-Speicher anzuzeigen.

Bevor Sie die folgenden Befehlsdaten verwenden, ersetzen Sie die folgenden Werte:

  • DATASET_ID ist das übergeordnete Dataset des FHIR-Speichers
  • LOCATION ist der Standort des Datasets

Führen Sie den folgenden Befehl aus:

Linux, macOS oder Cloud Shell

gcloud healthcare fhir-stores list --dataset=DATASET_ID --location=LOCATION

Windows (PowerShell)

gcloud healthcare fhir-stores list --dataset=DATASET_ID --location=LOCATION

Windows (cmd.exe)

gcloud healthcare fhir-stores list --dataset=DATASET_ID --location=LOCATION

Sie sollten eine Antwort ähnlich der folgenden erhalten:

Wenn Sie in der Ressource FhirStore Felder konfiguriert haben, werden diese auch in der Antwort angezeigt.

ID             LOCATION     REF_INT  RES_VER  UPDATE_CREATE  TOPIC
FHIR_STORE_ID  LOCATION                                       PUBSUB_TOPIC
...

REST

Verwenden Sie die Methode projects.locations.datasets.fhirStores.list, um die FHIR-Speicher in einem Dataset aufzulisten.

Bevor Sie die Anfragedaten verwenden, ersetzen Sie die folgenden Werte:

  • PROJECT_ID ist die ID Ihres Google Cloud-Projekts
  • DATASET_ID ist das übergeordnete Dataset des FHIR-Speichers
  • LOCATION ist der Standort des Datasets

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Führen Sie folgenden Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores"

PowerShell

Führen Sie folgenden Befehl aus:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores" | Select-Object -Expand Content

APIs Explorer

Öffnen Sie die Methodenreferenzseite. Der API Explorer wird rechts auf der Seite geöffnet. Sie können mit diesem Tool interagieren, um Anfragen zu senden. Füllen Sie die Pflichtfelder aus und klicken Sie auf Ausführen.

Sie sollten eine Antwort ähnlich der folgenden erhalten:

Wenn Sie in der Ressource FhirStore Felder konfiguriert haben, werden diese auch in der Antwort angezeigt.

Go

import (
	"context"
	"fmt"
	"io"

	healthcare "google.golang.org/api/healthcare/v1"
)

// listFHIRStores prints a list of FHIR stores to w.
func listFHIRStores(w io.Writer, projectID, location, datasetID string) error {
	ctx := context.Background()

	healthcareService, err := healthcare.NewService(ctx)
	if err != nil {
		return fmt.Errorf("healthcare.NewService: %w", err)
	}

	storesService := healthcareService.Projects.Locations.Datasets.FhirStores

	parent := fmt.Sprintf("projects/%s/locations/%s/datasets/%s", projectID, location, datasetID)

	resp, err := storesService.List(parent).Do()
	if err != nil {
		return fmt.Errorf("List: %w", err)
	}

	fmt.Fprintln(w, "FHIR stores:")
	for _, s := range resp.FhirStores {
		fmt.Fprintln(w, s.Name)
	}
	return nil
}

Java

import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.healthcare.v1.CloudHealthcare;
import com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores;
import com.google.api.services.healthcare.v1.CloudHealthcareScopes;
import com.google.api.services.healthcare.v1.model.FhirStore;
import com.google.api.services.healthcare.v1.model.ListFhirStoresResponse;
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.oauth2.GoogleCredentials;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class FhirStoreList {
  private static final String DATASET_NAME = "projects/%s/locations/%s/datasets/%s";
  private static final JsonFactory JSON_FACTORY = new GsonFactory();
  private static final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport();

  public static void fhirStoreList(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<FhirStore> stores = new ArrayList<>();
    do {
      // Create request and configure any parameters.
      FhirStores.List request =
          client
              .projects()
              .locations()
              .datasets()
              .fhirStores()
              .list(datasetName)
              .setPageSize(100) // Specify pageSize up to 1000
              .setPageToken(pageToken);

      // Execute response and collect results.
      ListFhirStoresResponse response = request.execute();
      stores.addAll(response.getFhirStores());

      // Update the page token for the next request.
      pageToken = response.getNextPageToken();
    } while (pageToken != null);

    // Print results.
    System.out.printf("Retrieved %s Fhir stores: \n", stores.size());
    for (FhirStore data : stores) {
      System.out.println("\t" + data.toPrettyString());
    }
  }

  private static CloudHealthcare createClient() throws IOException {
    // Use Application Default Credentials (ADC) to authenticate the requests
    // For more information see https://cloud.google.com/docs/authentication/production
    GoogleCredentials credential =
        GoogleCredentials.getApplicationDefault()
            .createScoped(Collections.singleton(CloudHealthcareScopes.CLOUD_PLATFORM));

    // Create a HttpRequestInitializer, which will provide a baseline configuration to all requests.
    HttpRequestInitializer requestInitializer =
        request -> {
          new HttpCredentialsAdapter(credential).initialize(request);
          request.setConnectTimeout(60000); // 1 minute connect timeout
          request.setReadTimeout(60000); // 1 minute read timeout
        };

    // Build the client for interacting with the service.
    return new CloudHealthcare.Builder(HTTP_TRANSPORT, JSON_FACTORY, requestInitializer)
        .setApplicationName("your-application-name")
        .build();
  }
}

Node.js

const google = require('@googleapis/healthcare');
const healthcare = google.healthcare({
  version: 'v1',
  auth: new google.auth.GoogleAuth({
    scopes: ['https://www.googleapis.com/auth/cloud-platform'],
  }),
});

const listFhirStores = async () => {
  // TODO(developer): uncomment these lines before running the sample
  // const cloudRegion = 'us-central1';
  // const projectId = 'adjective-noun-123';
  // const datasetId = 'my-dataset';
  const parent = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}`;
  const request = {parent};

  const fhirStores =
    await healthcare.projects.locations.datasets.fhirStores.list(request);
  console.log(JSON.stringify(fhirStores.data));
};

listFhirStores();

Python

def list_fhir_stores(project_id, location, dataset_id):
    """Lists the FHIR stores in the given dataset.

    See https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/healthcare/api-client/v1/fhir
    before running the sample."""
    # Imports the Google API Discovery Service.
    from googleapiclient import discovery

    api_version = "v1"
    service_name = "healthcare"
    # Instantiates an authorized API client by discovering the Healthcare API
    # and using GOOGLE_APPLICATION_CREDENTIALS environment variable.
    client = discovery.build(service_name, api_version)

    # TODO(developer): Uncomment these lines and replace with your values.
    # project_id = 'my-project'  # replace with your GCP project ID
    # location = 'us-central1'  # replace with the dataset's location
    # dataset_id = 'my-dataset'  # replace with the parent dataset's ID
    fhir_store_parent = "projects/{}/locations/{}/datasets/{}".format(
        project_id, location, dataset_id
    )

    fhir_stores = (
        client.projects()
        .locations()
        .datasets()
        .fhirStores()
        .list(parent=fhir_store_parent)
        .execute()
        .get("fhirStores", [])
    )

    for fhir_store in fhir_stores:
        print(fhir_store)

    return fhir_stores

Funktions- oder Konformitätserklärung für einen FHIR-Speicher abrufen

In den folgenden Beispielen wird gezeigt, wie Sie die Funktionen (STU3 oder R4) oder die Konformitätserklärung (DSTU2) für einen FHIR-Speicher abrufen.

Die Informationen in den Funktionen oder der Konformitätserklärung spiegeln die Einstellungen im FHIR-Speicher wider. Wenn FhirStore.enableUpdateCreate beispielsweise auf true gesetzt ist, wird dies im Feld CapabilityStatement.rest.resource.updateCreate der Capability-Anweisung angezeigt.

Die folgende Tabelle zeigt die Cloud Healthcare API-Methode zum Abrufen der Capabilities- oder Compliance-Anweisung für einen FHIR-Speicher und die entsprechende Interaktion mit der FHIR-Spezifikation:

Cloud Healthcare API-Methode Interaktion mit der FHIR-Spezifikation
projects.locations.datasets.fhirStores.fhir.capabilities Funktionen (STU3 oder R4) oder conformance (DSTU2)

Console

Die Google Cloud Console und die gcloud CLI unterstützen diese Aktion nicht. Verwenden Sie stattdessen curl, PowerShell oder Ihre bevorzugte Sprache.

gcloud

Die Google Cloud Console und die gcloud CLI unterstützen diese Aktion nicht. Verwenden Sie stattdessen curl, PowerShell oder Ihre bevorzugte Sprache.

REST

Verwenden Sie die Methode projects.locations.datasets.fhirStores.fhir.capabilities, um die Funktionen oder die Konformitätserklärung für einen FHIR-Speicher abzurufen.

Bevor Sie die Anfragedaten verwenden, ersetzen Sie die folgenden Werte:

  • PROJECT_ID ist die ID Ihres Google Cloud-Projekts
  • LOCATION ist der Standort des Datasets
  • DATASET_ID: das übergeordnete Dataset des FHIR-Speichers
  • FHIR_STORE_ID ist die FHIR-Speicher-ID

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Führen Sie folgenden Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/metadata"

PowerShell

Führen Sie folgenden Befehl aus:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/metadata" | Select-Object -Expand Content

APIs Explorer

Öffnen Sie die Methodenreferenzseite. Der API Explorer wird rechts auf der Seite geöffnet. Sie können mit diesem Tool interagieren, um Anfragen zu senden. Füllen Sie die Pflichtfelder aus und klicken Sie auf Ausführen.

Sie sollten in etwa folgende JSON-Antwort erhalten:

Go

import (
	"context"
	"fmt"
	"io"
	"io/ioutil"

	healthcare "google.golang.org/api/healthcare/v1"
)

// getFHIRMetadata gets FHIR store metadata.
func getFHIRMetadata(w io.Writer, projectID, location, datasetID, fhirStoreID string) error {
	ctx := context.Background()

	healthcareService, err := healthcare.NewService(ctx)
	if err != nil {
		return fmt.Errorf("healthcare.NewService: %w", err)
	}

	fhirService := healthcareService.Projects.Locations.Datasets.FhirStores.Fhir

	name := fmt.Sprintf("projects/%s/locations/%s/datasets/%s/fhirStores/%s", projectID, location, datasetID, fhirStoreID)

	resp, err := fhirService.Capabilities(name).Do()
	if err != nil {
		return fmt.Errorf("Capabilities: %w", err)
	}

	defer resp.Body.Close()

	respBytes, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return fmt.Errorf("could not read response: %w", err)
	}

	if resp.StatusCode > 299 {
		return fmt.Errorf("Capabilities: status %d %s: %s", resp.StatusCode, resp.Status, respBytes)
	}
	fmt.Fprintf(w, "%s", respBytes)
	return nil
}

Java

import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.healthcare.v1.CloudHealthcare;
import com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores.Fhir.Capabilities;
import com.google.api.services.healthcare.v1.CloudHealthcareScopes;
import com.google.api.services.healthcare.v1.model.HttpBody;
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.oauth2.GoogleCredentials;
import java.io.IOException;
import java.util.Collections;

public class FhirStoreGetMetadata {
  private static final String FHIR_NAME = "projects/%s/locations/%s/datasets/%s/fhirStores/%s";
  private static final JsonFactory JSON_FACTORY = new GsonFactory();
  private static final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport();

  public static void fhirStoreGetMetadata(String fhirStoreName) throws IOException {
    // String fhirStoreName =
    //    String.format(
    //        FHIR_NAME, "project-id", "region-id", "dataset-id", "store-id");

    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();

    // Create request and configure any parameters.
    Capabilities request =
        client.projects().locations().datasets().fhirStores().fhir().capabilities(fhirStoreName);

    // Execute the request and process the results.
    HttpBody response = request.execute();
    System.out.println("FHIR store metadata retrieved: " + response.toPrettyString());
  }

  private static CloudHealthcare createClient() throws IOException {
    // Use Application Default Credentials (ADC) to authenticate the requests
    // For more information see https://cloud.google.com/docs/authentication/production
    GoogleCredentials credential =
        GoogleCredentials.getApplicationDefault()
            .createScoped(Collections.singleton(CloudHealthcareScopes.CLOUD_PLATFORM));

    // Create a HttpRequestInitializer, which will provide a baseline configuration to all requests.
    HttpRequestInitializer requestInitializer =
        request -> {
          new HttpCredentialsAdapter(credential).initialize(request);
          request.setConnectTimeout(60000); // 1 minute connect timeout
          request.setReadTimeout(60000); // 1 minute read timeout
        };

    // Build the client for interacting with the service.
    return new CloudHealthcare.Builder(HTTP_TRANSPORT, JSON_FACTORY, requestInitializer)
        .setApplicationName("your-application-name")
        .build();
  }
}

Node.js

const google = require('@googleapis/healthcare');
const healthcare = google.healthcare({
  version: 'v1',
  auth: new google.auth.GoogleAuth({
    scopes: ['https://www.googleapis.com/auth/cloud-platform'],
  }),
});

const getFhirStoreCapabilities = async () => {
  // TODO(developer): uncomment these lines before running the sample
  // const cloudRegion = 'us-central1';
  // const projectId = 'adjective-noun-123';
  // const datasetId = 'my-dataset';
  // const fhirStoreId = 'my-fhir-store';
  const name = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/fhirStores/${fhirStoreId}/fhir/metadata`;
  const request = {name};

  const fhirStore =
    await healthcare.projects.locations.datasets.fhirStores.get(request);
  console.log(JSON.stringify(fhirStore.data, null, 2));
};

getFhirStoreCapabilities();

Python

def get_fhir_store_metadata(project_id, location, dataset_id, fhir_store_id):
    """Gets the FHIR capability statement (STU3, R4), or the conformance statement
    in the DSTU2 case for the store, which contains a description of functionality
    supported by the server.

    See https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/healthcare/api-client/v1/fhir
    before running the sample."""
    # Imports the Google API Discovery Service.
    from googleapiclient import discovery

    # Imports Python's built-in "json" module
    import json

    api_version = "v1"
    service_name = "healthcare"
    # Instantiates an authorized API client by discovering the Healthcare API
    # and using GOOGLE_APPLICATION_CREDENTIALS environment variable.
    client = discovery.build(service_name, api_version)

    # TODO(developer): Uncomment these lines and replace with your values.
    # project_id = 'my-project'  # replace with your GCP project ID
    # location = 'us-central1'  # replace with the parent dataset's location
    # dataset_id = 'my-dataset'  # replace with the parent dataset's ID
    # fhir_store_id = 'my-fhir-store' # replace with the FHIR store ID
    fhir_store_parent = "projects/{}/locations/{}/datasets/{}".format(
        project_id, location, dataset_id
    )
    fhir_store_name = f"{fhir_store_parent}/fhirStores/{fhir_store_id}"

    fhir_stores = client.projects().locations().datasets().fhirStores()
    response = fhir_stores.fhir().capabilities(name=fhir_store_name).execute()

    print(json.dumps(response, indent=2))
    return response

Grundlegende Validierungsebene der Ressourcen festlegen

Standardmäßig wird auf alle Ressourcen in Ihrem FHIR-Speicher eine Basisressourcenvalidierung angewendet. Diese Validierung gewährleistet, dass Folgendes bei der Erstellung der Ressource zutrifft:

  • Alle Pflichtfelder sind definiert.
  • Alle referenzierten Ressourcentypen sind gültig.
  • Die Ressource erfüllt alle FHIRPath-Einschränkungen.

Sie können Ihre Basisressourcenvalidierung weniger streng machen, indem Sie einen oder mehrere dieser Arten von Basisressourcenvalidierung für Ihren FHIR-Speicher deaktivieren.

Console

Die Google Cloud Console und die gcloud CLI unterstützen diese Aktion nicht. Verwenden Sie stattdessen curl, PowerShell oder Ihre bevorzugte Sprache.

gcloud

Die Google Cloud Console und die gcloud CLI unterstützen diese Aktion nicht. Verwenden Sie stattdessen curl, PowerShell oder Ihre bevorzugte Sprache.

REST

Verwenden Sie die Methode projects.locations.datasets.fhirStores.patch, um die Basisressourcenvalidierung in einem vorhandenen FHIR-Speicher zu deaktivieren.

Bevor Sie die Anfragedaten verwenden, ersetzen Sie die folgenden Werte:

  • PROJECT_ID ist die ID Ihres Google Cloud-Projekts
  • DATASET_ID ist das übergeordnete Dataset des FHIR-Speichers
  • LOCATION ist der Standort des Datasets
  • BASE_RESOURCE_VALIDATION_TYPE ist der Basisvalidierungstyp für Ressourcen, den Sie deaktivieren möchten. Legen Sie eines der folgenden Felder auf true fest, um die Validierung zu deaktivieren:
    • disableRequiredFieldValidation
    • disableReferenceTypeValidation
    • disableFhirpathValidation

JSON-Text anfordern:

{
  "validationConfig": {
    "BASE_RESOURCE_VALIDATION_TYPE": true
  }
}

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json. Führen Sie folgenden Befehl im Terminal aus, um diese Datei im aktuellen Verzeichnis zu erstellen oder zu überschreiben:

cat > request.json << 'EOF'
{
  "validationConfig": {
    "BASE_RESOURCE_VALIDATION_TYPE": true
  }
}
EOF

Führen Sie dann folgenden Befehl aus, um Ihre REST-Anfrage zu senden:

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID?updateMask=validationConfig"

PowerShell

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json. Führen Sie folgenden Befehl im Terminal aus, um diese Datei im aktuellen Verzeichnis zu erstellen oder zu überschreiben:

@'
{
  "validationConfig": {
    "BASE_RESOURCE_VALIDATION_TYPE": true
  }
}
'@  | Out-File -FilePath request.json -Encoding utf8

Führen Sie dann folgenden Befehl aus, um Ihre REST-Anfrage zu senden:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID?updateMask=validationConfig" | Select-Object -Expand Content

APIs Explorer

Kopieren Sie den Anfragetext und öffnen Sie die Referenzseite für Methoden. Der API Explorer wird rechts auf der Seite geöffnet. Sie können mit diesem Tool interagieren, um Anfragen zu senden. Fügen Sie den Anfragetext in dieses Tool ein, füllen Sie alle Pflichtfelder aus und klicken Sie auf Ausführen.

Sie sollten eine Antwort ähnlich der folgenden erhalten:

Wenn Sie in der Ressource FhirStore Felder konfiguriert haben, werden diese auch in der Antwort angezeigt.

FHIR-Speicher löschen

In den folgenden Beispielen wird gezeigt, wie Sie einen FHIR-Speicher löschen.

Console

So löschen Sie einen Datenspeicher:

  1. Rufen Sie in der Google Cloud Console die Seite Datasets auf.

    Zu „Datasets“

  2. Wählen Sie das Dataset aus, das den Datenspeicher enthält, den Sie löschen möchten.
  3. Wählen Sie in der Drop-down-Liste Aktionen für den Datenspeicher, den Sie löschen möchten, Löschen aus.
  4. Geben Sie zur Bestätigung den Namen des Datenspeichers ein und klicken Sie auf Löschen.

gcloud

Führen Sie den Befehl gcloud healthcare fhir-stores delete aus, um einen FHIR-Speicher zu löschen:

Bevor Sie die folgenden Befehlsdaten verwenden, ersetzen Sie die folgenden Werte:

  • LOCATION ist der Standort des Datasets
  • DATASET_ID: das übergeordnete Dataset des FHIR-Speichers
  • FHIR_STORE_ID ist die FHIR-Speicher-ID

Führen Sie den folgenden Befehl aus:

Linux, macOS oder Cloud Shell

gcloud healthcare fhir-stores delete FHIR_STORE_ID \
  --dataset=DATASET_ID \
  --location=LOCATION

Windows (PowerShell)

gcloud healthcare fhir-stores delete FHIR_STORE_ID `
  --dataset=DATASET_ID `
  --location=LOCATION

Windows (cmd.exe)

gcloud healthcare fhir-stores delete FHIR_STORE_ID ^
  --dataset=DATASET_ID ^
  --location=LOCATION

Sie sollten eine Antwort ähnlich der folgenden erhalten:

Deleted fhirStore [FHIR_STORE_ID].

REST

Verwenden Sie zum Löschen eines FHIR-Speichers die Methode projects.locations.datasets.fhirStores.delete.

Bevor Sie die Anfragedaten verwenden, ersetzen Sie die folgenden Werte:

  • PROJECT_ID ist die ID Ihres Google Cloud-Projekts
  • LOCATION ist der Standort des Datasets
  • DATASET_ID: das übergeordnete Dataset des FHIR-Speichers
  • FHIR_STORE_ID ist die FHIR-Speicher-ID

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Führen Sie folgenden Befehl aus:

curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID"

PowerShell

Führen Sie folgenden Befehl aus:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID" | Select-Object -Expand Content

APIs Explorer

Öffnen Sie die Methodenreferenzseite. Der API Explorer wird rechts auf der Seite geöffnet. Sie können mit diesem Tool interagieren, um Anfragen zu senden. Füllen Sie die Pflichtfelder aus und klicken Sie auf Ausführen.

Sie sollten in etwa folgende JSON-Antwort erhalten:

Go

import (
	"context"
	"fmt"
	"io"

	healthcare "google.golang.org/api/healthcare/v1"
)

// deleteFHIRStore deletes an FHIR store.
func deleteFHIRStore(w io.Writer, projectID, location, datasetID, fhirStoreID string) error {
	ctx := context.Background()

	healthcareService, err := healthcare.NewService(ctx)
	if err != nil {
		return fmt.Errorf("healthcare.NewService: %w", err)
	}

	storesService := healthcareService.Projects.Locations.Datasets.FhirStores

	name := fmt.Sprintf("projects/%s/locations/%s/datasets/%s/fhirStores/%s", projectID, location, datasetID, fhirStoreID)

	if _, err := storesService.Delete(name).Do(); err != nil {
		return fmt.Errorf("Delete: %w", err)
	}

	fmt.Fprintf(w, "Deleted FHIR store: %q\n", fhirStoreID)
	return nil
}

Java

import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.healthcare.v1.CloudHealthcare;
import com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores;
import com.google.api.services.healthcare.v1.CloudHealthcareScopes;
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.oauth2.GoogleCredentials;
import java.io.IOException;
import java.util.Collections;

public class FhirStoreDelete {
  private static final String FHIR_NAME = "projects/%s/locations/%s/datasets/%s/fhirStores/%s";
  private static final JsonFactory JSON_FACTORY = new GsonFactory();
  private static final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport();

  public static void fhirStoreDelete(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.Delete request =
        client.projects().locations().datasets().fhirStores().delete(fhirStoreName);

    // Execute the request and process the results.
    request.execute();
    System.out.println("FHIR store deleted.");
  }

  private static CloudHealthcare createClient() throws IOException {
    // Use Application Default Credentials (ADC) to authenticate the requests
    // For more information see https://cloud.google.com/docs/authentication/production
    GoogleCredentials credential =
        GoogleCredentials.getApplicationDefault()
            .createScoped(Collections.singleton(CloudHealthcareScopes.CLOUD_PLATFORM));

    // Create a HttpRequestInitializer, which will provide a baseline configuration to all requests.
    HttpRequestInitializer requestInitializer =
        request -> {
          new HttpCredentialsAdapter(credential).initialize(request);
          request.setConnectTimeout(60000); // 1 minute connect timeout
          request.setReadTimeout(60000); // 1 minute read timeout
        };

    // Build the client for interacting with the service.
    return new CloudHealthcare.Builder(HTTP_TRANSPORT, JSON_FACTORY, requestInitializer)
        .setApplicationName("your-application-name")
        .build();
  }
}

Node.js

const google = require('@googleapis/healthcare');
const healthcare = google.healthcare({
  version: 'v1',
  auth: new google.auth.GoogleAuth({
    scopes: ['https://www.googleapis.com/auth/cloud-platform'],
  }),
});

const deleteFhirStore = async () => {
  // TODO(developer): uncomment these lines before running the sample
  // const cloudRegion = 'us-central1';
  // const projectId = 'adjective-noun-123';
  // const datasetId = 'my-dataset';
  // const fhirStoreId = 'my-fhir-store';
  const name = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/fhirStores/${fhirStoreId}`;
  const request = {name};

  await healthcare.projects.locations.datasets.fhirStores.delete(request);
  console.log(`Deleted FHIR store: ${fhirStoreId}`);
};

deleteFhirStore();

Python

def delete_fhir_store(project_id, location, dataset_id, fhir_store_id):
    """Deletes the specified FHIR store.

    See https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/healthcare/api-client/v1/fhir
    before running the sample."""
    # Imports the Google API Discovery Service.
    from googleapiclient import discovery

    api_version = "v1"
    service_name = "healthcare"
    # Returns an authorized API client by discovering the Healthcare API
    # and using GOOGLE_APPLICATION_CREDENTIALS environment variable.
    client = discovery.build(service_name, api_version)

    # TODO(developer): Uncomment these lines and replace with your values.
    # project_id = 'my-project'  # replace with your GCP project ID
    # location = 'us-central1'  # replace with the parent dataset's location
    # dataset_id = 'my-dataset'  # replace with the FHIR store's parent dataset
    # fhir_store_id = 'my-fhir-store'  # replace with the FHIR store's ID
    fhir_store_parent = "projects/{}/locations/{}/datasets/{}".format(
        project_id, location, dataset_id
    )
    fhir_store_name = f"{fhir_store_parent}/fhirStores/{fhir_store_id}"

    request = (
        client.projects()
        .locations()
        .datasets()
        .fhirStores()
        .delete(name=fhir_store_name)
    )

    response = request.execute()
    print(f"Deleted FHIR store: {fhir_store_id}")

    return response

Nächste Schritte

FHIR-Ressourcen erstellen und verwenden