HealthLake esempi utilizzando AWS CLI - AWS Command Line Interface

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

HealthLake esempi utilizzando AWS CLI

I seguenti esempi di codice mostrano come eseguire azioni e implementare scenari comuni utilizzando AWS Command Line Interface with HealthLake.

Le azioni sono estratti di codice da programmi più grandi e devono essere eseguite nel contesto. Sebbene le azioni mostrino come richiamare le singole funzioni del servizio, è possibile visualizzarle contestualizzate negli scenari correlati.

Ogni esempio include un link al codice sorgente completo, in cui vengono fornite le istruzioni su come configurare ed eseguire il codice nel contesto.

Argomenti

Azioni

Il seguente esempio di codice mostra come utilizzarecreate-fhir-datastore.

AWS CLI

Esempio 1: creare un data store abilitato per SIGv4 HealthLake

L'create-fhir-datastoreesempio seguente mostra come creare un nuovo archivio dati in. AWS HealthLake

aws healthlake create-fhir-datastore \ --datastore-type-version R4 \ --datastore-name "FhirTestDatastore"

Output:

{ "DatastoreEndpoint": "https://healthlake.us-east-1.amazonaws.com/datastore/(Data store ID)/r4/", "DatastoreArn": "arn:aws:healthlake:us-east-1:(AWS Account ID):datastore/(Data store ID)", "DatastoreStatus": "CREATING", "DatastoreId": "(Data store ID)" }

Esempio 2: creare uno SMART su un data store abilitato per FHIR HealthLake

L'create-fhir-datastoreesempio seguente mostra come creare un nuovo SMART su un data store abilitato per FHIR in. AWS HealthLake

aws healthlake create-fhir-datastore \ --datastore-name "your-data-store-name" \ --datastore-type-version R4 \ --preload-data-config PreloadDataType="SYNTHEA" \ --sse-configuration '{ "KmsEncryptionConfig": { "CmkType": "CUSTOMER_MANAGED_KMS_KEY", "KmsKeyId": "arn:aws:kms:us-east-1:your-account-id:key/your-key-id" } }' \ --identity-provider-configuration file://identity_provider_configuration.json

Contenuto di identity_provider_configuration.json:

{ "AuthorizationStrategy": "SMART_ON_FHIR_V1", "FineGrainedAuthorizationEnabled": true, "IdpLambdaArn": "arn:aws:lambda:your-region:your-account-id:function:your-lambda-name", "Metadata": "{\"issuer\":\"https://ehr.example.com\", \"jwks_uri\":\"https://ehr.example.com/.well-known/jwks.json\",\"authorization_endpoint\":\"https://ehr.example.com/auth/authorize\",\"token_endpoint\":\"https://ehr.token.com/auth/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_basic\",\"foo\"],\"grant_types_supported\":[\"client_credential\",\"foo\"],\"registration_endpoint\":\"https://ehr.example.com/auth/register\",\"scopes_supported\":[\"openId\",\"profile\",\"launch\"],\"response_types_supported\":[\"code\"],\"management_endpoint\":\"https://ehr.example.com/user/manage\",\"introspection_endpoint\":\"https://ehr.example.com/user/introspect\",\"revocation_endpoint\":\"https://ehr.example.com/user/revoke\",\"code_challenge_methods_supported\":[\"S256\"],\"capabilities\":[\"launch-ehr\",\"sso-openid-connect\",\"client-public\"]}" }

Output:

{ "DatastoreEndpoint": "https://healthlake.us-east-1.amazonaws.com/datastore/(Data store ID)/r4/", "DatastoreArn": "arn:aws:healthlake:us-east-1:(AWS Account ID):datastore/(Data store ID)", "DatastoreStatus": "CREATING", "DatastoreId": "(Data store ID)" }

Per ulteriori informazioni, consulta Creazione e monitoraggio di un data store FHIR nella Developer Guide.AWS HealthLake

Il seguente esempio di codice mostra come utilizzaredelete-fhir-datastore.

AWS CLI

Come eliminare un datastore FHIR

L'delete-fhir-datastoreesempio seguente mostra come eliminare un archivio dati e tutto il suo contenuto. AWS HealthLake

aws healthlake delete-fhir-datastore \ --datastore-id (Data store ID)

Output:

{ "DatastoreEndpoint": "https://healthlake.us-east-1.amazonaws.com/datastore/(Data store ID)/r4/", "DatastoreArn": "arn:aws:healthlake:us-east-1:(AWS Account ID):datastore/(Data store ID)", "DatastoreStatus": "DELETING", "DatastoreId": "(Data store ID)" }

