ARCHITECTURE CASE STUDY

NordPet

Building an autonomous clinical intelligence system using LangChain, LanceDB, and Django.

Django
LanceDB
LangChain
OpenAI
Docling
PostgreSQL
Docker
Django
LanceDB
LangChain
OpenAI
Docling
PostgreSQL
Docker

The Challenge

The industry requires more than just a CRM. Modern veterinary practice is severely bottlenecked by passive data and high-pressure environments.

AI EXTRACTION
Creatinine 1.2 mg/dL
BUN 45 mg/dL (High)
ALT 40 U/L

Unstructured Diagnostic Reports

External laboratories often provide results as unstructured PDFs. Manually sifting through these reports leads to severe cognitive overload, causing professionals to miss critical parameters.

FDA Alert

Meloxicam is contraindicated due to recent Stage 2 Kidney Disease history.

Cancel Prescription

Pharmacological Contraindications

Cross-referencing drug contraindications with a patient's renal state relies heavily on human memory, increasing risk.

Transcribing...
[S] Lethargic, not eating since yesterday.
[O] T: 39.5°C, HR: 140 bpm.

Manual SOAP & Triage

In high-pressure environments, valuable time is lost to manual SOAP data entry and non-standardized triage.

The Solution

NordPet transforms passive medical records into an active medical co-pilot. Instead of merely storing data, it uses background workers and autonomous AI agents to actively process, transcribe, and structure clinical information in real-time.

Passive Inputs
Unstructured PDFs (Labs)
Raw Consultation Audio
Patient Vital Signs
AUTONOMOUS
Multi-Agent Engine

Django-Q2 Background Workers

LangChain
Agents
OCR &
Extraction
Whisper API Transcriptions
Active Intelligence
LanceDB Vector Memory
Structured SOAP Notes
Pharmacological Alerts

Multi-Agent AI Architecture

Powered by LangChain and OpenAI, NordPet delegates complex clinical workflows to specialized, autonomous agents.

root@nordpet-cluster:~
$ docker logs -f triage_agent_worker
[TriageAgent] ACTIVE

Analyzes incoming patient vital signs (heart rate, temperature, weight) and symptoms to automatically assign a standardized clinical risk level (Green, Yellow, Orange, Red) before the vet even enters the room.

$ docker logs -f summary_agent_worker
[SummaryAgent] ACTIVE

Integrates with OpenAI Whisper API to process raw, unstructured audio and video recordings of veterinary consultations, distilling them into concise, structured SOAP notes for the patient's permanent record.

$ docker logs -f exam_analysis_worker
[ExamAnalysisAgent] ACTIVE

Parses OCR text from PDF laboratory results (using Docling and RapidOCR) to automatically extract abnormal parameters, issue critical life-threatening warnings, and suggest early diagnostic hypotheses.

$ docker logs -f assistant_rag_worker
[AssistantAgent & FDA Tool Use] ACTIVE

A conversational RAG assistant that queries historical clinic knowledge. Armed with "Tool Use", it autonomously queries the official FDA database in real-time to check for medication adverse events, actively blocking dangerous prescriptions.

$

Engineering Decisions & Stack

Building an AI medical platform requires strict guarantees on data validation, security, and asynchronous processing. Every layer of NordPet was engineered with these constraints in mind.

Layer 5: Presentation & Validation

Tailwind CSS & Pydantic UI & SECURITY

A modern, responsive interface built with Tailwind. Behind the scenes, Pydantic acts as a strict shield, ensuring all Generative AI outputs are strongly typed and validated before reaching the database, eliminating LLM hallucinations.

Layer 4: Cognitive Engines

OpenAI, Whisper & Docling AI MODELS

The brains of the operation. GPT-4 handles complex medical reasoning, Whisper translates raw consultation audio into text, and Docling (along with RapidOCR) extracts critical parameters from unstructured laboratory PDFs.

Layer 3: Orchestration & Memory

LangChain & LanceDB EMBEDDED RAG

LangChain orchestrates the specialized agents (Triage, Summary, Analysis). LanceDB is embedded directly into the application, drastically reducing network latency for vector searches across the clinic's historical data.

Layer 2: Backend Application

Django & Q2 ASYNC QUEUE

Medical records demand a battle-tested ORM and native security. Because AI orchestration is heavily I/O bound, Django-Q2 offloads all cognitive processing to background workers to keep the interface highly responsive.

Layer 1: Infrastructure

Docker & PostgreSQL DEVOPS

The foundation. PostgreSQL handles robust relational data storage. The deployment architecture utilizes Docker Compose with multi-stage builds, outputting a lightweight Python Gunicorn image for production environments.

Showcase vs. Enterprise

The GitHub repository is a curated demonstration focusing exclusively on the AI architecture. The production system is a vastly different beast.

OPEN SOURCE DEMO

nordpet-public

A technical demonstration of the core AI orchestration.

Primary Focus

Integration of async tasks, Agentic RAG, and FDA Tool Use for portfolio review.

Architecture

Single-tenant setup. Easily spun up locally via Docker Compose.

Integrations

Software-only integrations (OpenAI, FDA APIs). No physical hardware.

PRODUCTION ENGINE

Enterprise SaaS

A battle-tested clinical management system built for the rigorous demands of real-world healthcare.

Primary Focus
High-Availability & Scale

Designed to support the daily clinic operations for hundreds of professionals seamlessly.

Architecture
Multi-Tenant & RBAC

Complete data isolation for multiple clinics with complex role-based access controls.

Hardware & Security
Direct HL7/DICOM

Direct parsing from physical blood analyzers, deployed on a HIPAA-compliant cloud.

"NordPet is more than a CRM; it is a vision of how artificial intelligence can be safely and ethically deployed in clinical settings to augment professionals and save lives."

See more projects Get in Touch