28 lines
1.5 KiB
Markdown
28 lines
1.5 KiB
Markdown
# Platform Vehicle Data Loader Refresh
|
|
|
|
## Context
|
|
- Reintroduced the normalized `vehicles` schema (make/model/model_year/trim/engine + bridges) with a new migration under `backend/src/features/platform/migrations/001_create_vehicle_lookup_schema.sql`.
|
|
- Added `scripts/load_vehicle_data.py`, a stand-alone Python loader that hydrates the schema from `data/make-models/*.json`.
|
|
- Loader truncates lookup tables, seeds default transmissions (Automatic, Manual), and inserts deduplicated year → make → model → trim → engine combinations.
|
|
|
|
## Follow-up Tasks (Backend API Team)
|
|
1. **Wire dropdown API to refreshed data**
|
|
- Run `make migrate` (or `npm run migrate:all` inside backend container) to ensure the new schema exists.
|
|
- Execute the loader (see command below) so Postgres has the latest lookup entries.
|
|
- Verify `VehicleDataRepository` queries and Redis caching logic continue to function against the reinstated tables.
|
|
2. **Add Makefile wrapper**
|
|
- Create a `make load-vehicle-data` task that shells into the backend container, installs `psycopg` if needed, and invokes `python3 scripts/load_vehicle_data.py` with the correct DB credentials and data directory.
|
|
|
|
### Loader Command Reference
|
|
```
|
|
PGPASSWORD=$(cat secrets/app/postgres-password.txt) \
|
|
python3 scripts/load_vehicle_data.py \
|
|
--db-host 127.0.0.1 \
|
|
--db-port 5432 \
|
|
--db-user postgres \
|
|
--db-name motovaultpro \
|
|
--data-dir data/make-models
|
|
```
|
|
|
|
> Run the command from the repository root (outside of containers) while `mvp-postgres` is up. Adjust host/port if executing inside a container.
|