Skip to content

Cli improvements#46

Open
MeadBarrel wants to merge 51 commits intomainfrom
cli_improvements
Open

Cli improvements#46
MeadBarrel wants to merge 51 commits intomainfrom
cli_improvements

Conversation

@MeadBarrel
Copy link
Contributor

Close #20

  • Unify cli: tariff-fetch, tariff-fetch urdb, tariff-fetch gas, tariff-fetch gas urdb, tariff-fetch ni (non-interactive mode), tariff-fetch urdb ni, tariff-fetch gas urdb ni
  • Interactive commands print replay commands upon completion
  • Add logging parameters

 » AL
   AK
   AZ
   AR
   CA
   CO
   CT
   DE
   FL
   GA
   HI
   ID
   IL
   IN
   IA
   KS
   KY
   LA
   ME
   MD
   MA
   MI
   MN
   MS
   MO
   MT
   NE
   NV
   NH
   NJ
   NM
   NY
   NC
   ND
   OH
   OK
   OR
   PA
   RI                                               ? Select state AL
Logging to outputs/logs/tariff_fetch_urdb_20260323_125907.log
? Select a utility (Use arrow keys, type to filter)
 » Utility Name                          | EIA ID | Entity Type    | Sales (MWh
                                                                               )
   ----------------------------------------------------------------------------
                                                                               -
   Alabama Power Co                      | 195    | Investor Owned | 18,058,324
   Baldwin County El Member Corp         | 1149   | Cooperative    | 1,121,292
   Central Alabama Electric Coop         | 3222   | Cooperative    | 628,803
   Cullman Electric Coop, Inc            | 4618   | Cooperative    | 591,417
   Joe Wheeler Elec Member Corp          | 9739   | Cooperative    | 595,913
   Tallapoosa River Elec Coop Inc        | 18203  | Cooperative    | 410,431
   Sand Mountain Electric Coop           | 16629  | Cooperative    | 385,353
   Covington Electric Coop, Inc          | 4430   | Cooperative    | 316,974
   Wiregrass Electric Coop, Inc          | 20841  | Cooperative    | 328,360
   Dixie Electric Coop - (AL)            | 5204   | Cooperative    | 311,929
   Southern Pine Elec Coop, Inc          | 17646  | Cooperative    | 262,752
   Black Warrior Elec Member Corp        | 1780   | Cooperative    | 267,309
   Cherokee Electric Coop - (AL)         | 3426   | Cooperative    | 252,438
   Clarke-Washington E M C               | 40127  | Cooperative    | 220,870
   Marshall-De Kalb Electric Coop        | 11714  | Cooperative    | 257,918
   South Alabama Elec Coop, Inc          | 17534  | Cooperative    | 205,849
   Coosa Valley Electric Coop Inc        | 4327   | Cooperative    | 227,026
   Pea River Electric Coop               | 14602  | Cooperative    | 205,084
   Arab Electric Coop Inc                | 750    | Cooperative    | 208,955
   North Alabama Electric Coop           | 13669  | Cooperative    | 198,549
   Pioneer Electric Coop, Inc - (AL)     | 30517  | Cooperative    | 146,400
   Tombigbee Electric Coop, Inc          | 19027  | Cooperative    | 96,298
   Franklin Electric Coop - (AL)         | 6717   | Cooperative    | 79,843
   Diverse Power Incorporated            | 19219  | Cooperative    | 8,118
   Singing River Elec Cooperative        | 17252  | Cooperative    | 4,897
   Alabama Electric Coop Inc             | 189    | Cooperative    | 0
   City of Huntsville - (AL)             | 9094   | Municipal      | 2,779,774
   City of Athens - (AL)                 | 944    | Municipal      | 695,825
   Foley Board of Utilities              | 6491   | Municipal      | 755,706
   City of Florence - (AL)               | 6422   | Municipal      | 635,264
   City of Dothan - (AL)                 | 5309   | Municipal      | 377,220
   Decatur Utilities                     | 4958   | Municipal      | 320,833
   Sheffield Utilities                   | 17033  | Municipal      | 234,217
   City of Opelika - (AL)                | 14146  | Municipal      | 164,791
   City of Bessemer Utilities            | 1640   | Municipal      | 116,464
   Albertville Municipal Utilities Board | 241    | Municipal      | 124,264
   City of Troy - (AL)                   | 19225  | Municipal      | 98,455                                                   ? Select a utility Utility Name                          | EIA ID | Entity Type
   | Sales (MWh) | Revenue ($)   | Customers
