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:
@@ -1,6 +1,6 @@
|
||||
# AUTOPARTES Console - Sistema Pick/VT220
|
||||
# NEXUS AUTOPARTS Console - Sistema Pick/VT220
|
||||
|
||||
Interfaz de consola para el catálogo de autopartes, inspirada en los sistemas Pick/D3 con estética de terminal VT220. Funciona 100% con teclado, verde sobre negro.
|
||||
Interfaz de consola para el catálogo de nexus-autoparts, inspirada en los sistemas Pick/D3 con estética de terminal VT220. Funciona 100% con teclado, verde sobre negro.
|
||||
|
||||
## Requisitos
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
"""
|
||||
Configuration settings for the AUTOPARTES console application.
|
||||
Configuration settings for the NEXUS AUTOPARTS console application.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Application metadata
|
||||
VERSION = "1.0.0"
|
||||
APP_NAME = "AUTOPARTES"
|
||||
APP_SUBTITLE = "Sistema de Catalogo de Autopartes"
|
||||
VERSION = "2.0.0"
|
||||
APP_NAME = "NEXUS AUTOPARTS"
|
||||
APP_SUBTITLE = "Tu conexión directa con las partes que necesitas"
|
||||
|
||||
# Database path (relative to the console/ directory, resolved to absolute)
|
||||
_CONSOLE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
DB_PATH = os.path.join(_CONSOLE_DIR, "..", "vehicle_database", "vehicle_database.db")
|
||||
DB_PATH = os.path.normpath(DB_PATH)
|
||||
# Database URL (PostgreSQL)
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
||||
from config import DB_URL
|
||||
|
||||
# NHTSA VIN Decoder API
|
||||
NHTSA_API_URL = "https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVin"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Main application controller for the AUTOPARTES console application.
|
||||
Main application controller for the NEXUS AUTOPARTS console application.
|
||||
|
||||
The :class:`App` class owns the screen lifecycle loop: it renders the
|
||||
current screen, reads a keypress, dispatches it, and follows any
|
||||
|
||||
831
console/db.py
831
console/db.py
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Entry point for the AUTOPARTES Pick/VT220-style console application.
|
||||
Entry point for the NEXUS AUTOPARTS Pick/VT220-style console application.
|
||||
|
||||
Usage:
|
||||
python -m console # via package
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Abstract base renderer interface for the AUTOPARTES console application.
|
||||
Abstract base renderer interface for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Every renderer (curses VT220, Textual/Rich, etc.) must subclass
|
||||
:class:`BaseRenderer` and implement all of its methods. Screens call
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Curses-based VT220 renderer for the AUTOPARTES console application.
|
||||
Curses-based VT220 renderer for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Implements :class:`BaseRenderer` with a green-on-black aesthetic inspired
|
||||
by classic Pick/UNIX VT220 terminals. All drawing is done through Python's
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Admin CRUD screen for Cross-References in the AUTOPARTES console application.
|
||||
Admin CRUD screen for Cross-References in the NEXUS AUTOPARTS console application.
|
||||
|
||||
Provides a paginated list view with create (F3), edit (ENTER), and
|
||||
delete (F8/Del) operations for the part_cross_references table.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Admin CRUD screen for Manufacturers in the AUTOPARTES console application.
|
||||
Admin CRUD screen for Manufacturers in the NEXUS AUTOPARTS console application.
|
||||
|
||||
Provides a list view with create (F3), edit (ENTER), and delete (F8/Del)
|
||||
operations for the manufacturers table.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Import/Export screen for the AUTOPARTES console application.
|
||||
Import/Export screen for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Provides a simple menu flow to import CSV files into the database or
|
||||
export data to JSON files. Uses the renderer's show_input and
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Admin CRUD screen for Parts in the AUTOPARTES console application.
|
||||
Admin CRUD screen for Parts in the NEXUS AUTOPARTS console application.
|
||||
|
||||
Provides a paginated list view with create (F3), edit (ENTER), and
|
||||
delete (F8/Del) operations. Form editing is handled inline with
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Part number search screen for the AUTOPARTES console application.
|
||||
Part number search screen for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Prompts the user for a part number (OEM, aftermarket, or cross-reference)
|
||||
and displays matching results in a table. Selecting a result navigates
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Full-text search screen for the AUTOPARTES console application.
|
||||
Full-text search screen for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Prompts the user for a search query and displays matching parts using
|
||||
the FTS5 full-text search engine (with LIKE fallback). Results are
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Catalog navigation screen for the AUTOPARTES console application.
|
||||
Catalog navigation screen for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Provides a three-level drill-down through the parts hierarchy:
|
||||
Categories -> Groups -> Parts. An optional vehicle filter (mye_id)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Part comparator screen for the AUTOPARTES console application.
|
||||
Part comparator screen for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Displays a side-by-side comparison of an OEM part against its aftermarket
|
||||
alternatives. The first column is always the OEM part; subsequent columns
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Statistics dashboard screen for the AUTOPARTES console application.
|
||||
Statistics dashboard screen for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Displays database table counts and coverage metrics retrieved via
|
||||
:meth:`Database.get_stats`.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Main menu screen for the AUTOPARTES console application.
|
||||
Main menu screen for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Displays a numbered Pick-style menu with navigation options for all
|
||||
application sections. Number keys jump directly; arrow keys move the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Part detail screen for the AUTOPARTES console application.
|
||||
Part detail screen for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Shows full part information (OEM number, name, group, category, etc.)
|
||||
with a table of aftermarket alternatives. Number keys navigate to
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Vehicle drill-down navigation screen for the AUTOPARTES console application.
|
||||
Vehicle drill-down navigation screen for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Guides the user through a four-level hierarchy:
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
VIN decoder screen for the AUTOPARTES console application.
|
||||
VIN decoder screen for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Prompts for a 17-character Vehicle Identification Number, decodes it
|
||||
via the NHTSA vPIC API (with local caching), and displays the decoded
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Integration tests for the AUTOPARTES console application.
|
||||
Integration tests for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Uses a MockRenderer that records draw calls instead of painting to a real
|
||||
terminal, allowing end-to-end testing of the screen -> renderer pipeline
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Display formatting utilities for the AUTOPARTES console application.
|
||||
Display formatting utilities for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Functions for currency, numbers, text truncation, table layout, and
|
||||
quality-tier visual bars.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
NHTSA VIN Decoder API client for the AUTOPARTES console application.
|
||||
NHTSA VIN Decoder API client for the NEXUS AUTOPARTS console application.
|
||||
|
||||
Wraps the National Highway Traffic Safety Administration (NHTSA) Vehicle
|
||||
Product Information Catalog (vPIC) DecodeVin endpoint to retrieve vehicle
|
||||
|
||||
Reference in New Issue
Block a user