Streamlit dashboard for exploring U.S. electricity demand data from the U.S. Energy Information Administration (EIA).
- EIA Open Data API:
electricity/rtodatasets - Fuel type page endpoint:
daily-fuel-type-data - Region page endpoint:
daily-region-data - API docs: https://www.eia.gov/opendata/documentation.php
- Install dependencies:
pip install -r requirements.txt
- Ensure
panderais available (already included inrequirements.txt):pip install "pandera[pandas]" - Configure your EIA API key in Streamlit secrets:
# .streamlit/secrets.toml EIA_API_KEY = "your_key_here"
streamlit run mainPage.pyThis opens a two-page app:
- Fuel type demand view (
app.py) - Region demand view (
region.py)
pytest -qValidation lives in schemas.py and is applied in both pages at two stages:
- Raw API payload validation:
- Checks required columns exist for each page.
- Allows extra columns (
strict=False) so API field additions do not break the app.
- Parsed data validation:
- Enforces
periodas datetime-like andvalueas numeric-coercible. - Invalid rows are dropped for required plotting columns.
Failure behavior is non-blocking by default:
- The app shows
st.warning(...)with a short validation summary. - It continues with cleaned data when possible.
- If no usable rows remain after cleaning, the page stops with a warning.
No data returned:- Check API key and date range.
- Validation warnings:
- Usually indicate API schema drift or dirty rows in the selected date window.
- The app will continue when possible; inspect warnings to see dropped fields/rows.
- Empty chart after warnings:
- All rows were filtered out by required-column checks, parsing, or timezone filter.
The project investigates grid behavior under stress using EIA demand and generation data, with optional future weather integration (NOAA) for event-based analysis.