? Enter year 2025

                  ? Enter year 2025
Processing Genability
[03/23/26 12:59:08] ERROR    'str' object has no attribute 'eia_id'                                                                                                                                        cli.py:794
                             ╭──────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────╮
                             │ /workspaces/tarifffetch/tariff_fetch/cli.py:789 in _run_cli_command                                                                                                       │
                             │                                                                                                                                                                           │
                             │    786                                                                                                                                                                    │
                             │    787 def _run_cli_command(command: Callable[[], _T]) -> _T:                                                                                                             │
                             │    788 │   try:                                                                                                                                                           │
                             │ ❱  789 │   │   return command()                                                                                                                                           │
                             │    790 │   except typer.Exit as e:                                                                                                                                        │
                             │    791 │   │   _handle_expected_exit(e)                                                                                                                                   │
                             │    792 │   │   raise AssertionError("unreachable") from None                                                                                                              │
                             │                                                                                                                                                                           │
                             │ /workspaces/tarifffetch/tariff_fetch/cli.py:234 in <lambda>                                                                                                               │
                             │                                                                                                                                                                           │
                             │    231 │                                                                                                                                                                  │
                             │    232 │   console.print("Processing [blue]Genability[/]")                                                                                                                │
                             │    233 │   _run_cli_command(                                                                                                                                              │
                             │ ❱  234 │   │   lambda: process_genability_urdb(                                                                                                                           │
                             │    235 │   │   │   utility=utility,                                                                                                                                       │
                             │    236 │   │   │   output_folder=output_folder_,                                                                                                                          │
                             │    237 │   │   │   year=year,                                                                                                                                             │
                             │                                                                                                                                                                           │
                             │ /workspaces/tarifffetch/tariff_fetch/_cli/arcadia_urdb.py:50 in process_genability                                                                                        │
                             │                                                                                                                                                                           │
                             │    47 │   _ = load_dotenv()                                                                                                                                               │
                             │    48 │   api = ArcadiaSignalAPI()                                                                                                                                        │
                             │    49 │                                                                                                                                                                   │
                             │ ❱  50 │   lse_id = _find_utility_lse_id(api, utility)                                                                                                                     │
                             │    51 │   if lse_id is None:                                                                                                                                              │
                             │    52 │   │   return                                                                                                                                                      │
                             │    53                                                                                                                                                                     │
                             │                                                                                                                                                                           │
                             │ /workspaces/tarifffetch/tariff_fetch/_cli/arcadia_urdb.py:112 in _find_utility_lse_id                                                                                     │
                             │                                                                                                                                                                           │
                             │   109 │   │   lses = api.lses.get_page(                                                                                                                                   │
                             │   110 │   │   │   fields="min",                                                                                                                                           │
                             │   111 │   │   │   search_on=["code"],                                                                                                                                     │
                             │ ❱ 112 │   │   │   search=str(utility.eia_id),                                                                                                                             │
                             │   113 │   │   │   starts_with=True,                                                                                                                                       │
                             │   114 │   │   │   ends_with=True,                                                                                                                                         │
                             │   115 │   │   )["results"]                                                                                                                                                │
                             ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                             AttributeError: 'str' object has no attribute 'eia_id'
 » AL
   AK
   AZ
   AR
   CA
   CO
   CT
   DE
   FL
   GA
   HI
   ID
   IL
   IN
   IA
   KS
   KY
   LA
   ME
   MD
   MA
   MI
   MN
   MS
   MO
   MT
   NE
   NV
   NH
   NJ
   NM
   NY
   NC
   ND
   OH
   OK
   OR
   PA
   RI                                               ? Select state AL
? Select provider (Use arrow keys)
 » Genability
   OpenEI
   RateAcuity

   Genability

 » RateAcuity                     ? Select provider RateAcuity
Logging to outputs/logs/tariff_fetch_20260323_130637.log
? Select a utility (Use arrow keys, type to filter)
 » Utility Name                          | EIA ID | Entity Type    | Sales (MWh
                                                                               )
   ----------------------------------------------------------------------------
                                                                               -
   Alabama Power Co                      | 195    | Investor Owned | 18,058,324
   Baldwin County El Member Corp         | 1149   | Cooperative    | 1,121,292
   Central Alabama Electric Coop         | 3222   | Cooperative    | 628,803
   Cullman Electric Coop, Inc            | 4618   | Cooperative    | 591,417
   Joe Wheeler Elec Member Corp          | 9739   | Cooperative    | 595,913
   Tallapoosa River Elec Coop Inc        | 18203  | Cooperative    | 410,431
   Sand Mountain Electric Coop           | 16629  | Cooperative    | 385,353
   Covington Electric Coop, Inc          | 4430   | Cooperative    | 316,974
   Wiregrass Electric Coop, Inc          | 20841  | Cooperative    | 328,360
   Dixie Electric Coop - (AL)            | 5204   | Cooperative    | 311,929
   Southern Pine Elec Coop, Inc          | 17646  | Cooperative    | 262,752
   Black Warrior Elec Member Corp        | 1780   | Cooperative    | 267,309
   Cherokee Electric Coop - (AL)         | 3426   | Cooperative    | 252,438
   Clarke-Washington E M C               | 40127  | Cooperative    | 220,870
   Marshall-De Kalb Electric Coop        | 11714  | Cooperative    | 257,918
   South Alabama Elec Coop, Inc          | 17534  | Cooperative    | 205,849
   Coosa Valley Electric Coop Inc        | 4327   | Cooperative    | 227,026
   Pea River Electric Coop               | 14602  | Cooperative    | 205,084
   Arab Electric Coop Inc                | 750    | Cooperative    | 208,955
   North Alabama Electric Coop           | 13669  | Cooperative    | 198,549
   Pioneer Electric Coop, Inc - (AL)     | 30517  | Cooperative    | 146,400
   Tombigbee Electric Coop, Inc          | 19027  | Cooperative    | 96,298
   Franklin Electric Coop - (AL)         | 6717   | Cooperative    | 79,843
   Diverse Power Incorporated            | 19219  | Cooperative    | 8,118
   Singing River Elec Cooperative        | 17252  | Cooperative    | 4,897
   Alabama Electric Coop Inc             | 189    | Cooperative    | 0
   City of Huntsville - (AL)             | 9094   | Municipal      | 2,779,774
   City of Athens - (AL)                 | 944    | Municipal      | 695,825
   Foley Board of Utilities              | 6491   | Municipal      | 755,706
   City of Florence - (AL)               | 6422   | Municipal      | 635,264
   City of Dothan - (AL)                 | 5309   | Municipal      | 377,220
   Decatur Utilities                     | 4958   | Municipal      | 320,833
   Sheffield Utilities                   | 17033  | Municipal      | 234,217
   City of Opelika - (AL)                | 14146  | Municipal      | 164,791
   City of Bessemer Utilities            | 1640   | Municipal      | 116,464
   Albertville Municipal Utilities Board | 241    | Municipal      | 124,264
   City of Troy - (AL)                   | 19225  | Municipal      | 98,455                                                   ? Select a utility (Use arrow keys, type to filter)

Cancelled by user when arcadia is selected
 » AL
   AK
   AZ
   AR
   CA
   CO
   CT
   DE
   FL
   GA
   HI
   ID
   IL
   IN
   IA
   KS
   KY
   LA
   ME
   MD
   MA
   MI
   MN
   MS
   MO
   MT
   NE
   NV
   NH
   NJ
   NM
   NY
   NC
   ND
   OH
   OK
   OR
   PA
   RI                                               ? Select state (Use arrow keys, type to filter)

Cancelled by user openei
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Print tf command before download starts

1 participant