Repository navigation
Local vPIC decoder with reviewed rule fixes - #28
Merged
Merged
Conversation
Decode VINs with mcp.vin's own copy of NHTSA's vPIC decode (release 2026_11) instead of the live API, and fix NHTSA's rule rows where they are wrong. - scripts/import-vpic.py: read the monthly vPIC PostgreSQL dump without a database server and write data/vpic.db (96.5 MB); stop when NHTSA's decode functions change. - lib/vpic-local.mjs: a faithful interpreter of spvindecode. On NHTSA's pristine rules it agrees with spvindecode on every element of 25,073 of 25,073 VINs. - lib/nhtsa.mjs: decode locally first; fall back to the live API when the WMI or model is unknown, the model year is newer than the release, or the dataset is missing. decode_source names the source, release and fallback reason. - data-src/vpic-rule-fixes.jsonl: 26 reviewed rule fixes (34 row edits) for the 33 confirmed decode errors outside seats and GVWR. The build applies an entry only when NHTSA's rows are unchanged; otherwise it reports it for review. Fixed values are marked corrected (basis mcp_vin_rule_fix) with NHTSA's official value, the reason and the evidence. docs/vpic-rule-fixes.md is the readable diff. - Accent fix: a test-vehicle fill no longer asserts the transmission or speeds when EPA lists both manual and automatic for the model and year. - scripts/vpic-refresh.sh: monthly refresh on the storage server (build, fix check, parity with spvindecode, diff, xz). It has no cron job and does not deploy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Decodes VINs with mcp.vin's own copy of NHTSA's vPIC decode (release 2026_11) instead of NHTSA's live API, and fixes NHTSA's rule rows where they are wrong. Do not merge or deploy without the owner's go. The dataset is not in git: deploy steps are below.
Interpreter (
lib/vpic-local.mjs): reproducesspvindecode,spvindecode_coreandspvindecode_errorcode. It returns the live API's 154-key shape and runs in about 4.4 ms per VIN on the phone.Dataset (
scripts/import-vpic.py): buildsdata/vpic.dbfrom NHTSA's monthly dump (96.5 MB, 17.6 MB as xz). The build stops if NHTSA changes its decode functions.Local first, live fallback (
lib/nhtsa.mjs): the live API is used when:decode_sourcenames the source, the release and the fallback reason. Batch decodes send only the VINs that need the live API.Rule fixes (
data-src/vpic-rule-fixes.jsonl): 26 reviewed fixes with 34 row edits, covering the 33 confirmed errors outside seats and GVWR.corrected(basismcp_vin_rule_fix), with NHTSA's official value, the reason and the evidence.raw_nhtsastays official.docs/vpic-rule-fixes.mdis the readable diff and can serve as the error report for NHTSA.Accent fix: a test-vehicle fill does not assert a transmission or speeds when EPA lists both manual and automatic. An owner-stated transmission still fills.
Monthly refresh (
scripts/vpic-refresh.sh): runs on the storage server. It has no cron job and does not deploy.Parity
spvindecode, NHTSA's rulesThe other 624 live-API differences are data or presentation, not the algorithm:
Fix checks:
Tests
npm test: 248 / 248 node tests pass, and all Python tests pass. The tests use a 275 KB fixture cut from the release, with NHTSA test vehicles and synthetic VINs only.Deploy (owner's go only)
vpic.db.xzfrom the storage server (/root/vpic-local/dryrun/2026_11/) to the web server.175c6f0b…b21ad45e616aa…837fcxz -don it next to the app, thenmvit todata/vpic.db.1V2BR2CA3JC513174: drive is FWD, corrected.JTNABAAE3PA004901: transmission is manual, corrected.model_year_newer_than_release.data/vpic.db. Decoding then falls back to the live API.🤖 Generated with Claude Code