PyPSA / PyPSA/pypsa-usa

Cache EIA API data

Open
#543 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Sector
Dominant language
Python
Stars
148
Forks
55
Avg merge
2d 11h
Merged PRs (30d)
18

Description

Feature Request

Would be nice to add in a config option allowing for the caching of EIA API data. We do have each API call retry up to three times, but its still non-uncommon to run into a ReadTimeoutError, given below. Im not sure if this is caused when multiple API calls happen at one time from different rules.

WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='api.eia.gov', port=443): Read timed out.
Suggested Solution

Add in a RetrieveEiaApiData rule that will call the API once and save the data in the resources folder. This should make running scenarios a little easier, as the data only has to be requested once.

Additional Info

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing EIA API calls and their retry handling, then trace how scenario rules access the returned data. Implement the requested configuration option and RetrieveEiaApiData rule so one API request saves data in the resources folder and later scenario runs reuse it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design, data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.