An automated monitoring system for Elation Health EMR that detects care gaps and sends customizable alerts for lab work, follow-up appointments, preventive screenings, and other healthcare needs.
- Customizable Care Gap Rules: Define your own rules for monitoring different types of care gaps
- Multiple Alert Channels: Receive notifications via email and SMS
- Intelligent Scheduling: Respects quiet hours and configurable reminder frequencies
- Comprehensive Tracking: Monitor lab work, appointments, medications, immunizations, screenings, and vital signs
- Priority-Based Alerts: Categorize gaps by urgency (high, medium, low)
- Automated Monitoring: Run continuous checks or schedule periodic scans
- Alert History: Track when and how alerts were sent
- Lab Work: Monitor overdue lab tests (cholesterol, HbA1c, CMP, TSH, etc.)
- Follow-up Appointments: Track needed visits for chronic disease management and annual physicals
- Medication Management: Alert when refills are needed or medication reviews are due
- Immunizations: Monitor flu shots and other vaccinations
- Preventive Screenings: Track mammography, colonoscopy, and other cancer screenings
- Vital Monitoring: Ensure regular blood pressure, weight, and other vital sign checks
- Python 3.11 or higher
- Elation Health API credentials
- SMTP server access for email alerts (optional)
- Twilio account for SMS alerts (optional)
-
Clone the repository:
git clone <repository-url> cd new
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
cp .env.example .env
Edit
.envand add your credentials:# Elation Health API ELATION_API_KEY=your_api_key ELATION_API_SECRET=your_api_secret ELATION_BASE_URL=https://api.elationhealth.com ELATION_PATIENT_ID=your_patient_id # Email Alerts ALERT_EMAIL_FROM=alerts@example.com ALERT_EMAIL_TO=your_email@example.com SMTP_HOST=smtp.gmail.com SMTP_PORT=587 SMTP_USERNAME=your_smtp_username SMTP_PASSWORD=your_smtp_password # SMS Alerts (optional) TWILIO_ACCOUNT_SID=your_twilio_sid TWILIO_AUTH_TOKEN=your_twilio_token TWILIO_FROM_NUMBER=+1234567890 TWILIO_TO_NUMBER=+1234567890
-
Customize care gap rules (optional): Edit
care_gap_rules.yamlto add, remove, or modify monitoring rules
- Visit the Elation Developer Sandbox
- Register as a trusted developer
- Request API credentials
- Once approved, you'll receive your API key and secret
- Find your patient ID in your Elation Health account
For detailed API documentation, visit:
python main.py testRun a one-time care gap check and send alerts:
python main.py checkRun continuous monitoring based on your configured schedule:
python main.py monitorThis will check for care gaps at the interval specified in care_gap_rules.yaml (default: every 24 hours at 9:00 AM).
Check the monitoring status and recent alerts:
python main.py statusDisplay all configured care gap rules:
python main.py rulesSpecify a different rules configuration file:
python main.py check --rules-file my_custom_rules.yamlEdit care_gap_rules.yaml to customize monitoring rules. Each rule has the following structure:
- id: unique_rule_id
name: Human-readable rule name
type: rule_type # lab_work, follow_up_appointment, medication_management, etc.
description: Description of what this rule monitors
enabled: true
conditions:
max_days_since_last: 365 # How often this should occur
applies_to_conditions: # Only apply if patient has these conditions
- "diabetes"
- "hypertension"
# Other type-specific conditions
alert_priority: high # high, medium, or low
alert_message: Message to send in alertlab_work: Monitor lab tests by LOINC codefollow_up_appointment: Track appointment typesmedication_management: Monitor medication refills and reviewsimmunization: Track vaccinations by CVX codepreventive_screening: Monitor screenings by CPT codevital_monitoring: Track vital sign measurements
- id: vitamin_d_screening
name: Annual Vitamin D Test
type: lab_work
description: Annual vitamin D level check
enabled: true
conditions:
lab_test_code: "1989-3" # LOINC code for Vitamin D
max_days_since_last: 365
alert_priority: medium
alert_message: "Your annual vitamin D test is due."- id: mental_health_check_in
name: Mental Health Check-in
type: follow_up_appointment
description: Quarterly mental health appointment
enabled: true
conditions:
appointment_type: "mental-health"
max_days_since_last: 90
alert_priority: high
alert_message: "Time to schedule your mental health check-in appointment."Configure alert behavior in care_gap_rules.yaml:
alert_settings:
# Quiet hours (no alerts sent during this time)
quiet_hours_start: "22:00"
quiet_hours_end: "08:00"
# How often to repeat alerts (in days)
reminder_frequency_days:
high: 3 # Repeat high-priority alerts every 3 days
medium: 7 # Repeat medium-priority alerts every 7 days
low: 14 # Repeat low-priority alerts every 14 days
# Alert methods to use
methods:
- email
- sms # Uncomment if you have Twilio configuredConfigure when checks are performed:
monitoring:
check_interval: 24 # Hours between checks
preferred_check_time: "09:00" # Time of day to run checks (24-hour format)The system uses industry-standard medical coding systems:
-
LOINC Codes: Lab test identifiers (e.g., "2093-3" for Total Cholesterol)
- Find codes at LOINC.org
-
CVX Codes: Vaccine identifiers (e.g., "141" for Influenza vaccine)
- Find codes at CDC CVX Codes
-
CPT Codes: Procedure codes (e.g., "77067" for Mammography)
- Find codes at AMA CPT
- Application logs:
care_gap_monitor.log - Alert history: Stored in
care_gaps.db(SQLite database)
View recent alert history:
python main.py statusAlerts are sent as formatted HTML emails with:
- Summary of total care gaps
- Gaps grouped by priority (high, medium, low)
- Details for each gap including type, days overdue, and action needed
- Color-coded priority indicators
SMS alerts provide a concise summary:
- Total number of care gaps
- Number of high-priority gaps
- Prompt to check email for details
# Test your API connection
python main.py test
# Check logs for detailed error messages
tail -f care_gap_monitor.log- Verify SMTP credentials in
.env - For Gmail, enable "Less secure app access" or use an App Password
- Check firewall settings for SMTP port (typically 587)
- Review logs for detailed error messages
- Verify Twilio credentials in
.env - Ensure your Twilio account is active and funded
- Verify phone numbers are in E.164 format (+1234567890)
- Check Twilio console for error messages
- Verify the rule is enabled (
enabled: true) - Check if the rule's conditions apply to your patient profile
- Verify medical codes (LOINC, CVX, CPT) are correct
- Review logs to see which rules are being evaluated
- Never commit
.env: Your API credentials and secrets should never be in version control - Secure API credentials: Store in environment variables or a secure vault
- HTTPS only: The application enforces HTTPS for API connections
- PHI compliance: This application handles Protected Health Information (PHI). Ensure your deployment complies with HIPAA and other relevant regulations
- Access control: Restrict access to the application and its data files
┌─────────────────────────────────────────────┐
│ Main Application (main.py) │
└─────────────────┬───────────────────────────┘
│
┌─────────┴─────────┐
│ │
┌───────▼────────┐ ┌──────▼──────────┐
│ Elation Client │ │ Care Gap Engine │
│ (API wrapper) │ │ (Rule evaluator)│
└────────────────┘ └──────┬──────────┘
│
┌──────▼───────────┐
│ Alert Manager │
│ (Email/SMS) │
└──────────────────┘
new/
├── main.py # Main application entry point
├── requirements.txt # Python dependencies
├── care_gap_rules.yaml # Care gap rules configuration
├── .env.example # Environment variable template
├── .gitignore # Git ignore rules
├── README.md # This file
├── src/
│ ├── __init__.py
│ ├── elation_client.py # Elation Health API client
│ ├── care_gap_engine.py # Care gap detection engine
│ └── alert_manager.py # Alert and notification manager
└── care_gaps.db # SQLite database (created on first run)
# Test API connection
python main.py test
# Run a dry-run check
python main.py checkTo add support for a new care gap type:
- Add a new rule type to
care_gap_rules.yaml - Implement a corresponding check method in
CareGapEngine(e.g.,_check_new_type_gap()) - Add the method to the type mapping in
check_all_gaps()
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is provided as-is for personal health monitoring purposes. Always consult with healthcare professionals for medical decisions.
This application is a monitoring tool and does not provide medical advice. It is not a substitute for professional medical care. Always consult with qualified healthcare providers for health-related decisions.
The accuracy of care gap detection depends on:
- Completeness of EMR data
- Accuracy of configured rules
- Proper API credentials and access
For issues or questions:
- Check the logs:
care_gap_monitor.log - Review Elation Health API documentation
- Verify your configuration in
.envandcare_gap_rules.yaml - Open an issue in the repository
Future enhancements:
- Web dashboard for viewing care gaps
- Push notifications via mobile apps
- Integration with calendar apps for appointment scheduling
- Machine learning for personalized care gap predictions
- Support for multiple patients/family members
- Integration with wearable devices
- Medication interaction checking
- Health goal tracking
- Built for Elation Health EMR platform
- Uses industry-standard medical coding (LOINC, CVX, CPT)
- Designed with HIPAA compliance in mind