feat: Add VIN decode endpoint to OCR Python service (#223) #224

Closed
opened 2026-02-19 03:19:25 +00:00 by egullickson · 0 comments
Owner

Relates to #223

Scope

Add a POST /decode/vin endpoint to the Python OCR service that uses Gemini to decode a VIN string into structured vehicle data.

Changes

  • Add decode_vin(vin: str) method to GeminiEngine with VIN-specific prompt and response schema
  • Add VinDecodeResponse Pydantic model in app/models/
  • Add POST /decode/vin route in app/routers/extract.py
  • VIN format validation (17 chars, excludes I/O/Q)

Response Schema

{
  "success": true,
  "vin": "1HGBH41JXMN109186",
  "year": 2020,
  "make": "Toyota",
  "model": "Camry",
  "trimLevel": "SE",
  "bodyType": "Sedan",
  "driveType": "FWD",
  "fuelType": "Gasoline",
  "engine": "2.5L 4-Cylinder",
  "transmission": "8-Speed Automatic",
  "confidence": 0.95,
  "processingTimeMs": 1200
}

Acceptance Criteria

  • Endpoint accepts VIN string, returns structured vehicle data via Gemini
  • VIN format validation before calling Gemini
  • Reuses GeminiEngine lazy init (no credential duplication)
  • Error handling for invalid VIN, Gemini failures
Relates to #223 ## Scope Add a `POST /decode/vin` endpoint to the Python OCR service that uses Gemini to decode a VIN string into structured vehicle data. ### Changes - Add `decode_vin(vin: str)` method to `GeminiEngine` with VIN-specific prompt and response schema - Add `VinDecodeResponse` Pydantic model in `app/models/` - Add `POST /decode/vin` route in `app/routers/extract.py` - VIN format validation (17 chars, excludes I/O/Q) ### Response Schema ```json { "success": true, "vin": "1HGBH41JXMN109186", "year": 2020, "make": "Toyota", "model": "Camry", "trimLevel": "SE", "bodyType": "Sedan", "driveType": "FWD", "fuelType": "Gasoline", "engine": "2.5L 4-Cylinder", "transmission": "8-Speed Automatic", "confidence": 0.95, "processingTimeMs": 1200 } ``` ### Acceptance Criteria - [ ] Endpoint accepts VIN string, returns structured vehicle data via Gemini - [ ] VIN format validation before calling Gemini - [ ] Reuses GeminiEngine lazy init (no credential duplication) - [ ] Error handling for invalid VIN, Gemini failures
egullickson added the
status
backlog
type
feature
labels 2026-02-19 03:20:02 +00:00
egullickson added
status
done
and removed
status
backlog
labels 2026-02-20 15:04:15 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#224