- Base de datos SQLite con información de vehículos - Dashboard web con Flask y Bootstrap - Scripts de web scraping para RockAuto - Interfaz CLI para consultas - Documentación completa del proyecto Incluye: - 12 marcas de vehículos - 10,923 modelos - 10,919 especificaciones de motores - 12,075 combinaciones modelo-año-motor
106 lines
3.1 KiB
Markdown
106 lines
3.1 KiB
Markdown
# Vehicle Database
|
|
|
|
A comprehensive database system for storing information about vehicle brands, models, years, and engines.
|
|
|
|
## Overview
|
|
|
|
This project provides a structured database for vehicle information with the following entities:
|
|
|
|
- **Brands**: Vehicle manufacturers with details like country of origin and founding year
|
|
- **Models**: Vehicle models with body type, generation, and production years
|
|
- **Years**: Calendar years for vehicle production
|
|
- **Engines**: Engine specifications including displacement, cylinders, power, and fuel type
|
|
- **Model-Year-Engine**: Junction table linking all entities with trim levels and specifications
|
|
|
|
## Database Schema
|
|
|
|
The database uses SQLite and consists of the following tables:
|
|
|
|
### `brands`
|
|
- `id`: Primary key
|
|
- `name`: Brand name (e.g., Toyota, Ford)
|
|
- `country`: Country of origin
|
|
- `founded_year`: Year the company was founded
|
|
|
|
### `engines`
|
|
- `id`: Primary key
|
|
- `name`: Engine name
|
|
- `displacement_cc`: Engine displacement in cubic centimeters
|
|
- `cylinders`: Number of cylinders
|
|
- `fuel_type`: Type of fuel (gasoline, diesel, electric, hybrid)
|
|
- `power_hp`: Horsepower
|
|
- `torque_nm`: Torque in Newton meters
|
|
- `engine_code`: Manufacturer engine code
|
|
|
|
### `models`
|
|
- `id`: Primary key
|
|
- `brand_id`: Foreign key to brands table
|
|
- `name`: Model name (e.g., Camry, Civic)
|
|
- `body_type`: Body style (sedan, SUV, truck, etc.)
|
|
- `generation`: Model generation
|
|
- `production_start_year`: Year production started
|
|
- `production_end_year`: Year production ended (NULL if still in production)
|
|
|
|
### `years`
|
|
- `id`: Primary key
|
|
- `year`: Calendar year
|
|
|
|
### `model_year_engine`
|
|
- `id`: Primary key
|
|
- `model_id`: Foreign key to models table
|
|
- `year_id`: Foreign key to years table
|
|
- `engine_id`: Foreign key to engines table
|
|
- `trim_level`: Trim level (e.g., base, luxury, sport)
|
|
- `drivetrain`: Drive system (FWD, RWD, AWD, 4WD)
|
|
- `transmission`: Transmission type (manual, automatic, CVT)
|
|
|
|
## Setup
|
|
|
|
1. Install Python 3.x if not already installed
|
|
2. Clone or download this repository
|
|
3. Run the database manager script:
|
|
|
|
```bash
|
|
cd vehicle_database
|
|
python scripts/database_manager.py
|
|
```
|
|
|
|
This will create the database, populate it with sample data, and run example queries.
|
|
|
|
## Usage
|
|
|
|
The `VehicleDatabaseManager` class provides methods to:
|
|
|
|
- Create and manage the database schema
|
|
- Insert new brands, models, engines, and years
|
|
- Query vehicle information
|
|
- Link models, years, and engines with trim levels and specifications
|
|
|
|
## Sample Queries
|
|
|
|
The script demonstrates several query patterns:
|
|
|
|
- Get all brands
|
|
- Get models for a specific brand
|
|
- Search for specific vehicles by brand, model, year, or engine
|
|
- Retrieve comprehensive vehicle information
|
|
|
|
## Extending the Database
|
|
|
|
To add more data, you can:
|
|
|
|
1. Use the provided Python API
|
|
2. Directly execute SQL commands on the SQLite database
|
|
3. Import data from CSV files using the provided structure
|
|
|
|
## File Structure
|
|
|
|
```
|
|
vehicle_database/
|
|
├── sql/
|
|
│ └── schema.sql # Database schema
|
|
├── scripts/
|
|
│ └── database_manager.py # Python database manager
|
|
├── data/ # Directory for data files
|
|
└── README.md # This file
|
|
``` |