与 AWS SDK或StartFHIRExportJob一起使用 CLI - AWS SDK代码示例

AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

与 AWS SDK或StartFHIRExportJob一起使用 CLI

以下代码示例演示如何使用 StartFHIRExportJob

CLI
AWS CLI

启动FHIR导出任务

以下start-fhir-export-job示例说明如何使用 Amazon 启动FHIR导出任务 HealthLake。

aws healthlake start-fhir-export-job \ --output-data-config S3Uri="s3://(Bucket Name)/(Prefix Name)/" \ --datastore-id (Datastore ID) \ --data-access-role-arn arn:aws:iam::(AWS Account ID):role/(Role Name)

输出:

{ "DatastoreId": "(Datastore ID)", "JobStatus": "SUBMITTED", "JobId": "9b9a51943afaedd0a8c0c26c49135a31" }

有关更多信息,请参阅《Amazon HealthLake 开发者指南》中的从FHIR数据存储中导出文件

  • 有关API详细信息,请参阅《AWS CLI 命令参考》中的 S tartFHIRExport J ob。

Python
SDK适用于 Python (Boto3)
注意

还有更多相关信息 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 start_fhir_export_job( self, job_name: str, datastore_id: str, output_s3_uri: str, kms_key_id: str, data_access_role_arn: str, ) -> dict[str, str]: """ Starts a HealthLake export job. :param job_name: The export job name. :param datastore_id: The datastore ID. :param output_s3_uri: The output S3 URI. :param kms_key_id: The KMS key ID associated with the output S3 bucket. :param data_access_role_arn: The data access role ARN. :return: The export job. """ try: response = self.health_lake_client.start_fhir_export_job( OutputDataConfig={ "S3Configuration": {"S3Uri": output_s3_uri, "KmsKeyId": kms_key_id} }, DataAccessRoleArn=data_access_role_arn, DatastoreId=datastore_id, JobName=job_name, ) return response except ClientError as err: logger.exception( "Couldn't start export job. Here's why %s", err.response["Error"]["Message"], ) raise