PS - This project was built as part of GitHub x Microsoft Hack Day on September 8
A voice-activated AI medical triage system that you can literally call on the phone (call +1 8337512248) and it instantly analyzes your symptoms to detect medical emergencies and provide intelligent health guidance. currently answers only basic info for MVP, thought this would be a good idea for using GraphRAG in the long run
- Phone Integration: Twilio Voice API for handling phone calls
- AI Analysis: Microsoft GraphRAG for medical knowledge reasoning
- Emergency Detection: Automatic identification of medical emergencies
- Conversation Management: State-driven conversation flow
- Safety-First: Always errs on the side of caution with appropriate disclaimers
The system consists of four main components:
- Receives Twilio webhooks
- Converts speech to text and text to speech
- Manages call flow and TwiML responses
- Tracks conversation state (greeting ? symptoms ? follow-up ? recommendation)
- Extracts symptoms from natural language
- Manages conversation flow logic
- Microsoft GraphRAG-inspired medical reasoning
- Knowledge graph with medical conditions and relationships
- OpenAI integration for advanced analysis (with fallback)
- Comprehensive medical condition database
- Emergency trigger detection rules
- Risk stratification and triage logic
- Install Dependencies
pip install -r requirements.txt- Environment Variables
Create a
.envfile with:
OPENAI_API_KEY=your_openai_key_here
TWILIO_ACCOUNT_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_token
WEAVIATE_URL=http://localhost:8080 # Optional- Run the System
python main.pyThe system will start on http://localhost:8000
GET /- System status and informationPOST /voice/incoming- Handle incoming Twilio callsPOST /voice/gather- Process speech input from callersGET /health- Comprehensive health checkGET /demo/test-emergency- Demo emergency detectionGET /demo/test-graphrag- Demo GraphRAG analysis
Caller: "I'm having severe chest pain and I'm sweating"
System: "?? MEDICAL EMERGENCY DETECTED ??
Call 911 immediately. This could be a heart attack."
Caller: "I have a headache and feel nauseous"
System: "Based on your symptoms, this could be a migraine.
I recommend scheduling an appointment with your healthcare provider."
The system uses a medical knowledge graph with:
- Nodes: Medical conditions, symptoms, risk factors
- Edges: Relationships between medical entities
- Reasoning: Graph traversal for symptom analysis
- Fallback: Local analysis when OpenAI is unavailable
This project is for educational and research purposes. Not intended for production medical use without proper medical oversight and validation.