Per ulteriori informazioni, consulta Creazione e monitoraggio di un archivio dati FHIR < https://docs.aws.amazon.com/healthlake/ latest/devguide/working -with-FHIR-HealthLake.html> nella Guida per gli sviluppatori.AWS HealthLake

  • Per FHIRDatastore i dettagli sull'AWS CLI API, consulta Delete in Command Reference.

Il seguente esempio di codice mostra come utilizzaredescribe-fhir-datastore.

AWS CLI

Come descrivere un datastore FHIR

L'describe-fhir-datastoreesempio seguente mostra come trovare le proprietà di un archivio dati in AWS HealthLake.

aws healthlake describe-fhir-datastore \ --datastore-id "1f2f459836ac6c513ce899f9e4f66a59"

Output:

{ "DatastoreProperties": { "PreloadDataConfig": { "PreloadDataType": "SYNTHEA" }, "SseConfiguration": { "KmsEncryptionConfig": { "CmkType": "CUSTOMER_MANAGED_KMS_KEY", "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" } }, "DatastoreName": "Demo", "DatastoreArn": "arn:aws:healthlake:us-east-1:<AWS Account ID>:datastore/<Data store ID>", "DatastoreEndpoint": "https://healthlake.us-east-1.amazonaws.com/datastore/<Data store ID>/r4/", "DatastoreStatus": "ACTIVE", "DatastoreTypeVersion": "R4", "CreatedAt": 1603761064.881, "DatastoreId": "<Data store ID>", "IdentityProviderConfiguration": { "AuthorizationStrategy": "AWS_AUTH", "FineGrainedAuthorizationEnabled": false } } }

Per ulteriori informazioni, consulta Creazione e monitoraggio di un archivio dati FHIR nella AWS HealthLake Developer Guide.

Il seguente esempio di codice mostra come utilizzaredescribe-fhir-export-job.

AWS CLI

Come descrivere un processo di esportazione FHIR

L'describe-fhir-export-jobesempio seguente mostra come trovare le proprietà di un processo di esportazione FHIR in AWS HealthLake.

aws healthlake describe-fhir-export-job \ --datastore-id (Data store ID) \ --job-id 9b9a51943afaedd0a8c0c26c49135a31

Output:

{ "ExportJobProperties": { "DataAccessRoleArn": "arn:aws:iam::(AWS Account ID):role/(Role Name)", "JobStatus": "IN_PROGRESS", "JobId": "9009813e9d69ba7cf79bcb3468780f16", "SubmitTime": "2024-11-20T11:31:46.672000-05:00", "EndTime": "2024-11-20T11:34:01.636000-05:00", "OutputDataConfig": { "S3Configuration": { "S3Uri": "s3://(Bucket Name)/(Prefix Name)/", "KmsKeyId": "arn:aws:kms:us-east-1:012345678910:key/d330e7fc-b56c-4216-a250-f4c43ef46e83" } }, "DatastoreId": "(Data store ID)" } }

Per ulteriori informazioni, consulta Esportazione di file da un data store FHIR nella Guida per gli AWS HealthLake sviluppatori.

Il seguente esempio di codice mostra come utilizzaredescribe-fhir-import-job.

AWS CLI

Come descrivere un processo di importazione FHIR

L'describe-fhir-import-jobesempio seguente mostra come apprendere le proprietà di un processo di importazione FHIR utilizzando AWS HealthLake.

aws healthlake describe-fhir-import-job \ --datastore-id (Data store ID) \ --job-id c145fbb27b192af392f8ce6e7838e34f

Output:

{ "ImportJobProperties": { "InputDataConfig": { "S3Uri": "s3://(Bucket Name)/(Prefix Name)/" { "arrayitem2": 2 } }, "DataAccessRoleArn": "arn:aws:iam::(AWS Account ID):role/(Role Name)", "JobStatus": "COMPLETED", "JobId": "c145fbb27b192af392f8ce6e7838e34f", "SubmitTime": 1606272542.161, "EndTime": 1606272609.497, "DatastoreId": "(Data store ID)" } }

Per ulteriori informazioni, consulta Importazione di file in un data store FHIR nella Guida per gli AWS HealthLake sviluppatori.

Il seguente esempio di codice mostra come utilizzarelist-fhir-datastores.

AWS CLI

