feat: Replace NHTSA VIN decode with Google Gemini via OCR service (#223) #229
Reference in New Issue
Block a user
Delete Branch "issue-223-replace-nhtsa-vin-decode-gemini"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary\n\nReplaces the NHTSA vPIC API integration for VIN string decoding with Google Gemini, routed through the Python OCR microservice (mvp-ocr).\n\n### Changes\n- M1 (#224): New
POST /decode/vinendpoint on OCR service usingGeminiEngine.decode_vin()\n- M2 (#225):VinDecodeResponsetype andOcrClient.decodeVin()method (JSON POST)\n- M3 (#226): RewiredVehiclesControllerto useOcrClientinstead ofNHTSAClient, moved cache logic toVehiclesServicewith format-aware reads, renamednhtsaValuetosourceValue\n- M4 (#227): Deletedvehicles/external/nhtsa/(3 files), removedVPICVariable/VPICResponse, updated 16 doc files\n- M5 (#228): RenamednhtsaValuetosourceValuein frontend types/components, updated guide pages\n\n### Key Design Decisions\n- No TRUNCATE migration: Format-aware cache reads (check forsuccessfield) let old NHTSA entries expire naturally via 1-year TTL\n- Separate decode router:POST /decode/vinon its own router (not on/extract) since VIN decode accepts JSON, not multipart\n- Error codes: OCR service returns 400/422/503; backend maps 503/422 to 502\n\nFixes #223\nFixes #224\nFixes #225\nFixes #226\nFixes #227\nFixes #228\n\n## Test Plan\n- [x] Backend TypeScript compiles clean (0 errors)\n- [x] Frontend TypeScript compiles clean (0 errors)\n- [x] Backend lint: 0 errors (544 pre-existing warnings)\n- [x] Frontend lint: 0 errors (227 pre-existing warnings)\n- [x] OCR Python tests: 31 pass (13 new VIN decode + 18 existing)\n- [x] Zero NHTSA references in codebase (verified via grep)\n- [ ] Container integration test: VIN decode end-to-end\n- [ ] Existing OCR image-based VIN extraction unaffected