RamiKrispin / EIAapi

Supporting tools for the Applied Time Series Analysis and Forecasting book
https://ramikrispin.github.io/EIAapi/
Other
10 stars 1 forks source link

Using multiple data parameters #10

Open leighmatth opened 1 year ago

leighmatth commented 1 year ago

Hi @RamiKrispin

Would it be possible to add the capability to define multiple data parameters? It looks like with the current version only one data parameter can be used.

For example, I'd like to pull the following information (eia page):

X-Params: {
    "frequency": "monthly",
    "data": [
        "average-heat-content",
        "consumption-for-eg",
        "consumption-for-eg-btu",
        "generation",
        "gross-generation",
        "total-consumption",
        "total-consumption-btu"
    ],
    "facets": {
        "fuel2002": [
            "ANT",
            "BIT",
            "LIG",
            "SUB"
        ],
        "plantCode": [
            6137
        ]
    },
    "start": null,
    "end": null,
    "sort": [
        {
            "column": "period",
            "direction": "desc"
        }
    ],
    "offset": 0,
    "length": 5000
}

Which has the API URL:

https://api.eia.gov/v2/electricity/facility-fuel/data/?frequency=monthly&data[0]=average-heat-content&data[1]=consumption-for-eg&data[2]=consumption-for-eg-btu&data[3]=generation&data[4]=gross-generation&data[5]=total-consumption&data[6]=total-consumption-btu&facets[fuel2002][]=ANT&facets[fuel2002][]=BIT&facets[fuel2002][]=LIG&facets[fuel2002][]=SUB&facets[plantCode][]=6137&sort[0][column]=period&sort[0][direction]=desc&offset=0&length=5000

With the current version, it seems like I can only pull one of those data parameters (e.g., "average_heat_content") at a time using the eia_get function.

RamiKrispin commented 1 year ago

Hi @leighmatth, will check how simple it would be to add it as a feature and update.