Skip to content

BKenaan/Pharma-Bot

Repository files navigation

Pharmabot

Pharmabot is an advanced AI-driven pharmacy assistant designed to provide medical triage, drug recommendations, and safety evaluations. It leverages Natural Language Processing (NLP) and multiple medical databases to ensure accurate and safe guidance for users.

Features

  • Intelligent Triage: Analyzes user symptoms to determine the urgency of care.
  • Personalized Recommendations: Suggests over-the-counter (OTC) medications based on user profiles and clinical data.
  • Multi-Layered Safety: Validates recommendations against BNF, DrugBank, OpenFDA, and MHRA databases.
  • Secure Authentication: Robust user management and profile security.
  • Dynamic Frontend: Modern, responsive interface built with Next.js.
  • Advanced Clinical Reasoning:
    • Explainable Safety Trace: Auditable reasoning for all clinical decisions.
    • Mathematical Confidence Scoring: Real-time certainty metrics for NLP extraction.
    • Adaptive Follow-Up Engine: Prioritized questioning based on clinical risk (including eye red-flag and dizziness pathways).
    • Symptom Timeline Tracking: Accurate persistence detection across sessions.
    • Condition-Aware NSAID Safety: Dynamic safety messages when NSAIDs are hidden (e.g. asthma vs anticoagulants); diarrhoea/vomiting triggers kidney-risk exclusion and contextual advice.

Prerequisites

  • Python: 3.9 or higher
  • Node.js: 18.x or higher
  • NPM: 9.x or higher

Installation

1. Backend Setup

  1. Navigate to the backend directory:
    cd backend
  2. Create and activate a virtual environment:
    python -m venv .venv
    .venv\Scripts\activate  # On Windows
    source .venv/bin/activate  # On Unix/macOS
  3. Install dependencies:
    pip install -r requirements.txt
  4. Set up environment variables in a .env file (refer to .env.example if available).
  5. Database: The repository does not include .db files. On first run the app will create the SQLite database and seed it (products and safety rules). To initialize the database without starting the server, from the backend directory run:
    python scripts/init_db.py
    Or start the backend once—it runs the same create-if-not-exists and seeding on startup.

2. Frontend Setup

  1. Navigate to the storefront directory:
    cd storefront
  2. Install dependencies:
    npm install

Running the Application

You can run both the backend and frontend simultaneously from the root directory:

npm run dev

Alternatively, run them separately:

  • Backend: npm run backend
  • Frontend: npm run frontend

The backend will be available at http://localhost:8000 and the frontend at http://localhost:3000.

Documentation

  • Project Report: Detailed technical overview and implementation details.
  • Layered Architecture: Deep dive into the system's design patterns.
  • Payments Guide: Information regarding payment integrations. (to test payement getaway card number "5555555555554444", "any 3 digit cvc", "any future date")

About

A full-stack medical AI assistant built with FastAPI and Next.js. Leveraging Spacy NLP for clinical entity extraction, it features a prioritized adaptive follow-up engine, a mathematical confidence scoring system for diagnostic certainty, and an auditable Safety Trace for explainable AI in healthcare. Full Version Will be deployed after Uni review.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors