@@ -47,8 +47,8 @@ def create_fhir_datastore(
4747 identity_provider_configuration : dict [str , any ] = None ,
4848 ) -> dict [str , str ]:
4949 """
50- Creates a new HealthLake datastore .
51- When creating a SMART on FHIR datastore , the following parameters are required:
50+ Creates a new HealthLake data store .
51+ When creating a SMART on FHIR data store , the following parameters are required:
5252 - sse_configuration: The server-side encryption configuration for a SMART on FHIR-enabled data store.
5353 - identity_provider_configuration: The identity provider configuration for a SMART on FHIR-enabled data store.
5454
@@ -73,7 +73,7 @@ def create_fhir_datastore(
7373 return response
7474 except ClientError as err :
7575 logger .exception (
76- "Couldn't create datastore %s. Here's why %s" ,
76+ "Couldn't create data store %s. Here's why %s" ,
7777 datastore_name ,
7878 err .response ["Error" ]["Message" ],
7979 )
@@ -84,9 +84,9 @@ def create_fhir_datastore(
8484 # snippet-start:[python.example_code.healthlake.DescribeFHIRDatastore]
8585 def describe_fhir_datastore (self , datastore_id : str ) -> dict [str , any ]:
8686 """
87- Describes a HealthLake datastore .
88- :param datastore_id: The datastore ID.
89- :return: The datastore description.
87+ Describes a HealthLake data store .
88+ :param datastore_id: The data store ID.
89+ :return: The data store description.
9090 """
9191 try :
9292 response = self .health_lake_client .describe_fhir_datastore (
@@ -95,7 +95,7 @@ def describe_fhir_datastore(self, datastore_id: str) -> dict[str, any]:
9595 return response ["DatastoreProperties" ]
9696 except ClientError as err :
9797 logger .exception (
98- "Couldn't describe datastore with ID %s. Here's why %s" ,
98+ "Couldn't describe data store with ID %s. Here's why %s" ,
9999 datastore_id ,
100100 err .response ["Error" ]["Message" ],
101101 )
@@ -106,8 +106,8 @@ def describe_fhir_datastore(self, datastore_id: str) -> dict[str, any]:
106106 # snippet-start:[python.example_code.healthlake.ListFHIRDatastores]
107107 def list_fhir_datastores (self ) -> list [dict [str , any ]]:
108108 """
109- Lists all HealthLake datastores .
110- :return: A list of datastore descriptions.
109+ Lists all HealthLake data stores .
110+ :return: A list of data store descriptions.
111111 """
112112 try :
113113 next_token = None
@@ -128,22 +128,22 @@ def list_fhir_datastores(self) -> list[dict[str, any]]:
128128 return datastores
129129 except ClientError as err :
130130 logger .exception (
131- "Couldn't list datastores . Here's why %s" , err .response ["Error" ]["Message" ]
131+ "Couldn't list data stores . Here's why %s" , err .response ["Error" ]["Message" ]
132132 )
133133 raise
134134 # snippet-end:[python.example_code.healthlake.ListFHIRDatastores]
135135
136136 # snippet-start:[python.example_code.healthlake.DeleteFHIRDatastore]
137137 def delete_fhir_datastore (self , datastore_id : str ) -> None :
138138 """
139- Deletes a HealthLake datastore .
140- :param datastore_id: The datastore ID.
139+ Deletes a HealthLake data store .
140+ :param datastore_id: The data store ID.
141141 """
142142 try :
143143 self .health_lake_client .delete_fhir_datastore (DatastoreId = datastore_id )
144144 except ClientError as err :
145145 logger .exception (
146- "Couldn't delete datastore with ID %s. Here's why %s" ,
146+ "Couldn't delete data store with ID %s. Here's why %s" ,
147147 datastore_id ,
148148 err .response ["Error" ]["Message" ],
149149 )
@@ -164,7 +164,7 @@ def start_fhir_import_job(
164164 """
165165 Starts a HealthLake import job.
166166 :param job_name: The import job name.
167- :param datastore_id: The datastore ID.
167+ :param datastore_id: The data store ID.
168168 :param input_s3_uri: The input S3 URI.
169169 :param job_output_s3_uri: The job output S3 URI.
170170 :param kms_key_id: The KMS key ID associated with the output S3 bucket.
@@ -200,7 +200,7 @@ def describe_fhir_import_job(
200200 ) -> dict [str , any ]:
201201 """
202202 Describes a HealthLake import job.
203- :param datastore_id: The datastore ID.
203+ :param datastore_id: The data store ID.
204204 :param job_id: The import job ID.
205205 :return: The import job description.
206206 """
@@ -230,7 +230,7 @@ def list_fhir_import_jobs(
230230 ) -> list [dict [str , any ]]:
231231 """
232232 Lists HealthLake import jobs satisfying the conditions.
233- :param datastore_id: The datastore ID.
233+ :param datastore_id: The data store ID.
234234 :param job_name: The import job name.
235235 :param job_status: The import job status.
236236 :param submitted_before: The import job submitted before the specified date.
@@ -281,7 +281,7 @@ def start_fhir_export_job(
281281 """
282282 Starts a HealthLake export job.
283283 :param job_name: The export job name.
284- :param datastore_id: The datastore ID.
284+ :param datastore_id: The data store ID.
285285 :param output_s3_uri: The output S3 URI.
286286 :param kms_key_id: The KMS key ID associated with the output S3 bucket.
287287 :param data_access_role_arn: The data access role ARN.
@@ -313,7 +313,7 @@ def describe_fhir_export_job(
313313 ) -> dict [str , any ]:
314314 """
315315 Describes a HealthLake export job.
316- :param datastore_id: The datastore ID.
316+ :param datastore_id: The data store ID.
317317 :param job_id: The export job ID.
318318 :return: The export job description.
319319 """
@@ -343,7 +343,7 @@ def list_fhir_export_jobs(
343343 ) -> list [dict [str , any ]]:
344344 """
345345 Lists HealthLake export jobs satisfying the conditions.
346- :param datastore_id: The datastore ID.
346+ :param datastore_id: The data store ID.
347347 :param job_name: The export job name.
348348 :param job_status: The export job status.
349349 :param submitted_before: The export job submitted before the specified date.
@@ -448,11 +448,11 @@ def untag_resource(self, resource_arn: str, tag_keys: list[str]) -> None:
448448
449449 def wait_datastore_active (self , datastore_id : str ) -> None :
450450 """
451- Waits for a HealthLake datastore to become active.
452- :param datastore_id: The datastore ID.
451+ Waits for a HealthLake data store to become active.
452+ :param datastore_id: The data store ID.
453453 """
454454 counter = 0
455- max_count_minutes = 40 # It can take a while to create a datastore , so we'll wait up to 40 minutes.
455+ max_count_minutes = 40 # It can take a while to create a data store , so we'll wait up to 40 minutes.
456456 status = "CREATING"
457457 while counter < max_count_minutes :
458458 datastore = self .health_lake_client .describe_fhir_datastore (
@@ -468,25 +468,25 @@ def wait_datastore_active(self, datastore_id: str) -> None:
468468
469469 if status == "ACTIVE" :
470470 print (
471- f"Datastore with ID { datastore_id } is active after { counter } minutes."
471+ f"Data store with ID { datastore_id } is active after { counter } minutes."
472472 )
473473 elif status == "CREATE_FAILED" :
474474 raise ClientError (
475- "Create datastore with ID %s failed after %d minutes." ,
475+ "Create data store with ID %s failed after %d minutes." ,
476476 datastore_id ,
477477 counter ,
478478 )
479479 else :
480480 raise ClientError (
481- "Datastore with ID %s is not active after %d minutes." ,
481+ "Data store with ID %s is not active after %d minutes." ,
482482 datastore_id ,
483483 counter ,
484484 )
485485
486486 def wait_import_job_complete (self , datastore_id : str , job_id : str ) -> None :
487487 """
488488 Waits for a HealthLake import job to complete.
489- :param datastore_id: The datastore ID.
489+ :param datastore_id: The data store ID.
490490 :param job_id: The import job ID.
491491 """
492492 counter = 0
@@ -520,7 +520,7 @@ def wait_import_job_complete(self, datastore_id: str, job_id: str) -> None:
520520 def wait_export_job_complete (self , datastore_id : str , job_id : str ) -> None :
521521 """
522522 Waits for a HealthLake export job to complete.
523- :param datastore_id: The datastore ID.
523+ :param datastore_id: The data store ID.
524524 :param job_id: The export job ID.
525525 """
526526 counter = 0
@@ -549,9 +549,22 @@ def wait_export_job_complete(self, datastore_id: str, job_id: str) -> None:
549549 )
550550
551551 def health_lake_demo (self ) -> None :
552- use_smart_on_fhir_data_store = True
552+ use_smart_on_fhir_data_store = False
553+
554+ # Change the following variables to match your environment.
555+ datastore_name = "health_imaging_datastore"
556+ import_job_name = "my_import_job"
557+ input_s3_uri = (
558+ "s3://amzn-s3-demo-bucket/import/examples/patient_example.json"
559+ )
560+ kms_key_id = "arn:aws:kms:us-east-1:123456789012:key/b7f645cb-e564-4981-8672-9e012d1ff1a0"
561+ data_access_role_arn = (
562+ "arn:aws:iam::123456789012:role/healthlake_access"
563+ )
564+ export_job_name = "my_export_job"
565+ output_s3_uri = "s3://amzn-s3-demo-bucket/export/output/"
566+
553567
554- datastore_name = "health_imaging_datastore2"
555568 if use_smart_on_fhir_data_store :
556569 # snippet-start:[python.example_code.healthlake.CreateFHIRDatastore.smart]
557570 sse_configuration = {
@@ -605,7 +618,7 @@ def health_lake_demo(self) -> None:
605618 for data_store in data_stores :
606619 if data_store ["DatastoreId" ] == data_store_id :
607620 logger .info (
608- "Datastore with ID %s is %s." ,
621+ "Data store with ID %s is %s." ,
609622 data_store_id ,
610623 data_store ["DatastoreStatus" ],
611624 )
@@ -625,17 +638,8 @@ def health_lake_demo(self) -> None:
625638
626639 self .untag_resource (data_store_arn , keys )
627640
628- job_name = "my_import_job"
629- input_s3_uri = (
630- "s3://health-lake-test-827365/import/examples/patient_example_chalmers.json"
631- )
632- output_s3_uri = "s3://health-lake-test-827365/import/output/"
633- kms_key_id = "arn:aws:kms:us-east-1:123502194722:key/b7f645cb-e564-4981-8672-9e012d1ff1a0"
634- data_access_role_arn = (
635- "arn:aws:iam::123502194722:role/healthlaketest37-ahl-full-access"
636- )
637641 import_job = self .start_fhir_import_job (
638- job_name ,
642+ import_job_name ,
639643 data_store_id ,
640644 input_s3_uri ,
641645 output_s3_uri ,
@@ -657,10 +661,8 @@ def health_lake_demo(self) -> None:
657661 f"Job id: { import_job ['JobId' ]} , status: { import_job ['JobStatus' ]} , submit time: { import_job ['SubmitTime' ]} "
658662 )
659663
660- job_name = "my_export_job"
661- output_s3_uri = "s3://health-lake-test-827365/export/output/"
662664 export_job = self .start_fhir_export_job (
663- job_name , data_store_id , output_s3_uri , kms_key_id , data_access_role_arn
665+ export_job_name , data_store_id , output_s3_uri , kms_key_id , data_access_role_arn
664666 )
665667
666668 export_job_id = export_job ["JobId" ]
0 commit comments