YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

SentinelQMS - AI-Powered Customer Complaint Management System MVP

An end-to-end MVP for a Pharmaceutical Manufacturing Quality Management System (QMS). This tool automates customer complaint intake by extracting 11 structured fields from unstructured complaint text or uploaded documents (PDF, DOCX, TXT, EML) using a LangGraph state graph powered by Groq API, and assigns an initial GMP risk severity & priority rating.


πŸ›οΈ System Architecture

                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                               β”‚           React + Redux Store           β”‚
                               β”‚           (Vite + Inter Font)           β”‚
                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                    β”‚
                                           POST /api/extract
                                           POST /api/parse-and-extract
                                                    β”‚
                                                    β–Ό
                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                               β”‚             FastAPI Backend             β”‚
                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                    β”‚
                                                    β–Ό
                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                               β”‚         LangGraph State Pipeline        β”‚
                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                    β”‚
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚                                        β”‚                                        β”‚
           β–Ό                                        β–Ό                                        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  1. extract_fields   β”‚                β”‚ 2. assess_severity   β”‚                β”‚ 3. generate_summary  β”‚
β”‚                      β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚      _priority       β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚      (Bonus)         β”‚
β”‚ Model: llama-3.1-8b-instant β”‚                β”‚ Model: llama-3.3-70b β”‚                β”‚ Model: llama-3.1-8b-instant β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

LangGraph Nodes & Model Strategy

  1. extract_fields (llama-3.1-8b-instant): Extracts 11 key QMS metadata fields: complaint_source, customer_name, product_name, product_strength_grade, batch_lot_number, manufacturing_date, expiry_date, quantity_affected, complaint_type, complaint_date, detailed_description.
  2. assess_severity_priority (llama-3.3-70b-versatile): Evaluates initial severity (Critical, Major, Minor) and priority (High, Medium, Low) based on GMP risk, patient health impact, and sterility/potency risks. Includes detailed technical rationale.
  3. generate_exec_summary [Bonus Node] (llama-3.1-8b-instant): Produces a 2-3 line executive summary and immediate QA action items (e.g. batch quarantine, sample returns).

πŸ“ Repository Structure

.
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”‚   └── config.py              # Environment & Groq configuration
β”‚   β”‚   β”œβ”€β”€ graph/
β”‚   β”‚   β”‚   β”œβ”€β”€ nodes.py               # LangGraph node definitions
β”‚   β”‚   β”‚   └── workflow.py            # LangGraph StateGraph setup
β”‚   β”‚   β”œβ”€β”€ schemas/
β”‚   β”‚   β”‚   └── complaint.py           # Pydantic schemas
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   └── groq_client.py         # Groq API client with JSON mode
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”‚   └── doc_parser.py          # PDF/DOCX/TXT/EML parser
β”‚   β”‚   └── main.py                    # FastAPI server & routes
β”‚   β”œβ”€β”€ tests/
β”‚   β”‚   └── sample_fixtures.py         # 3 realistic pharma complaint fixtures
β”‚   β”œβ”€β”€ .env.example
β”‚   └── requirements.txt
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ Header.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ LeftPanelForm.jsx      # Log Customer Complaint Form
β”‚   β”‚   β”‚   β”œβ”€β”€ RightPanelAssistant.jsx # AI Intake & Chat Assistant
β”‚   β”‚   β”‚   └── ProgressBar.jsx        # LangGraph stage indicator
β”‚   β”‚   β”œβ”€β”€ store/
β”‚   β”‚   β”‚   β”œβ”€β”€ complaintSlice.js      # Redux Toolkit state
β”‚   β”‚   β”‚   └── store.js
β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   β”œβ”€β”€ main.jsx
β”‚   β”‚   └── index.css                  # Modern dark theme styles
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
└── README.md

πŸš€ Quickstart Guide

Prerequisites


1. Running Backend (FastAPI)

  1. Open terminal and navigate to /backend:

    cd backend
    
  2. Create a virtual environment & activate it:

    python -m venv venv
    # On Windows (PowerShell):
    .\venv\Scripts\Activate.ps1
    # On Mac/Linux:
    source venv/bin/activate
    
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Configure your .env file:

    cp .env.example .env
    

    Open .env and set your Groq API Key:

    GROQ_API_KEY=gsk_your_actual_groq_api_key_here
    GROQ_MODEL_FAST=llama-3.1-8b-instant
    GROQ_MODEL_REASONING=llama-3.3-70b-versatile
    PORT=8000
    
  5. Launch FastAPI development server:

    python -m app.main
    

    The backend runs on http://localhost:8000. You can test API endpoints interactively at http://localhost:8000/docs.


2. Running Frontend (React + Vite)

  1. Open a second terminal window and navigate to /frontend:

    cd frontend
    
  2. Install dependencies:

    npm install
    
  3. Start Vite dev server:

    npm run dev
    
  4. Open http://localhost:5173 in your browser.


πŸ§ͺ Testing the MVP

  1. Preset Test Fixtures: On the top right panel, click one of the preset buttons:
    • Sterility / Particulate Contamination (Critical)
    • Sub-potency / Efficacy Failure (Major)
    • Packaging / Labeling Defect (Minor)
  2. Text / Document Upload:
    • Paste raw text into the text area OR drop a PDF / DOCX file into the upload zone.
    • Click "Extract & Assess AI".
  3. Inspect Extraction:
    • Watch the Extraction Progress Bar move through LangGraph stages (Node 1 $\rightarrow$ Node 2 $\rightarrow$ Node 3).
    • Observe auto-populated form fields on the Left Panel.
    • Review Executive Summary & Recommended Steps on the Right Panel.
  4. Follow-Up Interactive Chat:
    • Use the chat box at the bottom right to ask questions like:
      • "What risk does this issue pose to patient health?"
      • "What root cause analysis steps should we take?"

πŸ›‘οΈ Robustness & Error Handling

  • JSON Mode & Pydantic Validation: Every LLM node enforces structured JSON responses via Pydantic model validation.
  • Graceful Fallbacks: API key errors, network issues, or malformed LLM outputs are caught and handled gracefully in the state graph without crashing the UI.
  • Database Abstraction: Built with an in-memory dictionary layer that can be swapped for PostgreSQL by updating a single repository module.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support