C.A.R.E. (Clinical Assistant for Research and Evidence) is a prototype Clinical Decision Support System (CDSS) that combines Retrieval-Augmented Generation (RAG) with real-time medical research integration.
It analyzes patient data, fetches relevant studies from the Semantic Scholar API, and generates two intelligent outputs:
- π©Ή A Preliminary Treatment Plan for clinicians.
- π A Patient-Friendly Educational PDF that explains the treatment plan in simple, empathetic language.
C.A.R.E. is designed to bridge the gap between clinical data and medical research.
By leveraging RAG pipelines, it can automatically connect patient information with the latest peer-reviewed evidence to generate a structured, transparent, and human-readable treatment plan.
- π§© Real-time research retrieval using the Semantic Scholar API
- π§ Intelligent reasoning powered by LLMs (e.g., Meta Llama 3 70B)
- βοΈ Automated Pathway RAG pipeline for hybrid (BM25 + Vector) document search
- π¬ FastAPI web interface for clinicians
- π ReportLab PDF generation for patient-friendly explanations
C.A.R.E. follows a microservice-based architecture, decoupling the user interface from the backend data processing pipeline.
Tech Stack: pathway
Runs on: http://localhost:8001
- Acts as the backend reasoning engine.
- Continuously monitors the directories:
Data/processed/patient_text/Data/processed/research/
- Parses and indexes all new
.txtdocuments automatically. - Uses BM25 + Vector Embeddings for hybrid information retrieval.
- Exposes an API endpoint
/v2/answerfor structured question answering.
Tech Stack: FastAPI, Jinja2
Runs on: http://localhost:8000
- Serves as the user-facing orchestration layer.
- Fetches new research papers dynamically through the Semantic Scholar API.
- Waits for indexing (~20 seconds), then queries the RAG server.
- Displays structured treatment recommendations.
- Generates downloadable patient education PDFs.
C.A.R.E/
βββ api_server.py
βββ src/
β βββ agent/
β β βββ pipeline.py
β βββ data_processing/
β β βββ research_fetcher.py
β β βββ patient_educational_material.py
βββ Data/
β βββ processed/
β βββ patient_text/
β β βββ patient_123.txt
β βββ research/
βββ templates/
β βββ index.html
βββ requirements.txt
βββ .env
βββ README.md
Patient ID: 123 Age: 54 Condition: Acute Viral Pharyngitis Current Medications: Paracetamol Symptoms: Fever, sore throat, fatigue Notes: No chronic conditions.
yaml Copy code
- The FastAPI web UI loads a dropdown of available patient files.
- The user selects a file and clicks βGenerate Treatment Plan.β
- The research_fetcher module queries Semantic Scholar for latest papers.
- Research files are stored and automatically indexed by the Pathway RAG server.
- After indexing (~20s delay), the system queries
/v2/answerfor treatment suggestions. - A structured treatment plan appears in the UI.
- The user can download a patient-friendly PDF summarizing it.
| Condition | Suggested Treatment | Supporting Evidence |
|---|---|---|
| Acute Viral Pharyngitis | Symptomatic treatment with hydration, rest, and antiviral if severe | Semantic Scholar Paper ID: 112345 |
Title: Your Preliminary Treatment Plan Explained
Contents:
- Overview of the condition in simple language
- Suggested treatments and why they help
- Encouraging, compassionate guidance
Ensure you have:
- Python 3.10+
pipandvirtualenv- A Hugging Face API Token
- Internet connection (for Semantic Scholar API access)
- 1. Clone the Repository
- 2. Create and Activate Virtual Environment
- 3. Install Dependencies
- 4. Set Up Environment Variables
- 5. Prepare Data Directories
- 6. Start the RAG Pipeline Server
- 7. Start the FastAPI Web Server
- 8. Example Run (Full Command Recap)
git clone https://github.com/<your-username>/C.A.R.E.git
cd C.A.R.E
python -m venv venv
source venv/bin/activate # On Linux/Mac
venv\Scripts\activate # On Windows
pip install -r requirements.txt
π‘ If you donβt have a requirements.txt file, create one with the following contents:
fastapi[all]
uvicorn
requests
pathway-xpacks
litellm
python-dotenv
reportlab
Create a file named .env in the project root and add:
HF_TOKEN=your_huggingface_token_here
OPENAI_API_KEY=your_openai_api_key_here
mkdir -p Data/processed/patient_text
mkdir -p Data/processed/research
Add at least one sample file:
echo "Condition: Flu" > Data/processed/patient_text/sample.txt
In one terminal:
python src/agent/pipeline.py
Wait for logs confirming the server is running at:
http://localhost:8001
In another terminal:
python api_server.py
Access the web interface at:
http://localhost:8000
Clone repo
git clone https://github.com/<your-username>/C.A.R.E.git
cd C.A.R.E
Setup environment
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Prepare data
mkdir -p Data/processed/patient_text Data/processed/research
echo "Condition: Flu" > Data/processed/patient_text/sample.txt
Run RAG pipeline
python src/agent/pipeline.py
Run FastAPI server (in another terminal)
python api_server.py
Access your web app at: http://localhost:8000
- Ensure your Hugging Face and OpenAI API keys are valid.
- The
pipeline.pyhandles all RAG-based processing. - The FastAPI interface allows interactive data exploration.
- FastAPI β Web framework
- Uvicorn β ASGI server
- LiteLLM β Lightweight LLM interface
- Pathway X-Packs β Data processing
- ReportLab β PDF generation
- Python Dotenv β Env management
This version is fully GitHub-compatible (renders headers, links, and bash formatting properly). Would you like it enhanced with badges (Python version, build passing, license, last update)?
Related Convert the search results into a single copyable text block Extract only the actionable instructions for creating a Markdown TOC Create a ready-to-paste README.md with TOC and examples List VS Code and CLI commands to generate a TOC Show GitHub-flavored header anchor rules and examples