MedQA / README.md
mgbam's picture
Update README.md
e34bc5c verified
---
title: MedQA
emoji: πŸ†
colorFrom: red
colorTo: yellow
sdk: streamlit
sdk_version: 1.45.1
app_file: app.py
pinned: false
license: mit
---
# Quantum Healthcare Navigator βš•οΈπŸ§ πŸ”¬
Welcome to the Quantum Healthcare Navigator, an AI-powered application designed for healthcare professionals. This Hugging Face Space demonstrates the integration of Large Language Models (LLMs), specialized medical information tools, and (simulated) quantum-inspired optimization for treatment suggestions.
## ✨ Features
* **AI Consultation:** Interactive chat with an AI assistant.
* **Medical Knowledge Access:** Tools for UMLS and BioPortal lookups.
* **Quantum Treatment Optimizer:** (Simulated) Get suggestions for treatment plans based on patient data.
* **User Authentication:** Secure login and signup.
* **Session Management:** Chat history is saved per user session.
* **PDF Reports:** Download consultation transcripts.
* **Dockerized:** Easy to deploy and run locally.
## πŸ“‚ Project Structure
Use code with caution.
Markdown
quantum_healthcare_app/
β”œβ”€β”€ app.py # Streamlit entrypoint
β”œβ”€β”€ agent.py # LangChain agent setup
β”œβ”€β”€ pages/ # Streamlit multipage views
β”‚ β”œβ”€β”€ 1_Home.py
β”‚ β”œβ”€β”€ 2_Consult.py
β”‚ └── 3_Reports.py
β”œβ”€β”€ tools/ # LangChain Tool wrappers
β”‚ β”œβ”€β”€ init.py
β”‚ β”œβ”€β”€ gemini_tool.py
β”‚ β”œβ”€β”€ umls_tool.py
β”‚ β”œβ”€β”€ bioportal_tool.py
β”‚ └── quantum_tool.py
β”œβ”€β”€ models/ # SQLModel definitions & DB init
β”‚ β”œβ”€β”€ init.py
β”‚ β”œβ”€β”€ db.py
β”‚ β”œβ”€β”€ user.py
β”‚ └── chat.py
β”œβ”€β”€ services/ # Shared services (auth, logging, PDF)
β”‚ β”œβ”€β”€ init.py
β”‚ β”œβ”€β”€ auth.py
β”‚ β”œβ”€β”€ logger.py
β”‚ β”œβ”€β”€ metrics.py
β”‚ └── pdf_report.py
β”œβ”€β”€ clinical_nlp/ # Clinical‐NLP helpers
β”‚ β”œβ”€β”€ init.py
β”‚ └── umls_bioportal.py
β”œβ”€β”€ quantum/ # Quantum optimizer stub
β”‚ β”œβ”€β”€ init.py
β”‚ └── optimizer.py
β”œβ”€β”€ config/ # Configuration
β”‚ └── settings.py
β”œβ”€β”€ assets/ # Images, logos
β”‚ β”œβ”€β”€ init.py
β”‚ └── logo.png
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ docker-compose.yml # For local development
β”œβ”€β”€ requirements.txt
└── README.md
## βš™οΈ Setup & Configuration
1. **Clone the repository (if applicable) or create the files as listed.**
2. **Create a `.env` file** in the root `quantum_healthcare_app/` directory based on `.env.example`. Populate it with your API keys and desired settings.
```env
APP_TITLE="Quantum Healthcare Navigator"
SECRET_KEY="your_very_secret_key"
DATABASE_URL="sqlite:///./quantum_healthcare.db" # Default for HF Spaces
OPENAI_API_KEY="sk-..."
GEMINI_API_KEY="..."
UMLS_API_KEY="..."
BIOPORTAL_API_KEY="..."
LOG_LEVEL="INFO"
```
3. **Hugging Face Space Deployment:**
* Create a new Space on Hugging Face.
* Choose "Docker" as the Space SDK (or Streamlit and provide `requirements.txt`). Docker is recommended for this complexity.
* Upload your files.
* Go to "Settings" in your Space and add your `.env` variables as **Secrets**.
* The Space should build and run the `Dockerfile`.
## πŸš€ Running Locally (using Docker)
1. **Ensure Docker and Docker Compose are installed.**
2. **Create and populate your `.env` file** as described above.
3. **Build and run the application:**
```bash
docker-compose up --build
```
4. Open your browser and navigate to `http://localhost:8501`.
## πŸ“ Notes
* The **Quantum Optimizer** is currently a stub. It simulates quantum processing but doesn't connect to actual quantum hardware.
* **UMLS and BioPortal API** interactions are simplified. Real integration requires more robust error handling, authentication (e.g., UMLS Ticket Granting Tickets), and result parsing.
* **Error handling and logging** are basic. Production systems would require more comprehensive strategies.
* **Security:** While basic authentication is implemented, ensure all security best practices if deploying for wider use (e.g., HTTPS, input validation, dependency scanning).
* This application is for **demonstration purposes only** and should not be used for actual medical decision-making.
---
"Built by the World's Greatest AI Engineer" πŸ˜‰