How ibrahimango02/healthcare-referral-pipeline works
This is a durable clinical-referral intake pipeline: users submit HL7 v2 messages, which are parsed, enriched from clinical notes, validated, optionally held for human review, and written as FHIR R4 resources. The CLI starts and inspects Temporal workflows; the worker registers the workflow and its I/O activities. Activities select LLM or heuristic extraction, local or Lambda validation, and FHIR-server or file output. The README documents these capabilities; unsampled integrations are shown only where that documentation supports them.
Main entry points: activities.py Activity handlers · cli.py Intake CLI · workflows.py Referral workflow · worker.py Temporal worker
Components 17
Intake interfaces
- Intake CLI
intake/cli.py
Durable orchestration
- Temporal worker
intake/worker.py - Referral workflow
intake/workflows.py - Activity handlers
intake/activities.py - Workflow data models
intake/models.py
Referral processing
- HL7 parser
intake/hl7_parser.py - Field extraction
intake/extraction.py
Validation and output
- Validation rules
intake/validation.py - FHIR bundle writer
intake/fhir.py
Other components
- Referral submitter
- Human reviewer
- HL7 message
- Temporal service
- Anthropic API
- AWS Lambda validation
lambda_handler.py - FHIR R4 server
- Bundle file output
Connections 21
- Referral submitter → Intake CLI: submits message
- HL7 message → Intake CLI: provides contents
- Intake CLI → HL7 parser: reads control ID
- Intake CLI → Temporal service: starts or queries
- Temporal worker → Temporal service: connects and polls
- Temporal worker → Referral workflow: registers workflow
- Temporal worker → Activity handlers: registers activities
- Temporal service → Referral workflow: dispatches workflow
- Referral workflow → Activity handlers: schedules steps
- Referral workflow → Workflow data models: uses typed data
- Activity handlers → HL7 parser: calls parse
- Activity handlers → Field extraction: calls extraction
- Activity handlers → Validation rules: calls local rules
- Activity handlers → AWS Lambda validation: invokes optionally
- AWS Lambda validation → Validation rules: calls shared rules
- Activity handlers → FHIR bundle writer: calls write
- Field extraction → Anthropic API: requests extraction
- Human reviewer → Intake CLI: submits decision
- Intake CLI → Temporal service: signals review
- FHIR bundle writer → FHIR R4 server: posts transaction
- FHIR bundle writer → Bundle file output: writes bundle