Inspiration
As a veterinarian in Thailand, I deal with paper blood test reports from multiple labs every day. Each report comes in a different format — some in Thai, some in English, some mixed. There's no easy way to track a patient's blood values over time or spot trends across visits. I often find myself manually comparing printed reports side by side, trying to figure out if a cat's kidney values are getting better or worse. I wanted a tool that could read these reports automatically and help me make better clinical decisions by visualizing how a patient's health changes over time.
What it does
VetBlood AI digitizes animal blood test results using Google Gemini 2.0 Flash vision capabilities. Veterinarians can:
- Upload a blood test image and have Gemini automatically extract all parameter values (RBC, WBC, ALT, Creatinine, etc.) from Thai and English lab reports
- Track patients (dogs, cats) with full medical profiles including breed, owner info, and hospital number
- Auto-flag abnormal values as HIGH or LOW using species-specific reference ranges — dogs and cats have separate normal ranges for every parameter
- View trend charts showing how each blood parameter changes over time, with green reference range bands so abnormalities stand out immediately
- Compare 2–5 test dates side by side with color-coded values and delta arrows showing whether values are improving toward normal or worsening away from it
The app also offers free Tesseract.js OCR as a fallback, plus full manual entry — so it works even without an API key.
How we built it
- Next.js 16 with App Router and Server Actions for a full-stack TypeScript application
- Google Gemini 2.0 Flash via @google/generative-ai for vision-based OCR — we send the blood test image directly to Gemini with a structured prompt that extracts parameter codes and numeric values as JSON
- Tesseract.js 7 combined with sharp for free local OCR with image preprocessing (grayscale conversion, contrast enhancement, upscaling to improve recognition accuracy)
- Prisma 7 + SQLite for a zero-config database. Test results are stored in an Entity-Attribute-Value pattern — each result is a row linked to a parameter catalog, so adding new test types requires zero schema changes
- Recharts 3 for interactive trend line charts with shaded reference range bands
- Tailwind CSS 4 + shadcn/ui for a clean, responsive UI
- Pre-seeded with 23 blood test parameters (15 hematology, 7 chemistry, 1 parasitology) with both dog and cat reference ranges and Thai translations
Challenges we ran into
- Thai + English mixed reports: Lab reports in Thailand mix Thai labels with English parameter codes and numbers on the same page. Gemini handles this excellently with its multilingual vision capabilities, accurately extracting numeric values regardless of the surrounding language.
- Species-specific reference ranges: Dogs and cats have very different normal ranges for the same parameters — a normal creatinine for a dog would be flagged as high for a cat. We built a dual-range system that automatically selects the correct reference range based on the patient's species.
- OCR accuracy vs usability: Even with Gemini's excellent vision, no OCR is 100% perfect. We designed a mandatory user review step where vets can verify and correct every extracted value before saving, ensuring data integrity in a medical context.
- Prisma v7 migration: Prisma 7 introduced breaking changes including ESM-only clients and mandatory driver adapters. We had to work through these to get SQLite working correctly with the new architecture.
Accomplishments that we're proud of
- The Gemini Vision integration extracts structured data from messy, real-world lab report images with high accuracy — handling mixed Thai/English text, varying lab formats, and different print qualities
- The trend visualization with reference range bands gives vets an instant visual understanding of a patient's health trajectory — green bands make it immediately obvious when values drift outside normal
- The compare view with delta arrows (green = improving toward normal, red = worsening) makes it easy to assess treatment effectiveness at a glance across multiple visits
- The entire app runs locally with SQLite — no cloud database, no ongoing costs, easy to deploy in any clinic. Just npm install and go.
- 23 pre-seeded parameters with species-specific ranges mean the app is ready to use out of the box for common blood panels
What we learned
- Gemini 2.0 Flash's vision capabilities are remarkably effective at extracting structured data from images, especially with multilingual content. The ability to return clean JSON from a messy lab report image is impressive.
- The EAV (Entity-Attribute-Value) pattern for storing test results was the right architectural choice — adding new test parameters is just a database insert, no migration needed
- Image preprocessing (grayscale, contrast normalization, upscaling) significantly improves OCR accuracy for both Gemini and Tesseract, especially for low-quality phone photos of printed reports
- Building a dual OCR pipeline (premium AI + free local) ensures the app is useful for clinics of all sizes and budgets
What's next for VetBlood AI - Animal Blood Test Analyzer
- PDF multi-page support for full lab reports that span multiple pages
- Lab template system for auto-detecting and parsing different lab formats with customizable regex patterns
- Export reports as PDF for clinic records and sharing with pet owners
- Mobile-optimized camera capture for quick photo uploads directly from a phone
- Gemini-powered insights — use Gemini to generate plain-language summaries of blood test results and flag clinically significant patterns across visits
- Multi-clinic support with shared patient records for referral cases
Built With
- google-gemini-2.0-flash
- lucide-icons
- next.js-16
- node.js
- prisma-7
- radix-ui
- react-19
- recharts-3
- shadcn/ui
- sharp
- sqlite
- tailwind-css-4
- tesseract.js-7
- typescript
Log in or sign up for Devpost to join the conversation.