File size: 4,298 Bytes
68d6aee
d6f967e
d2d8aa3
68d6aee
d2d8aa3
 
 
 
68d6aee
d2d8aa3
68d6aee
e34bc5c
68d6aee
e34bc5c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
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" πŸ˜‰