Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mdimado/medraga

MedRaga is a medical assistance application aimed at providing accurate and personalized medical information to healthcare professionals. It uses RAG technology to retrieve the latest medical research from trusted sources, augment it with patient data, and deliver personalized diagnoses and treatment plans.
https://github.com/mdimado/medraga

arxiv beautifulsoup cohere fastapi firebase firebase-auth gemini-api langchain langchain-python playwright qdrant qdrant-vector-database rag reactjs selenium

Last synced: 11 days ago
JSON representation

MedRaga is a medical assistance application aimed at providing accurate and personalized medical information to healthcare professionals. It uses RAG technology to retrieve the latest medical research from trusted sources, augment it with patient data, and deliver personalized diagnoses and treatment plans.

Awesome Lists containing this project

README

        

MedRaga - AI Enhanced Diagnostic & Treatment Planning System
===================================================

### Overview

This project utilizes Retrieval-Augmented Generation (RAG) to enhance the quality and relevance of medical information provided to doctors. It combines retrieval-based and generation-based models to offer personalized diagnoses and treatment plans based on the doctor's query and the patient's medical history.

![Screenshot 2024-06-03 at 3 26 06 PM-modified](https://github.com/mdimado/MedRaga/assets/123477562/e9dad2fe-81f6-4388-9970-21c5c18f8654)

### Features

1. **RAG Pipeline**: Combines retrieval and generation models to provide comprehensive medical information tailored to each patient's needs.

2. **Latest Medical Information**: Utilizes APIs and web scraping to gather the newest medical research from trusted sources, ensuring accuracy and relevance.

3. **Personalization**: Takes into account the unique medical history of each patient to offer personalized diagnoses and treatment plans.

4. **Trusted Information Sources**: Collects data only from reputable medical journals and websites, ensuring the reliability of the recommendations.

![Screenshot 2024-06-03 at 3 25 54 PM-modified](https://github.com/mdimado/MedRaga/assets/123477562/7e5d483c-79df-47c3-95aa-cb8a98fd045c)

### Abstract

The project obtains the latest medical research from trusted sources using APIs and web scraping. PDF files and articles are downloaded, indexed, and converted to text embeddings using Cohere. These embeddings are stored as vectors in a vector database (Qdrant).

When a doctor queries the prototype, it retrieves the most relevant information and adds it to the context window of the Language Model (LLM). The LLM then takes the new context window, the original prompt, and the summarized patient history to generate the output.

![Screenshot 2024-06-03 at 3 25 41 PM-modified](https://github.com/mdimado/MedRaga/assets/123477562/872f10ca-f1e9-4ad4-b3af-3ede3d48691a)

### Usage

1. Clone this repository to your local machine:

```
git clone https://github.com/mdimado/medbot.git
cd medbot
```

### Set up Frontend

1. Change the current working directory to "frontend"

```
cd frontend
```

2. Install Dependencies:

```bash
npm install
```

3. Set Up Firebase:
- Create a Firebase project at [Firebase Console](https://console.firebase.google.com/).
- Obtain your Firebase config credentials.
- Add your Firebase config to `src/firebase/firebaseConfig.js`.

4. Start the Development Server:

```bash
npm start
```

This will run the React development server. You can view the website at `http://localhost:3000`.

### Folder Structure

The project folder structure is organized as follows:

- **`public/`**: Contains static assets and the main `index.html` file.
- **`src/`**: Contains all the source code for the React.js frontend.
- **`assets/`**: Static assets like images, fonts, etc.
- **`components/`**: Reusable components
- **`Header/`**: Header component
- **`Helmet/`**: Helmet component
- **`Layout/`**: Layout components
- `Modal.jsx`: Modal component
- `PatientForm.jsx`: PatientForm component
- `PatientInfo.jsx`: PatientInfo component
- **`custom-hooks/`**: Custom React hooks
- **`pages/`**: Pages of the application
- `ChatBot.jsx`: ChatBot page component
- `Home.jsx`: Home page component
- `Login.jsx`: Login page component
- `Signup.jsx`: Signup page component
- **`redux/`**: Redux setup
- **`routers/`**: Router setup
- **`styles/`**: CSS styles
- `App.css`: Global styles
- `App.js`: Main application component
- `firebase.config.js`: Firebase configuration
- `index.js`: Entry point

### Set up Backend

1. Change the current working directory to "backend"

```
cd backend
```

2. Create a virtual environment

```
python -m venv .venv
```

3. Activate .venv

```
.venv\Scripts\activate
```

4. Install required libraries and install playwright.

```python
pip install -r requirements.txt
playwright install
```

5. Download and run Qdrant
For Windows, run these commands from WSL.
First, download the latest Qdrant image from Dockerhub:
```
docker pull qdrant/qdrant
```
Then, run the service:
```
docker run -p 6333:6333 -p 6334:6334 \
-v $(pwd)/qdrant_storage:/qdrant/storage:z \
qdrant/qdrant
```
Qdrant is now accessible at `localhost:6333`

6. Add API Keys to `.env`

7. Check path locations.

For Windows - paths are defined by `\\`
For Mac OS - paths are defined by `/`

8. Start API

```python
uvicorn app:app
```
Do not use `--reload` tag, since the API contains `async` functions. API will break.

### Project Details

- **Frontend**:
- **Setup**: React.js
- **Dependencies**: npm
- **Backend**:
- **Language Used**: Python 3.9.13
- **API Framework**: FastAPI

### API Endpoints

##### /create/req=

**\** - Enter patient json here
**Functionality** - Creating a new patient bucket

##### /query/req=

**\** - JSON must contain `id` and `prompt`
**Functionality** - Queries the RAG pipeline

##### /status

**Functionality** - Returns 200 OK if API is up