Skip to content
gaia-chargePublic

Repository files navigation

EVDB - Open Electric Vehicle Database

License: CC BY-SA 4.0 Validate YAML Build Database

A comprehensive, open-source database of electric vehicles with detailed specifications, built with YAML + JSON Schema + Datasette + Streamlit.

πŸ—οΈ Architecture

YAML Source Files β†’ JSON Schema Validation β†’ SQLite Database β†’ Datasette API + Streamlit Dashboards

Why This Stack?

  • YAML: Human-readable, git-friendly source format with comments
  • JSON Schema: Industry-standard validation ensures data quality
  • SQLite: Single-file database, portable, fast, perfect for datasets
  • Datasette: Instant API and web UI for SQLite databases
  • Streamlit: Python-native dashboards for data visualization

πŸ“Š Data Structure

Four Core Entities

manufacturers/
  └─ tesla.yaml
  └─ volkswagen.yaml

vehicle-models/
  └─ tesla-model-3.yaml (base info)
  └─ volkswagen-id4.yaml

vehicle-variants/
  β”œβ”€ tesla-model-3-rwd-2024.yaml (detailed specs)
  β”œβ”€ tesla-model-3-long-range-awd-2024.yaml
  └─ volkswagen-id4-pure-2024.yaml

market-availability/
  β”œβ”€ tesla-model-3-rwd-2024-germany.yaml (pricing)
  β”œβ”€ tesla-model-3-rwd-2024-usa.yaml
  └─ volkswagen-id4-pure-2024-poland.yaml

Why This Separation?

  • Manufacturer - Company info (name, country, website)
  • Vehicle Model - Base model (dimensions, seating, body style)
  • Vehicle Variant - Specific trim with full specs (battery, range, charging, performance)
  • Market Availability - Region-specific pricing and options

This structure handles:

  • βœ… Multiple trims/versions per model
  • βœ… Market-specific variants
  • βœ… Changes over time (model years)
  • βœ… Missing/incomplete data gracefully

πŸš€ Features

  • Comprehensive Specs: Battery, range, charging, performance, dimensions
  • Real-World Data: Actual consumption, charging curves, not just claimed specs
  • Market Specifics: Pricing, incentives, availability by country
  • Data Quality Tracking: Every field marked with source and confidence level
  • Version History: Track changes across model years
  • SQL Queryable: Complex queries via Datasette
  • Visual Dashboards: Interactive comparisons via Streamlit
  • API Access: JSON API for developers
  • Open License: CC BY-SA 4.0 - free to use, share, and build upon

πŸ“‹ Current Status

Vehicles: 530+ variants across 180 models from 45 manufacturers Markets: Germany, Spain, Poland, France, Netherlands, Italy (plus initial US/UK data)

Live counts: /v1/stats.json or the notes of the latest release.

What's Working βœ…

  • βœ… Full validation pipeline - All YAML files validated with JSON Schema in CI
  • βœ… SQLite database - Automated builds via GitHub Actions
  • βœ… GitHub Releases - Pre-built database downloadable from every push
  • βœ… Static JSON API - Generated per push, served via GitHub Pages
  • βœ… Datasette support - Full SQL access with canned queries
  • βœ… Streamlit dashboard - 6 pages (Home, Browse, Compare, Analytics, Data Explorer, Documentation)
  • βœ… Docs - API docs, contributing guide, FAQ

πŸ“₯ Download the Database

The latest pre-built SQLite database is available from GitHub Releases:

# Download latest database
wget https://github.com/gaia-charge/evdb/releases/latest/download/evdb.db

# Or with curl
curl -L -o evdb.db https://github.com/gaia-charge/evdb/releases/latest/download/evdb.db

πŸ› οΈ Development Setup

Prerequisites

  • Python 3.10+
  • pip

Installation

# Clone repository
git clone https://github.com/gaia-charge/evdb.git
cd evdb

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Install pre-commit hooks (optional)
pre-commit install

Validate YAML Files

python scripts/validate.py --directory data/

Build SQLite Database

python scripts/build-sqlite.py --input-dir data/ --output evdb.db

Run Datasette

datasette evdb.db --metadata metadata.json
# Open http://localhost:8001

Run Streamlit Dashboard

streamlit run streamlit_app.py
# Open http://localhost:8501

Features:

  • 🏠 Home - Database statistics and quick search
  • πŸ” Browse Vehicles - Advanced filtering with 7 filters and 8 sort modes
  • βš–οΈ Compare - Side-by-side comparison of 2-4 vehicles with visualizations
  • πŸ“Š Analytics - Interactive charts for range, charging, price, and market analysis
  • πŸ’Ύ Data Explorer - SQL query interface with 8 example queries
  • πŸ“š Documentation - Embedded API docs, contributing guide, and FAQ

πŸ“– Documentation

🀝 Contributing

