Skip to content

Repository files navigation

NG12 Cancer Risk Assessor

A Clinical Decision Support Agent built with Google Vertex AI (Gemini 1.5) to assist in recognizing and referring suspected cancer based on NICE NG12 guidelines.

Features

  • Risk Assessment: Analyze patient data (age, symptoms, medical history) against NICE NG12 criteria.
  • RAG (Retrieval-Augmented Generation): Answers are strictly grounded in official NICE guidelines with page-level citations.
  • Conversational AI: Multi-turn chat interface for exploring cancer referral criteria.
  • Patient Integration: Mock integration with a simulated JSON patient dataset.

Tech Stack

  • Framework: FastAPI
  • LLM: Google Vertex AI (Gemini 1.5 Flash)
  • Vector DB: ChromaDB
  • Libraries: LangChain, Pydantic, PyPDF

Setup & Installation

Prerequisites

  • Python 3.9+
  • Node.js & npm
  • Google Cloud Project with Vertex AI API enabled
  • Application Default Credentials (ADC) for Google Cloud
  • (Optional) Docker & Docker Compose

Initial Setup

  1. Clone the repository and navigate to the project directory.
  2. Create a .env file based on the template:
    GCP_PROJECT_ID=your-project-id
    GCP_LOCATION=us-central1
  3. Initialize the backend environment and ingestion:
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    python ingest_guidelines.py

Running the Application

Option 1: Local Development (Recommended)

1. Backend (FastAPI)

Run this from the root directory:

source venv/bin/activate
python main.py

The backend will be available at http://localhost:8000.

2. Frontend (React + Vite)

Run this from the /frontend directory:

cd frontend
npm install
npm run dev

The frontend will be available at http://localhost:5173.

Option 2: Running with Docker

If you prefer a containerized environment:

docker-compose up --build

Frontend Features

  • Patient Assessment: Enter a Patient ID to get an AI-powered cancer risk assessment grounded in NICE NG12 guidelines.
  • NG12 Chat: A conversational agent to ask questions about the guidelines with multi-turn support and citations.
  • Modern UI: Built with React, Tailwind CSS, and Framer Motion for a premium, responsive experience.

API Endpoints

Assessment

POST /assess

  • Body: {"patient_id": "PT-101"}
  • Response: Risk assessment with reasoning and citations.

Chat

POST /chat

  • Body: {"message": "What symptoms trigger lung cancer referral?", "history": []}
  • Response: Grounded explanation with citations.

Implementation Details

  • Reasoning Loop: The agent first retrieves patient data, then queries the vector store for relevant criteria, and finally synthesizes the assessment.
  • Guardrails: Strict system prompts prevent the agent from providing medical advice outside the scope of the NICE guidelines.
  • Citations: All responses include references like [NICE NG12, Page X] for transparency.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages