title: Epilepsy Management AI Agent
emoji: π§
colorFrom: red
colorTo: purple
sdk: docker
app_port: 7860
tags:
- streamlit
- medical-ai
- epilepsy
- chromadb
- semantic-search
- healthcare
pinned: false
license: apache-2.0
short_description: AI-powered epilepsy device recommendations
π§ 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 Display
Technologies
- 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.