We need your help! Contributions welcome:

  • πŸš— Vehicle specifications - Battery, range, charging, performance
  • πŸ“Š Real-world data - Actual consumption and range tests
  • πŸ’° Market pricing - Regional pricing and options
  • 🌍 New markets - UK, Norway, China, Japan, Australia
  • πŸ”§ Code improvements - Scripts, validation, features
  • πŸ“– Translations - Help internationalize the database

Quick Start Guide

See CONTRIBUTING.md for the complete guide including:

  • πŸ“ How to add a vehicle (step-by-step)
  • βœ… Validation and testing workflow
  • πŸ“‹ Data quality standards
  • πŸ”€ Pull request process
  • 🎯 Priority vehicles we need

TL;DR:

  1. Fork β†’ Clone β†’ Create branch
  2. Copy template from templates/
  3. Fill in specs (see CONTRIBUTING.md)
  4. Validate: python scripts/validate.py --file your-file.yaml
  5. Submit pull request

All contributions must include source attribution. Data is licensed under CC BY-SA 4.0.

πŸ“‚ Repository Structure

evdb/
β”œβ”€β”€ data/                       # YAML source files
β”‚   β”œβ”€β”€ manufacturers/
β”‚   β”œβ”€β”€ vehicle-models/
β”‚   β”œβ”€β”€ vehicle-variants/
β”‚   β”œβ”€β”€ market-availability/
β”‚   └── reference/
β”‚       β”œβ”€β”€ connectors.yaml
β”‚       └── platforms.yaml
β”œβ”€β”€ schemas/                    # JSON Schema validation
β”‚   β”œβ”€β”€ manufacturer.schema.json
β”‚   β”œβ”€β”€ vehicle-model.schema.json
β”‚   β”œβ”€β”€ vehicle-variant.schema.json
β”‚   └── market-availability.schema.json
β”œβ”€β”€ scripts/                    # Build and validation tools
β”‚   β”œβ”€β”€ validate.py             # JSON Schema validation
β”‚   β”œβ”€β”€ build-sqlite.py         # YAML -> SQLite build
β”‚   β”œβ”€β”€ generate-api.py         # SQLite -> static JSON API
β”‚   └── analyze_missing_data.py # Data completeness report
β”œβ”€β”€ templates/                  # YAML templates for contributors
β”œβ”€β”€ streamlit_app.py            # Streamlit dashboard (6 pages)
β”œβ”€β”€ .github/workflows/          # CI/CD pipelines
β”œβ”€β”€ metadata.json               # Datasette configuration
└── requirements.txt            # Python dependencies

πŸ”Œ API Examples

Static JSON API served from GitHub Pages β€” see API_DOCS.md for all endpoints.

# All manufacturers
curl https://gaia-charge.github.io/evdb/v1/manufacturers.json

# All vehicles (summary)
curl https://gaia-charge.github.io/evdb/v1/vehicles.json

# One vehicle, full specs + market pricing
curl https://gaia-charge.github.io/evdb/v1/vehicles/tesla-model-3-long-range-awd-2024.json

# Pre-built queries
curl https://gaia-charge.github.io/evdb/v1/queries/long-range.json

# Database statistics
curl https://gaia-charge.github.io/evdb/v1/stats.json

πŸ“Š Example Queries

Compare Charging Speeds

SELECT
  m.name as manufacturer,
  vm.name as model,
  vv.variant_name,
  vv.dc_charge_power_kw as max_dc,
  vv.dc_charge_time_10_80_min as charge_time_min
FROM vehicle_variants vv
JOIN vehicle_models vm ON vv.model_id = vm.id
JOIN manufacturers m ON vm.manufacturer_id = m.id
WHERE vv.dc_charge_power_kw >= 150
ORDER BY vv.dc_charge_time_10_80_min ASC
LIMIT 20;

Find Budget EVs

SELECT
  m.name, vm.name, vv.variant_name,
  ma.price_base, ma.currency,
  vv.range_wltp_km
FROM vehicle_variants vv
JOIN vehicle_models vm ON vv.model_id = vm.id
JOIN manufacturers m ON vm.manufacturer_id = m.id
JOIN market_availability ma ON vv.id = ma.variant_id
WHERE ma.market_code = 'DE'
  AND ma.price_base < 40000
  AND vv.range_wltp_km > 400
ORDER BY vv.range_wltp_km DESC;

πŸ“œ License

πŸ”— Links

πŸ’‘ Inspiration

Inspired by comprehensive EV databases like ev-database.org, but with a focus on:

  • Open data (not proprietary)
  • Git-based workflow (trackable changes)
  • API-first design (easy integration)
  • Community contributions (crowdsourced accuracy)

πŸ“ž Contact


Built with ❀️ for the EV community

Data is power. Open data is power for everyone.

Releases

Used by

Contributors

Languages