Skip to content

Latest commit

Β 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’Š PharmaPilot AI

C# .NET 8 ASP.NET Core REST API xUnit

An AI copilot for pharmaceutical visual inspection (Sichtkontrolle) β€” guiding batch workflows, reconciling quantities, and explaining discrepancies in plain language.

Status License Domain


Overview

Visual inspection is one of the most demanding steps in sterile pharmaceutical production. Operators work under time pressure, every unit must be accounted for, and a single unbooked AQL sample can turn into a deviation and hours of investigation.

PharmaPilot AI is a prototype of a digital assistant for exactly this environment. It walks through a batch from receipt to release checklist, keeps a live quantity reconciliation (Menge) running in the background, and when the numbers don't balance, a built-in copilot explains why β€” before it becomes a deviation.

This copilot is intentionally rules-based and deterministic: it maps each reconciliation delta or operator-selected symptom to a plain-language diagnosis, explanation and next action, and returns a confidence score with every answer. That deterministic core is fully unit-tested and is designed as the foundation a real LLM layer can later build on β€” a reliable base first, intelligence on top second.

Designed by a software engineer who went into GMP production deliberately β€” to study these workflows where they actually happen, and to build software that solves real problems, not imagined ones. Every scenario in this demo β€” the forgotten AQL scan, the eject booked to the wrong category, the count that doesn't balance at shift end β€” comes from direct process observation on the production floor.

πŸ–ΌοΈ Screenshots

Dashboard Overview

Dashboard Overview

Batch Details & Process Steps

Batch Details

AI Copilot Chat

AI Copilot Chat

Deviation Investigation

Deviation Investigation

▢️ Live Demo

✨ Key Features

Guided batch workflow

A step-by-step checklist covering the full inspection lifecycle β€” batch takeover from filling, material verification, machine setup, automated inspection run, Muster & AQL sampling, manual re-inspection, 100% manual control, label & barcode verification, quantity reconciliation, and batch record review β€” with live status tracking.

Live quantity reconciliation (Menge)

The core formula of every inspection batch, always visible and always up to date:

received = good + ejects + samples + breakage

The panel tracks input units, good/labelled units, eject categories (physical defects β†’ Re-Sicht, particle/liquid β†’ Re-Sicht, uncertain β†’ rails), AQL and Muster samples β€” and flags unbooked removals the moment a delta appears.

AI copilot with realistic production scenarios

A conversational assistant that understands the context of the running batch. Example from the demo:

"The system prompted an AQL sample of 125 units from the good stream, and the quantity balance shows Ξ” βˆ’125 unaccounted. That usually means the units were taken but the AQL tab wasn't scanned. Sound familiar?"

Built-in quick diagnoses for the most common real-world discrepancies:

  • I forgot to scan the AQL tab
  • Ejects booked to the wrong category
  • I forgot to switch the eject mode
  • Wrong material at the machine
  • The final count doesn't balance

Batch record review

A release checklist that mirrors how batch records are reviewed before release β€” designed with GMP documentation principles (ALCOA+) in mind.

πŸ› οΈ Tech Stack

  • Backend: C#, ASP.NET Core 8, Minimal API
  • Testing: xUnit
  • Frontend: HTML, CSS, vanilla JavaScript β€” zero dependencies, runs anywhere
  • API style: REST/JSON
  • Architecture: Layered into a Core domain library + API host, with Docker support
  • Design: Industrial MES-inspired UI, optimized for shop-floor readability
  • Data: Mock batch data for demonstration purposes

πŸš€ Getting Started

git clone https://github.com/mahbejam/pharmaPilot-AI.git
cd pharmaPilot-AI
# open index.html in your browser β€” no build step, no install

πŸ”Œ Backend API (ASP.NET Core)

The reconciliation and copilot logic now also runs server-side, so it no longer lives only in the browser. It is split into a framework-independent domain library (PharmaPilot.Core) and a thin Minimal-API host (PharmaPilot.Api), with unit tests in PharmaPilot.Core.Tests.

Method Endpoint Purpose
GET /health Liveness check
GET /api/batches List all (mock) batches
GET /api/batches/{id} Get a single batch
POST /api/reconciliation Compute received = good + ejects + samples + breakage and flag deltas
POST /api/copilot Rules-based diagnosis from a batch delta or a selected symptom

Run it

cd backend
dotnet run --project src/PharmaPilot.Api    # http://localhost:5080
dotnet test                                 # run the unit tests

Or with Docker:

docker build -t pharmapilot-api backend
docker run -p 8080:8080 pharmapilot-api

Example β€” a batch missing an AQL scan:

curl -X POST http://localhost:5080/api/reconciliation \
  -H "Content-Type: application/json" \
  -d '{"received":15000,"good":14680,"ejects":190,"samples":5,"breakage":0}'
# β†’ delta -125, "Unbooked removal: 125 unit(s) left the line without being booked …"

πŸ“Œ Project Status & Roadmap

This is an MVP demonstrating the core concept. Planned next steps:

  • βœ… Rules engine for automatic state detection β€” implemented in the backend copilot
  • βœ… Small backend serving batch data & reconciliation β€” ASP.NET Core API
  • Connect the copilot to a real LLM (the rules engine is now the deterministic core it can build on)
  • Expanded exception library
  • Persistent batch history (wire the frontend to the backend store)
  • Shift handover summary generated by the AI copilot
  • Deviation pre-report drafting from reconciliation deltas
  • German / English interface toggle

⚠️ Disclaimer

PharmaPilot AI is a prototype using mock data only (frontend + backend). It is not affiliated with any real manufacturing system, product, or company. All batch numbers, materials, quantities, and process steps are invented. Built for demonstration and portfolio purposes.

πŸ‘©β€πŸ’» Author

Mahbube Bejam Software Developer (B.Sc. Software Engineering) β€” building AI-assisted tools for pharma and healthcare digitalization.

This project is based on deep first-hand insight into GMP production processes β€” I went into the industry to study these workflows where they actually happen, in order to design software that solves real problems, not imagined ones.

⭐ If you find this project useful, consider giving it a star.

πŸ“„ License

MIT β€” free to use, modify, and build on.

About

Full-stack pharmaceutical batch copilot built with ASP.NET Core 8, C#, REST API and vanilla JavaScript.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages