CoolFace
Apppublic

mostafa-atef21/Epilepsy-Management-AI-Agent

sourceHugging Faceapache-2.0updated 11mo agoView on Hugging Face
0likes
README.md140 linesDownload Raw Back to root
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