LLM Matching of Veterinary Drugs to the State Registry
A data pipeline and API that join ~3,200 online catalog pages with the state registry into one structured veterinary drug reference.
Veterinary Drug Reference joins an online catalog and the state registry into one searchable dataset, with every match carrying a confidence score and rationale.
Partner's Profile
Background
The client is a veterinary pharmaceuticals reference project in Ukraine. It needed a structured reference of veterinary drugs: products, packages, ATCvet classification, active substances, animal species and withdrawal periods. The data sat in two sources: about 3,200 product pages of an online catalog in HTML and an export of the Ukrainian state registry of veterinary medicines with 1,473 records. Names and manufacturers differ between the two, so they cannot be joined directly.
Objective
Turn both sources into one clean dataset, link catalog products to their state registry entries with a measurable confidence, and expose the result through a search and filter API by drug, active substance, animal species and ATCvet code. The import had to run from the admin panel as a background job, with its progress visible to the team.
Solution
We built a pipeline in four stages: HTML and CSV parsing, candidate selection, LLM matching and import. The import is an archive uploaded in the admin and processed by a background task with a progress bar. On top of the data sits a search and filter API by drug, substance, species and ATCvet. Of 3,217 product records, 3,210 were imported; the remaining seven were duplicates in the source data.
The engineering challenge was matching records that never share an exact name. Sending every product against all 1,473 registry records to an LLM would be expensive and error-prone, so a cheap deterministic filter runs first: normalization, exact, substring and fuzzy matching, plus a bonus when the brand matches the manufacturer. It keeps at most 20 candidates per product. Only then is GPT-4o-mini called, in batches of 100 items, with structured output: registration number, confidence and rationale. The model only sees a narrow candidate set, which saves tokens and reduces errors. This split of work between code and model is how we approach AI software development.
Real data needed real cleaning rules, added as we met them: for example, a country field like "FRANCE POLAND FRANCE" collapses into one country. The import itself is built for reliability, as in any database development project:
- a transaction per record, so one bad row never breaks the batch
- deduplication by slug
- an ATCvet classification tree built with MPTT
- a lock that allows only one import at a time
- about 290 automated tests across the pipeline and API
Technologies
Backend
Python, Django 5.2, DRF, SimpleJWT, drf-spectacular, Celery
AI / ML
OpenAI API (GPT-4o-mini, structured outputs), Pydantic
Data
PostgreSQL, MongoDB, Redis, django-mptt, S3
Projects
AI Intake Agent for a Teleradiology Patient Service
A multilingual AI agent that consults patients 24/7, collects structured requests and hands each one to a manager for confirmation.
LLM Matching of Veterinary Drugs to the State Registry
A data pipeline and API that join ~3,200 online catalog pages with the state registry into one structured veterinary drug reference.
Remote Patient Monitoring App
for remote medical diagnostics and health monitoring.
AI Translation of Radiology Reports with Doctor Review
An LLM drafts the report translation in 8 languages, the radiologist reviews it, and only then do customers and patients see it.
Referral and Payout Portal for a Teleradiology Platform
Doctors and medical reps refer patients by promo code, link or QR, and every reward is backed by money the platform actually received.
e-Prescribing App
for easy medical prescription issues and management.
Need a project estimate?
Drop us a line, and we provide you with a qualified consultation.