mostafa-atef21/Epilepsy-Management-AI-Agent
0
1---2title: Epilepsy Management AI Agent3emoji: ๐ง 4colorFrom: red5colorTo: purple6sdk: docker7app_port: 78608tags:9- streamlit10- medical-ai11- epilepsy12- chromadb13- semantic-search14- healthcare15pinned: false16license: apache-2.017short_description: AI-powered epilepsy device recommendations18---19 20# ๐ง Epilepsy Management AI Agent21 22AI-powered medical device recommendation system for epilepsy management using semantic search, safety filtering, and evidence-based ranking.23 24## ๐ฏ What This App Does25 26This Streamlit application helps clinicians and patients explore epilepsy management devices based on patient-specific descriptions. It uses:27 28- **Semantic Search**: ChromaDB + Sentence Transformers for intelligent device matching29- **Safety Rules**: Configurable filters for invasiveness and regulatory approvals (FDA/CE)30- **Interactive UI**: Multi-page interface with device catalog, admin tools, and recommendations31 32## โจ Features33 34- ๐ **Patient Input โ Smart Recommendations**: Describe patient condition and receive personalized device suggestions35- ๐ **Semantic Search**: Uses `all-MiniLM-L6-v2` embeddings for intelligent text matching36- ๐ก๏ธ **Safety Filters**: Toggle invasive device filtering and requirement for specific approvals37- ๐ **Device Catalog**: Browse and search the complete knowledge base38- ๐ ๏ธ **Admin Tools**: Upload CSV data and rebuild vector index39- ๐ **Detailed Results**: View device specifications, approvals, indications, and source links40 41## ๐ How to Use42 431. **Enter Patient Description**: Describe the patient's epilepsy characteristics (seizure type, frequency, age, lifestyle needs)442. **Configure Filters**: 45 - Toggle "Avoid invasive devices" on/off46 - Specify required approvals (e.g., "FDA, CE")47 - Adjust top K results (1-10)483. **Generate Recommendations**: Click the button to get AI-filtered device suggestions494. **Explore Results**: View device details, click source links, and browse the full catalog50 51## ๐ Example Query52 53> "16-year-old with focal aware seizures 2โ3 times/week, mostly nocturnal; wants non-invasive detection and caregiver alerts."54 55## ๐๏ธ Architecture56 57```58Patient Input โ Semantic Search (ChromaDB) 59 โ Safety Rules Filtering 60 โ Ranked Recommendations 61 โ Interactive Display62```63 64### Technologies65- **Streamlit**: Web UI framework66- **ChromaDB**: Vector database for semantic search67- **Sentence Transformers**: Text embeddings (all-MiniLM-L6-v2)68- **Pandas**: Data manipulation69- **Python 3.11**: Runtime environment70 71## ๐ Project Structure72 73```74Epilepsy-Management-AI-Agent/75โโโ src/76โ โโโ app.py # Main Streamlit application77โโโ pages/78โ โโโ 1_๐_Device_Catalog.py # Browse all devices79โ โโโ 2_๐ ๏ธ_Admin_ETL.py # CSV upload & index rebuild80โ โโโ 3_โน๏ธ_About.py # Project information81โโโ data/82โ โโโ devices.csv # Device catalog database83โโโ utils/84โ โโโ embeddings.py # ChromaDB integration85โ โโโ rules.py # Safety rule filtering86โโโ requirements.txt # Python dependencies87โโโ Dockerfile # Container configuration88โโโ README.md # This file89```90 91## โ๏ธ Deployment92 93This app is containerized using Docker and deployed on Hugging Face Spaces.94 95### Local Development96```bash97# Build and run98docker build -t epilepsy-ai .99docker run -p 7860:7860 epilepsy-ai100 101# Or with Streamlit directly102pip install -r requirements.txt103streamlit run src/app.py104```105 106## ๐ Data Model107 108The device catalog (`data/devices.csv`) includes:109- `device_id`: Unique identifier110- `name`: Device name111- `category`: Device type (wearable, implant, etc.)112- `indication`: Use case113- `invasiveness`: Invasive/Non-invasive114- `approvals`: Regulatory status (FDA, CE, etc.)115- `summary`: Description text116- `source_url`: Reference link117- `last_seen`: Timestamp118 119## โ ๏ธ Important Notice120 121This tool provides **informational recommendations only** and is **not a substitute for professional medical advice**. Always consult a licensed clinician for diagnosis and treatment decisions.122 123## ๐ง Configuration124 125- **ChromaDB**: Persists in `.chroma/` directory (rebuilds automatically on HF Spaces)126- **Model**: `sentence-transformers/all-MiniLM-L6-v2` (~80MB, downloads on first run)127- **Port**: 7860 (Hugging Face default)128 129## ๐ License130 131Apache 2.0132 133## ๐ฅ Contributing134 135Feel free to submit issues or improvements to the device catalog or codebase.136 137---138 139Built with โค๏ธ for epilepsy management and healthcare innovation.140 