Below are details into to use Terraform in creating a tool to upload a medical professional notes into AWS & summarize your notes auto-magically, w/the help of HIPPA the Hippo!
Contents of Tables:
General flow of steps
Step 1 – upload audio file w/nifty commands
Step 2- check your AWS console that the infra is ALIVVVVVE
Step 3 – run lambda.py script
Step 4 – confirm AWS Transcribe Medical & S3 bucket has goodiezzzz
Step 5.1 – AWS Comprehend Medical Create Job
Step 5.2 – AWS Comprehend Medical Real-Time Analysis
Step 6 – the sausage aka code
General Steps followed in my brain:
##############################################
##############################################
User uploads audio → S3
↓
Transcribe Medical job
↓
Transcript saved to S3
↓
Lambda calls Comprehend Medical
↓
Extracted entities saved to S3
Step 1 – Upload audio file w/commands you might need:
Record audio on phone or laptop, place in downloads or desired folder
Check various AWS locations where you should see code – s3, lambda, iam policy/roles, transcribe, etc.
You should see 3 new buckets
audio-input
medical-output
job.json
results-bucket
Step 3 – Run Lambda.py script:
python3 transcribe.py
This recording will consist of Discussing multiple topics that have to do with some form of AWS transform, comprehend. Terraform S3. Lambda To better understand what is the most efficient way. To actually Make an individual health professional’s job easier so that they can listen to their patients. Do an audio recording. Depending the Situation, the details. The diagnosis. The meds The recommendations they should be on. At which point they can then use the AWS. Comprehend To take that transcribe. Audio recording. From speech to text and put it in. Comprehend that’ll summarize it. Hopefully, LOL. YOLO, we’ll see if this works.
Step 4 – Confirm in AWS Transcribe Medical & S3 Buckets of data:
To confirm hit download & view in vscode json – prolly in 1 line, use shift-alt-f to quick review
Step 5.1 AWS Comprehend Medical – Create Job:
Important Note:
input bucket
output bucket…i know confusing, dont do audio file – remember what comprehend does…
output bucket
your results bucket
iam role
should pop-up in dropdown if code is correct in policy
Step 5.2 AWS Comprehend Medical – Real-Time Analysis:
In providers.tf add backend to remote so you can operate in enhanced/remote/HCP as well as your state be in enhanced/remote/HCP & even stream to your CLI in VsCode..compared to standard state that just stores state (like an S3 backend)
TF Remote provider magic:
Seeing the TF at work locally in the CLI & live in HCP, woah – magic..
Then jump to the ole’ AWS Console to check your IaC
Alright alright alright, lets destroy in the CLI
Annnnnnnnnnd, once again you can see live “streamin” in HCP
OMG its gone!!
S3 —–> HCP Enhanced/Remote:
Then if you have your backend provider already established, you can see live the new state before any Terraform is planned or applied
main.tf
provider "aws" {
region = var.aws_region
}
# Create IAM user
resource "aws_iam_user" "example_user" {
name = var.user_name
}
# Attach policy to the user
resource "aws_iam_user_policy_attachment" "example_user_policy" {
user = aws_iam_user.example_user.name
policy_arn = var.policy_arn
}
# Create access keys for the user
resource "aws_iam_access_key" "example_user_key" {
user = aws_iam_user.example_user.name
}
output.tf
output "iam_user_name" {
value = aws_iam_user.example_user.name
}
output "access_key_id" {
value = aws_iam_access_key.example_user_key.id
}
output "secret_access_key" {
value = aws_iam_access_key.example_user_key.secret
sensitive = true
}