arazzo: 1.0.1 info: title: Amazon HealthLake Provision FHIR Data Store and Export Data summary: Create a FHIR data store, wait until ACTIVE, then export FHIR data and wait until COMPLETED. description: >- Runs the full Amazon HealthLake export lifecycle as one flow. It creates a FHIR data store, polls the data store until its status is ACTIVE, starts a FHIR export job that writes FHIR data from the new data store to an S3 location, and polls the export job until it reports COMPLETED. The create call yields the AWS-generated data store id that is threaded into the export job, and each poll loops on the documented CREATING and SUBMITTED/IN_PROGRESS intermediate statuses. Every step inlines its AWS JSON request body and the X-Amz-Target header that selects the HealthLake operation. version: 1.0.0 sourceDescriptions: - name: healthlakeApi url: ../openapi/amazon-healthlake-openapi.yaml type: openapi workflows: - workflowId: provision-datastore-and-export summary: Create a FHIR data store, wait for ACTIVE, then export data and wait for COMPLETED. description: >- Chains CreateFHIRDatastore, a DescribeFHIRDatastore poll loop until ACTIVE, StartFHIRExportJob against the new data store, and a DescribeFHIRExportJob poll loop until COMPLETED. inputs: type: object required: - DatastoreName - DatastoreTypeVersion - OutputS3Uri - OutputKmsKeyId - DataAccessRoleArn - ExportClientToken properties: DatastoreName: type: string description: The user generated name for the data store. DatastoreTypeVersion: type: string description: The FHIR version of the data store. The only supported version is R4. enum: - R4 CreateClientToken: type: string description: Optional token used for ensuring idempotency of data store creation. OutputS3Uri: type: string description: The S3 location used for the export job output. OutputKmsKeyId: type: string description: The KMS key ID used to access the output S3 bucket. DataAccessRoleArn: type: string description: The IAM role ARN used during the initiation of the export job. ExportClientToken: type: string description: Token used for ensuring idempotency of the export job. ExportJobName: type: string description: The user generated name for the export job. steps: - stepId: createDatastore description: >- Create the FHIR data store. The response returns the AWS-generated data store id, ARN, status, and endpoint. operationId: CreateFHIRDatastore parameters: - name: X-Amz-Target in: header value: HealthLake.CreateFHIRDatastore requestBody: contentType: application/json payload: DatastoreName: $inputs.DatastoreName DatastoreTypeVersion: $inputs.DatastoreTypeVersion ClientToken: $inputs.CreateClientToken successCriteria: - condition: $statusCode == 200 outputs: datastoreId: $response.body#/DatastoreId datastoreArn: $response.body#/DatastoreArn datastoreStatus: $response.body#/DatastoreStatus - stepId: pollDatastore description: >- Describe the data store and inspect its status. While the status is CREATING the step loops back to itself; once the status is ACTIVE the flow proceeds to start the export job. operationId: DescribeFHIRDatastore parameters: - name: X-Amz-Target in: header value: HealthLake.DescribeFHIRDatastore requestBody: contentType: application/json payload: DatastoreId: $steps.createDatastore.outputs.datastoreId successCriteria: - condition: $statusCode == 200 outputs: datastoreStatus: $response.body#/DatastoreProperties/DatastoreStatus onSuccess: - name: datastoreActive type: goto stepId: startExportJob criteria: - context: $response.body condition: $.DatastoreProperties.DatastoreStatus == "ACTIVE" type: jsonpath - name: datastoreStillCreating type: goto stepId: pollDatastore criteria: - context: $response.body condition: $.DatastoreProperties.DatastoreStatus == "CREATING" type: jsonpath - stepId: startExportJob description: >- Begin the FHIR export job against the newly active data store. The response returns the AWS-generated job id and job status. operationId: StartFHIRExportJob parameters: - name: X-Amz-Target in: header value: HealthLake.StartFHIRExportJob requestBody: contentType: application/json payload: JobName: $inputs.ExportJobName OutputDataConfig: S3Configuration: S3Uri: $inputs.OutputS3Uri KmsKeyId: $inputs.OutputKmsKeyId DatastoreId: $steps.createDatastore.outputs.datastoreId DataAccessRoleArn: $inputs.DataAccessRoleArn ClientToken: $inputs.ExportClientToken successCriteria: - condition: $statusCode == 200 outputs: jobId: $response.body#/JobId jobStatus: $response.body#/JobStatus - stepId: pollExportJob description: >- Describe the export job and inspect its status. While the status is SUBMITTED or IN_PROGRESS the step loops back to itself; once the status is COMPLETED the workflow ends. operationId: DescribeFHIRExportJob parameters: - name: X-Amz-Target in: header value: HealthLake.DescribeFHIRExportJob requestBody: contentType: application/json payload: DatastoreId: $steps.createDatastore.outputs.datastoreId JobId: $steps.startExportJob.outputs.jobId successCriteria: - condition: $statusCode == 200 outputs: jobStatus: $response.body#/ExportJobProperties/JobStatus exportJobProperties: $response.body#/ExportJobProperties onSuccess: - name: exportCompleted type: end criteria: - context: $response.body condition: $.ExportJobProperties.JobStatus == "COMPLETED" type: jsonpath - name: exportStillSubmitted type: goto stepId: pollExportJob criteria: - context: $response.body condition: $.ExportJobProperties.JobStatus == "SUBMITTED" type: jsonpath - name: exportStillRunning type: goto stepId: pollExportJob criteria: - context: $response.body condition: $.ExportJobProperties.JobStatus == "IN_PROGRESS" type: jsonpath outputs: datastoreId: $steps.createDatastore.outputs.datastoreId datastoreArn: $steps.createDatastore.outputs.datastoreArn jobId: $steps.startExportJob.outputs.jobId jobStatus: $steps.pollExportJob.outputs.jobStatus