Make/Model Data Loading
This commit is contained in:
@@ -212,8 +212,6 @@ Single-feature migration is not implemented yet.
|
||||
|
||||
**Password Management**: All database passwords are managed via Docker secrets, mounted from host files:
|
||||
- Application DB: `./secrets/app/postgres-password.txt`
|
||||
- Platform DB: `./secrets/platform/platform-db-password.txt`
|
||||
- Vehicles DB: `./secrets/platform/vehicles-db-password.txt`
|
||||
|
||||
### Connection Pool
|
||||
- **Implementation**: pg (node-postgres)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Overview
|
||||
|
||||
The MVP Platform module is fully integrated inside the MotoVaultPro backend container. It delivers all platform capabilities without requiring a separate service or container in the simplified five-container stack.
|
||||
The MVP Platform module is fully integrated inside the MotoVaultPro backend container.
|
||||
|
||||
## Architecture
|
||||
|
||||
@@ -31,37 +31,6 @@ The platform provides vehicle data capabilities including:
|
||||
- **Database**: Shared mvp-postgres database
|
||||
- **Cache**: Shared mvp-redis cache
|
||||
|
||||
## Development Workflow
|
||||
|
||||
### Local Development
|
||||
|
||||
**Start All Services**:
|
||||
```bash
|
||||
make start # Starts the five-container stack
|
||||
```
|
||||
|
||||
**Backend Logs (includes platform module)**:
|
||||
```bash
|
||||
make logs-backend
|
||||
```
|
||||
|
||||
**Backend Shell (platform code lives here)**:
|
||||
```bash
|
||||
make shell-backend
|
||||
```
|
||||
|
||||
### Database Management
|
||||
|
||||
**Shared Database**:
|
||||
- **PostgreSQL** (port 5432): mvp-postgres
|
||||
- **Redis** (port 6379): mvp-redis
|
||||
|
||||
**Database Access**:
|
||||
```bash
|
||||
# PostgreSQL
|
||||
make db-shell-app
|
||||
```
|
||||
|
||||
## Deployment Strategy
|
||||
|
||||
### Integrated Deployment
|
||||
|
||||
27
docs/changes/platform-vehicle-data-loader.md
Normal file
27
docs/changes/platform-vehicle-data-loader.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# 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.
|
||||
Reference in New Issue
Block a user