ListFHIRDatastores 搭配 a AWS SDK 或 CLI 使用 - AWS SDK 程式碼範例

文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的 GitHub 範例。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

ListFHIRDatastores 搭配 a AWS SDK 或 CLI 使用

下列程式碼範例示範如何使用 ListFHIRDatastores

CLI
AWS CLI

列出 FHIR Data Stores

下列list-fhir-datastores範例顯示如何使用 命令,以及使用者可以如何根據 Amazon HealthLake 中的資料存放區狀態篩選結果。

aws healthlake list-fhir-datastores \ --region us-east-1 \ --filter DatastoreStatus=ACTIVE

輸出:

{ "DatastorePropertiesList": [ { "PreloadDataConfig": { "PreloadDataType": "SYNTHEA" }, "DatastoreName": "FhirTestDatastore", "DatastoreArn": "arn:aws:healthlake:us-east-1:<AWS Account ID>:datastore/<Datastore ID>", "DatastoreEndpoint": "https://healthlake.us-east-1.amazonaws.com/datastore/<Datastore ID>/r4/", "DatastoreStatus": "ACTIVE", "DatastoreTypeVersion": "R4", "CreatedAt": 1605574003.209, "DatastoreId": "<Datastore ID>" }, { "DatastoreName": "Demo", "DatastoreArn": "arn:aws:healthlake:us-east-1:<AWS Account ID>:datastore/<Datastore ID>", "DatastoreEndpoint": "https://healthlake.us-east-1.amazonaws.com/datastore/<Datastore ID>/r4/", "DatastoreStatus": "ACTIVE", "DatastoreTypeVersion": "R4", "CreatedAt": 1603761064.881, "DatastoreId": "<Datastore ID>" } ] }

如需詳細資訊,請參閱 Amazon HealthLake 開發人員指南中的建立和監控 FHIR Data Store

Python
SDK for Python (Boto3)
注意

還有更多 on GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫中設定和執行。

@classmethod def from_client(cls) -> "HealthLakeWrapper": """ Creates a HealthLakeWrapper instance with a default AWS HealthLake client. :return: An instance of HealthLakeWrapper initialized with the default HealthLake client. """ health_lake_client = boto3.client("healthlake") return cls(health_lake_client) def list_fhir_datastores(self) -> list[dict[str, any]]: """ Lists all HealthLake datastores. :return: A list of datastore descriptions. """ try: next_token = None datastores = [] # Loop through paginated results. while True: parameters = {} if next_token is not None: parameters["NextToken"] = next_token response = self.health_lake_client.list_fhir_datastores(**parameters) datastores.extend(response["DatastorePropertiesList"]) if "NextToken" in response: next_token = response["NextToken"] else: break return datastores except ClientError as err: logger.exception( "Couldn't list datastores. Here's why %s", err.response["Error"]["Message"] ) raise