feat: migrate to PostgreSQL + SQLAlchemy ORM, rebrand to Nexus Autoparts

- Migrate from SQLite to PostgreSQL with normalized schema
- Add 11 lookup tables (fuel_type, body_type, drivetrain, transmission,
  materials, position_part, manufacture_type, quality_tier, countries,
  reference_type, shapes)
- Rewrite dashboard/server.py (76 routes) using SQLAlchemy text() queries
- Rewrite console/db.py (27 methods) using SQLAlchemy ORM
- Add models.py with 27 SQLAlchemy model definitions
- Add config.py for centralized DB_URL configuration
- Add migrate_to_postgres.py migration script
- Add docs/METABASE_GUIDE.md with complete data entry guide
- Rebrand from "AUTOPARTS DB" to "NEXUS AUTOPARTS"
- Fill vehicle data gaps via NHTSA API + heuristics:
  engines (cylinders, power, torque), brands (country, founded_year),
  models (body_type, production years), MYE (drivetrain, transmission, trim)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 05:24:47 +00:00
parent 7ecf1295a5
commit 7b2a904498
41 changed files with 3519 additions and 3489 deletions

20
config.py Normal file
View File

@@ -0,0 +1,20 @@
"""
Central configuration for Nexus Autoparts.
"""
import os
# Database
DB_URL = os.environ.get(
"DATABASE_URL",
"postgresql://nexus:nexus_autoparts_2026@localhost/nexus_autoparts"
)
# Legacy SQLite path (used only by migration script)
SQLITE_PATH = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"vehicle_database", "vehicle_database.db"
)
# Application identity
APP_NAME = "NEXUS AUTOPARTS"
APP_SLOGAN = "Tu conexión directa con las partes que necesitas"