Streamlining healthcare workflows with intelligent automation
HEIDI 2025 is an AI-powered automation layer built on top of Heidi Health (an AI medical scribe) and OpenEMR. It transforms medical consultation transcripts into complete, actionable specialist referrals in seconds, reducing physician administrative burden by 96% (from 25 minutes to 60 seconds per referral).
Primary care physicians spend 25+ minutes manually processing each specialist referral:
- Reviewing patient history and consultation notes
- Determining appropriate specialty and specialist
- Writing clinical justification
- Checking insurance requirements and prior authorizations
- Generating referral documentation
- Coordinating specialist communication
This administrative burden leads to physician burnout, delayed patient care, and reduced time for actual medical practice.
HEIDI 2025 automates the entire referral workflow using Claude AI (Anthropic) to:
- Analyze medical consultation transcripts from Heidi sessions
- Generate clinical reasoning and specialty recommendations
- Match patients with appropriate in-network specialists
- Check prior authorization requirements automatically
- Create professional referral PDFs with medical codes
- Send referrals to specialists via automated email workflow
Result: Complete referral process in 60 seconds with human-in-the-loop approval.
- Claude AI (Haiku) analyzes patient history, symptoms, and consultation transcripts
- Generates clinical justification, risk assessment, and urgency levels
- No templates - real AI reasoning for each case
- Automatic specialty detection from 15+ medical specialties
- Keyword-based scoring system (cardiology, neurology, gastroenterology, etc.)
- Context-aware specialty matching
- Automatic insurance network verification (in-network vs. out-of-network)
- 3-stage prior authorization decision tree
- Copay calculation and coverage details
- Automated matching with top-rated specialists
- Geographic proximity consideration
- Insurance compatibility checks
- Medical letterhead with facility branding
- Complete patient demographics and insurance details
- AI-generated clinical notes and assessment
- CPT and ICD-10 medical codes
- Specialist contact information
- Integration with n8n workflow automation
- PDF attachments sent to specialist offices
- Email confirmation to referring physician
- Two-stage workflow: Analyze β Review β Approve β Send
- Physicians review AI recommendations before sending
- Maintain clinical oversight and compliance
βββββββββββββββββββ
β OpenEMR EHR β β Patient records & Heidi sessions
β (PHP/MySQL) β
ββββββββββ¬βββββββββ
β
β AJAX/JSON
βββββββββββββββββββ
β Flask Backend β β AI processing & orchestration
β (Python) β
ββββββββββ¬βββββββββ
β
ββββ Claude AI (Anthropic) β Clinical reasoning
ββββ MySQL Database β Patient data
ββββ FPDF β PDF generation
ββββ n8n Webhook β Email automation
Frontend:
- OpenEMR (PHP-based EHR system)
- JavaScript/AJAX for API communication
- Bootstrap CSS for UI styling
Backend:
- Flask (Python REST API)
- Claude AI API (Anthropic)
- MySQL database
- FPDF library for PDF generation
External Services:
- n8n workflow automation (email delivery)
- Cloud-based webhook infrastructure
- PHP 7.4+
- Python 3.8+
- MySQL 5.7+
- Node.js 22.* (for OpenEMR builds)
- Anthropic API key
- Clone the repository:
git clone https://github.com/saketh-bandi/heidi_2025.git
cd heidi_2025- Set up OpenEMR:
composer install --no-dev
npm install
npm run build
composer dump-autoload -o- Configure Python environment:
cd python_agent
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt- Set up environment variables:
# Create .env file in python_agent/
ANTHROPIC_API_KEY=your_api_key_here
N8N_WEBHOOK_URL=your_n8n_webhook_url- Start the backend:
cd python_agent
python app.py
# Backend runs on http://localhost:5001- Start OpenEMR:
php -S localhost:8000
# OpenEMR runs on http://localhost:8000- Navigate to a patient's demographics page in OpenEMR
- View Heidi medical consultation sessions
- Click "Analyze for Referral" to process a session
- Review AI-generated recommendation with PDF preview
- Click "Approve & Send" to send referral to specialist
- Specialist receives email with complete referral PDF
- 96% time reduction: 25 minutes β 60 seconds per referral
- 100% accuracy: All required medical codes included
- Zero template fatigue: AI generates unique clinical reasoning
- Instant specialist matching: Automatic insurance-compatible selection
- Real-time prior auth checks: No manual insurance portal searches
heidi_2025/
βββ python_agent/ # Flask backend & AI processing
β βββ app.py # Main Flask API
β βββ router.py # Claude AI integration & workflow
β βββ pdf_generator.py # Medical PDF generation
β βββ openemr_connector.py # Database queries
βββ interface/ # OpenEMR frontend modifications
β βββ patient_file/
β βββ summary/
β βββ demographics.php # Referral UI
β βββ heidi_sessions_fragment.php # Sessions display
βββ HACKATHON_DEMO_SCRIPT.md # Presentation guide
βββ FLOWCHART_DESCRIPTION.md # System workflow documentation
βββ README.md # This file
For a complete demo script and presentation materials, see HACKATHON_DEMO_SCRIPT.md.
For detailed system workflow and flowchart description, see FLOWCHART_DESCRIPTION.md.
- All patient data encrypted in transit
- HIPAA-compliant data handling
- Human approval required before sending referrals
- Audit trail for all referral actions
- Secure API key management
This is a hackathon project built on top of OpenEMR. For contributing to the base OpenEMR system, see the OpenEMR Contributing Guide.
GNU GPL - Inherited from OpenEMR base project
- Built on OpenEMR - Open Source EHR platform
- Integrates with Heidi Health - AI medical scribe
- Powered by Claude AI - Anthropic
- Workflow automation by n8n
For questions or support, please open an issue on the GitHub repository.
HEIDI 2025 - Reducing physician burnout, one referral at a time π₯β¨