CoolFace
Apppublic

mostafa-atef21/Epilepsy-Management-AI-Agent

sourceHugging Faceapache-2.0updated 11mo agoView on Hugging Face
0likes
App README

๐Ÿง  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. 1.Enter Patient Description: Describe the patient's epilepsy characteristics (seizure type, frequency, age, lifestyle needs)
  2. 2.Configure Filters:
  3. 3.Toggle "Avoid invasive devices" on/off
  4. 4.Specify required approvals (e.g., "FDA, CE")
  5. 5.Adjust top K results (1-10)
  6. 6.Generate Recommendations: Click the button to get AI-filtered device suggestions
  7. 7.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.