mostafa-atef21/Epilepsy-Management-AI-Agent
0
๐ง Epilepsy Management AI Agent
AI-powered medical device recommendation system for epilepsy management using semantic search, safety filtering, and evidence-based ranking.
๐ฏ What This App Does
This Streamlit application helps clinicians and patients explore epilepsy management devices based on patient-specific descriptions. It uses:
- Semantic Search: ChromaDB + Sentence Transformers for intelligent device matching
- Safety Rules: Configurable filters for invasiveness and regulatory approvals (FDA/CE)
- Interactive UI: Multi-page interface with device catalog, admin tools, and recommendations
โจ Features
- ๐ Patient Input โ Smart Recommendations: Describe patient condition and receive personalized device suggestions
- ๐ Semantic Search: Uses
all-MiniLM-L6-v2embeddings for intelligent text matching - ๐ก๏ธ Safety Filters: Toggle invasive device filtering and requirement for specific approvals
- ๐ Device Catalog: Browse and search the complete knowledge base
- ๐ ๏ธ Admin Tools: Upload CSV data and rebuild vector index
- ๐ Detailed Results: View device specifications, approvals, indications, and source links
๐ How to Use
- Enter Patient Description: Describe the patient's epilepsy characteristics (seizure type, frequency, age, lifestyle needs)
- Configure Filters:
- Toggle "Avoid invasive devices" on/off
- Specify required approvals (e.g., "FDA, CE")
- Adjust top K results (1-10)
- Generate Recommendations: Click the button to get AI-filtered device suggestions
- Explore Results: View device details, click source links, and browse the full catalog
๐ Example Query
"16-year-old with focal aware seizures 2โ3 times/week, mostly nocturnal; wants non-invasive detection and caregiver alerts."
๐๏ธ Architecture
Patient Input โ Semantic Search (ChromaDB)
โ Safety Rules Filtering
โ Ranked Recommendations
โ Interactive DisplayTechnologies
- Streamlit: Web UI framework
- ChromaDB: Vector database for semantic search
- Sentence Transformers: Text embeddings (all-MiniLM-L6-v2)
- Pandas: Data manipulation
- Python 3.11: Runtime environment
๐ Project Structure
Epilepsy-Management-AI-Agent/
โโโ src/
โ โโโ app.py # Main Streamlit application
โโโ pages/
โ โโโ 1_๐_Device_Catalog.py # Browse all devices
โ โโโ 2_๐ ๏ธ_Admin_ETL.py # CSV upload & index rebuild
โ โโโ 3_โน๏ธ_About.py # Project information
โโโ data/
โ โโโ devices.csv # Device catalog database
โโโ utils/
โ โโโ embeddings.py # ChromaDB integration
โ โโโ rules.py # Safety rule filtering
โโโ requirements.txt # Python dependencies
โโโ Dockerfile # Container configuration
โโโ README.md # This fileโ๏ธ Deployment
This app is containerized using Docker and deployed on Hugging Face Spaces.
Local Development
# Build and run
docker build -t epilepsy-ai .
docker run -p 7860:7860 epilepsy-ai
# Or with Streamlit directly
pip install -r requirements.txt
streamlit run src/app.py๐ Data Model
The device catalog (data/devices.csv) includes:
device_id: Unique identifiername: Device namecategory: Device type (wearable, implant, etc.)indication: Use caseinvasiveness: Invasive/Non-invasiveapprovals: Regulatory status (FDA, CE, etc.)summary: Description textsource_url: Reference linklast_seen: Timestamp
โ ๏ธ Important Notice
This tool provides informational recommendations only and is not a substitute for professional medical advice. Always consult a licensed clinician for diagnosis and treatment decisions.
๐ง Configuration
- ChromaDB: Persists in
.chroma/directory (rebuilds automatically on HF Spaces) - Model:
sentence-transformers/all-MiniLM-L6-v2(~80MB, downloads on first run) - Port: 7860 (Hugging Face default)
๐ License
Apache 2.0
๐ฅ Contributing
Feel free to submit issues or improvements to the device catalog or codebase.
Built with โค๏ธ for epilepsy management and healthcare innovation.
