An interactive Streamlit dashboard for exploring building energy data from the ResStock baseline dataset with side-by-side county comparison.
- Side-by-Side County Comparison: Compare two counties simultaneously with separate dashboards
- Interactive Maps: County-level choropleth maps showing building density
- Building Statistics: View building counts, types, vintage distribution, and more
- Energy Insights: Explore energy consumption, costs, and energy burden metrics
- Interactive Visualizations: Pie charts and bar charts for key building characteristics
- Comparison Metrics: Direct comparison of key metrics between selected counties
- Ensure you have Python 3.8+ installed
- Activate your virtual environment (if using one):
source .venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
The conversion script now uses Typer for command-line interface with separate commands:
python convert_to_sqlite.py all
- Convert the parquet file to SQLite for county data:
python convert_to_sqlite.py counties
- (Optional) Create loadshape summaries from S3 data:
python convert_to_sqlite.py loadshape
counties
- Creates county_summary and county_building_summary tablesloadshape
- Creates loadshape_summary table with hourly averages from S3all
- Runs both counties and loadshape conversions in sequence
--parquet-file
or-p
- Specify parquet file path (default: baseline.parquet)--db-file
or-d
- Specify database file path (default: resstock.db)--upgrades-file
or-u
- Specify upgrades lookup file (default: upgrades_lookup.json)--state
or-s
- Specify states to process for loadshape (can use multiple times, e.g.,--state PA --state CA
)--upgrade
- Specify upgrades to process for loadshape (can use multiple times, e.g.,--upgrade 0 --upgrade 1
)
# Process specific states for loadshape data
python convert_to_sqlite.py loadshape --state PA --state CA
python convert_to_sqlite.py loadshape -s TX -s FL -s NY
# Process specific upgrades for loadshape data (numeric upgrade IDs)
python convert_to_sqlite.py loadshape --upgrade 0 --upgrade 1
python convert_to_sqlite.py loadshape --upgrade 2 --upgrade 3
# Combine state and upgrade filters
python convert_to_sqlite.py loadshape --state PA --state CA --upgrade 0 --upgrade 1
# With custom file paths
python convert_to_sqlite.py counties --parquet-file mydata.parquet --db-file mydb.db
python convert_to_sqlite.py loadshape --db-file mydb.db --upgrades-file myupgrades.json
- Run the comparison dashboard:
streamlit run app.py
- Open your browser and navigate to the URL shown in the terminal (typically
http://localhost:8501
)
The dashboard uses the ResStock baseline dataset which contains:
- 549,718 buildings across 1,842 counties
- Building characteristics (type, vintage, floor area, etc.)
- Energy consumption data
- Cost and energy burden metrics
county_summary
- County-level aggregated datacounty_building_summary
- County and building type aggregated dataloadshape_summary
- Hourly loadshape averages for all upgrade/state/building type combinations (includes total and emissions columns)
Each county dashboard includes:
- Interactive County Map: Choropleth map showing building count by county
- County Selection: Dropdown to select any county in the dataset
- Key Metrics: Building counts and weighted counts
- Distribution Charts: Interactive charts showing:
- Building type distribution (pie chart)
- Vintage distribution (bar chart, sorted by NREL vintage order)
- Heating fuel distribution (pie chart)
- Water heater fuel distribution (pie chart)
- Energy Insights: Average electricity consumption, costs, and energy burden
- Energy Characteristics: Primary heating fuel information
- County Summary Table: Comprehensive data table for the selected county
- Building Count Comparison: Direct comparison with delta values
- Average Electricity Comparison: Energy consumption differences
- Average Energy Burden Comparison: Energy cost burden differences
app.py
- Main dashboard applicationconvert_to_sqlite.py
- Converts parquet data to SQLite databasecounties.geojson
- County boundary data for mappingresstock.db
- SQLite database with county summariesbaseline.parquet
- Original ResStock datasetstate_lookup.csv
- State name/abbreviation mappingcounty_lookup.csv
- County information lookup table
- Additional comparison metrics
- Time series analysis
- Energy efficiency upgrade scenarios
- Export functionality for selected data
- More detailed building characteristic comparisons