Quick Overview
This workflow watches a Google Drive folder for new lab-report PDFs, extracts their text, uses OpenAI (gpt-4o-mini) to structure and simplify results, translates the summary into the patient’s preferred language, and emails a Markdown report via Gmail, with error notifications sent to Slack.
How it works
- Triggers every minute when a new PDF is created in a specific Google Drive folder.
- Downloads the PDF from Google Drive and extracts the raw text content.
- Sends the extracted text to OpenAI (gpt-4o-mini) to extract structured patient/report fields, detect the report language, and capture raw findings.
- Cleans and parses the OpenAI JSON response to reliably carry forward patient details, report metadata, and findings.
- Uses OpenAI (gpt-4o-mini) to rewrite the raw findings into a warm, jargon-free plain-English Markdown summary with a “What to do next” section.
- Uses OpenAI (gpt-4o-mini) to translate the Markdown summary into the patient’s preferred language while preserving formatting.
- Builds a final Markdown report, converts it into a .md attachment, and sends it to the patient via Gmail.
- Posts error details to a Slack channel if extraction, simplification, or translation fails.
Setup
- Connect Google Drive OAuth2 credentials and set the folder ID in the Google Drive trigger to the lab-reports folder you want to monitor.
- Add an OpenAI API key credential (the workflow uses the gpt-4o-mini model for extraction, summarization, and translation).
- Connect Gmail OAuth2 credentials and ensure the recipient expression resolves to a real patient email (the workflow uses
{{$json.patient_email}}).
- Connect Slack OAuth2 credentials and replace
YOUR_SLACK_CHANNEL_ID with the channel where error alerts should be posted.
- Upload a sample PDF to the watched Google Drive folder and verify you receive the email with the Markdown attachment and any errors appear in Slack.