File size: 4,668 Bytes
a446f12 dc45d07 8d48081 a446f12 8d48081 a446f12 8d48081 a446f12 dc45d07 8d48081 a446f12 8d48081 225e05c a446f12 8d48081 a446f12 8d48081 a446f12 8d48081 225e05c 8d48081 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | ---
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-v2` embeddings 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
1. **Enter Patient Description**: Describe the patient's epilepsy characteristics (seizure type, frequency, age, lifestyle needs)
2. **Configure Filters**:
- Toggle "Avoid invasive devices" on/off
- Specify required approvals (e.g., "FDA, CE")
- Adjust top K results (1-10)
3. **Generate Recommendations**: Click the button to get AI-filtered device suggestions
4. **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
```bash
# 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 identifier
- `name`: Device name
- `category`: Device type (wearable, implant, etc.)
- `indication`: Use case
- `invasiveness`: Invasive/Non-invasive
- `approvals`: Regulatory status (FDA, CE, etc.)
- `summary`: Description text
- `source_url`: Reference link
- `last_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.
|