Come elencare i datastore FHIR

L'list-fhir-datastoresesempio seguente mostra come utilizzare il comando e come gli utenti possono filtrare i risultati in base allo stato del data store in AWS HealthLake.

aws healthlake list-fhir-datastores \ --filter DatastoreStatus=ACTIVE

Output:

{ "DatastorePropertiesList": [ { "PreloadDataConfig": { "PreloadDataType": "SYNTHEA" }, "SseConfiguration": { "KmsEncryptionConfig": { "CmkType": "CUSTOMER_MANAGED_KMS_KEY", "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" } }, "DatastoreName": "Demo", "DatastoreArn": "arn:aws:healthlake:us-east-1:<AWS Account ID>:datastore/<Data store ID>", "DatastoreEndpoint": "https://healthlake.us-east-1.amazonaws.com/datastore/<Data store ID>/r4/", "DatastoreStatus": "ACTIVE", "DatastoreTypeVersion": "R4", "CreatedAt": 1603761064.881, "DatastoreId": "<Data store ID>", "IdentityProviderConfiguration": { "AuthorizationStrategy": "AWS_AUTH", "FineGrainedAuthorizationEnabled": false } } ] }

Per ulteriori informazioni, consulta Creazione e monitoraggio di un data store FHIR nella Guida per gli AWS HealthLake sviluppatori.

Il seguente esempio di codice mostra come utilizzarelist-fhir-export-jobs.

AWS CLI

Come elencare tutti i processi di esportazione FHIR

L’esempio list-fhir-export-jobs seguente mostra come utilizzare il comando per visualizzare un elenco di processi di esportazione associati a un account.

aws healthlake list-fhir-export-jobs \ --datastore-id (Data store ID) \ --submitted-before (DATE like 2024-10-13T19:00:00Z)\ --submitted-after (DATE like 2020-10-13T19:00:00Z )\ --job-name "FHIR-EXPORT" \ --job-status SUBMITTED \ --max-results (Integer between 1 and 500)

Output:

{ "ExportJobPropertiesList": [ { "ExportJobProperties": { "OutputDataConfig": { "S3Uri": "s3://(Bucket Name)/(Prefix Name)/", "S3Configuration": { "S3Uri": "s3://(Bucket Name)/(Prefix Name)/", "KmsKeyId": "(KmsKey Id)" } }, "DataAccessRoleArn": "arn:aws:iam::(AWS Account ID):role/(Role Name)", "JobStatus": "COMPLETED", "JobId": "c145fbb27b192af392f8ce6e7838e34f", "JobName": "FHIR-EXPORT", "SubmitTime": "2024-11-20T11:31:46.672000-05:00", "EndTime": "2024-11-20T11:34:01.636000-05:00", "DatastoreId": "(Data store ID)" } } ] }

Per ulteriori informazioni, consulta Esportazione di file da un data store FHIR nella Guida per gli AWS HealthLake sviluppatori.

Il seguente esempio di codice mostra come utilizzarelist-fhir-import-jobs.

AWS CLI

Come elencare tutti i processi di importazione FHIR

L’esempio list-fhir-import-jobs seguente mostra come utilizzare il comando per visualizzare un elenco di tutti i processi di importazione associati a un account.

aws healthlake list-fhir-import-jobs \ --datastore-id (Data store ID) \ --submitted-before (DATE like 2024-10-13T19:00:00Z) \ --submitted-after (DATE like 2020-10-13T19:00:00Z ) \ --job-name "FHIR-IMPORT" \ --job-status SUBMITTED \ -max-results (Integer between 1 and 500)

Output:

{ "ImportJobPropertiesList": [ { "JobId": "c0fddbf76f238297632d4aebdbfc9ddf", "JobStatus": "COMPLETED", "SubmitTime": "2024-11-20T10:08:46.813000-05:00", "EndTime": "2024-11-20T10:10:09.093000-05:00", "DatastoreId": "(Data store ID)", "InputDataConfig": { "S3Uri": "s3://(Bucket Name)/(Prefix Name)/" }, "JobOutputDataConfig": { "S3Configuration": { "S3Uri": "s3://(Bucket Name)/import/6407b9ae4c2def3cb6f1a46a0c599ec0-FHIR_IMPORT-c0fddbf76f238297632d4aebdbfc9ddf/", "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/b7f645cb-e564-4981-8672-9e012d1ff1a0" } }, "JobProgressReport": { "TotalNumberOfScannedFiles": 1, "TotalSizeOfScannedFilesInMB": 0.001798, "TotalNumberOfImportedFiles": 1, "TotalNumberOfResourcesScanned": 1, "TotalNumberOfResourcesImported": 1, "TotalNumberOfResourcesWithCustomerError": 0, "TotalNumberOfFilesReadWithCustomerError": 0, "Throughput": 0.0 }, "DataAccessRoleArn": "arn:aws:iam::(AWS Account ID):role/(Role Name)" } ] }

