A comprehensive interactive dashboard for analyzing global Electric Vehicle (EV) adoption trends built with Streamlit and PostgreSQL. The dashboard provides deep insights into EV market trends through advanced data visualization and predictive analytics.
- Multi-page Interactive Dashboard: Navigate through different analytical views of EV adoption data
- Data Visualization: Explore trends with dynamic charts and maps
- Forecasting: Predict future EV adoption rates using machine learning models
- Data Upload: Upload and analyze your own EV adoption datasets
- Persistent Storage: PostgreSQL database integration for efficient data management
- Regional Analysis: Compare EV adoption across different regions and countries
- Market Share Analysis: Track EV market penetration over time
- User-friendly Interface: Modern UI with interactive filters and data loading animations
- Enhanced UX: Progress bars and step-by-step loading indicators for improved user experience
- Data Previews: Automatic preview of uploaded data with real-time validation
- Streamlit: For the interactive web application framework
- PostgreSQL: Database for persistent data storage
- SQLAlchemy: ORM for database interactions
- Pandas/NumPy: For data manipulation and analysis
- Plotly/Matplotlib/Seaborn: For interactive data visualizations
- Scikit-learn: For forecasting models
- Python 3.8+
- PostgreSQL database
-
Clone the repository:
git clone https://github.com/your-username/ev-adoption-dashboard.git cd ev-adoption-dashboard -
Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate # Install required packages pip install streamlit>=1.22.0 pandas>=1.5.0 numpy>=1.23.0 plotly>=5.13.0 pip install matplotlib>=3.7.0 seaborn>=0.12.0 scikit-learn>=1.2.0 pip install sqlalchemy>=2.0.0 psycopg2-binary>=2.9.5 python-dotenv>=1.0.0
-
Set up your PostgreSQL database and configure connection:
- Create a new PostgreSQL database
- Set the following environment variables or create a
.envfile:DATABASE_URL=postgresql://username:password@localhost:5432/ev_adoption_db
-
Initialize the database:
python -c "from utils.database import init_db; init_db()"
-
Start the Streamlit application:
streamlit run app.py
-
Open your browser and navigate to
http://localhost:8501 -
Use the sidebar to:
- Select data source (sample data or upload your own CSV)
- Filter by year range and regions
- Navigate between different analysis pages
If you're uploading your own data, the CSV file should include the following columns:
year: The year of the data pointregion: The region or country namesales: EV sales numbersmarket_share(optional): EV market share as percentageev_type(optional): Type of EV (BEV, PHEV, etc.)total_vehicle_sales(optional): Total vehicle sales for market share calculation
ev-adoption-dashboard/
├── app.py # Main application entry point
├── pages/ # Dashboard page modules
│ ├── overview.py # Overview page
│ ├── regional_analysis.py # Regional comparison page
│ ├── market_share.py # Market share analysis page
│ └── forecasting.py # Forecasting page
├── utils/ # Utility modules
│ ├── data_loader.py # Data loading functions
│ ├── data_processor.py # Data processing functions
│ ├── data_visualizer.py # Visualization functions
│ ├── database.py # Database interaction
│ └── forecasting.py # Forecasting models
└── assets/ # Static assets
└── sample_data.py # Sample data generator
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Special thanks to contributors and the open-source community