Per ulteriori informazioni, consulta Importazione di file nell'archivio dati FHIR nella Guida per gli AWS HealthLake sviluppatori.

Il seguente esempio di codice mostra come utilizzarelist-tags-for-resource.

AWS CLI

Come elencare i tag di un datastore

L’esempio list-tags-for-resource seguente elenca i tag associati al datastore specificato:

aws healthlake list-tags-for-resource \ --resource-arn "arn:aws:healthlake:us-east-1:123456789012:datastore/fhir/0725c83f4307f263e16fd56b6d8ebdbe"

Output:

{ "tags": { "key": "value", "key1": "value1" } }

Per ulteriori informazioni, consulta Tagging resources AWS HealthLake nella AWS HealthLake Developer Guide.

Il seguente esempio di codice mostra come utilizzarestart-fhir-export-job.

AWS CLI

Come avviare un processo di esportazione FHIR

L'start-fhir-export-jobesempio seguente mostra come avviare un processo di esportazione FHIR utilizzando AWS HealthLake.

aws healthlake start-fhir-export-job \ --output-data-config '{"S3Configuration": {"S3Uri":"s3://(Bucket Name)/(Prefix Name)/","KmsKeyId":"arn:aws:kms:us-east-1:012345678910:key/d330e7fc-b56c-4216-a250-f4c43ef46e83"}}' \ --datastore-id (Data store ID) \ --data-access-role-arn arn:aws:iam::(AWS Account ID):role/(Role Name)

Output:

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

Per ulteriori informazioni, consulta Esportazione di file da un data store FHIR nella Guida per gli AWS HealthLake sviluppatori.

Il seguente esempio di codice mostra come utilizzarestart-fhir-import-job.

AWS CLI

Come avviare un processo di importazione FHIR

L'start-fhir-import-jobesempio seguente mostra come avviare un processo di importazione FHIR utilizzando AWS HealthLake.

aws healthlake start-fhir-import-job \ --input-data-config S3Uri="s3://(Bucket Name)/(Prefix Name)/" \ --job-output-data-config '{"S3Configuration": {"S3Uri":"s3://(Bucket Name)/(Prefix Name)/","KmsKeyId":"arn:aws:kms:us-east-1:012345678910:key/d330e7fc-b56c-4216-a250-f4c43ef46e83"}}' \ --datastore-id (Data store ID) \ --data-access-role-arn "arn:aws:iam::(AWS Account ID):role/(Role Name)"

Output:

{ "DatastoreId": "(Data store ID)", "JobStatus": "SUBMITTED", "JobId": "c145fbb27b192af392f8ce6e7838e34f" }

Per ulteriori informazioni, consulta Importazione di file in un data store FHIR nella Guida per gli AWS HealthLake sviluppatori.

Il seguente esempio di codice mostra come utilizzaretag-resource.

AWS CLI

Come aggiungere un tag al datastore

L’esempio tag-resource seguente mostra come aggiungere un tag al datastore.

aws healthlake tag-resource \ --resource-arn "arn:aws:healthlake:us-east-1:123456789012:datastore/fhir/0725c83f4307f263e16fd56b6d8ebdbe" \ --tags '[{"Key": "key1", "Value": "value1"}]'

Questo comando non produce alcun output.

Per ulteriori informazioni, consulta Aggiungere un tag a un data store nella Guida per gli AWS HealthLake sviluppatori. .

Il seguente esempio di codice mostra come utilizzareuntag-resource.

AWS CLI

Come rimuovere i tag da un datastore.

L’esempio untag-resource seguente mostra come rimuovere i tag da un datastore.

aws healthlake untag-resource \ --resource-arn "arn:aws:healthlake:us-east-1:123456789012:datastore/fhir/b91723d65c6fdeb1d26543a49d2ed1fa" \ --tag-keys '["key1"]'

Questo comando non produce alcun output.

Per ulteriori informazioni, consulta Rimozione di tag da un data store nella Guida per gli AWS HealthLake sviluppatori.