Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert the FERC exploded forest to a table for readability #2832

Merged
merged 12 commits into from
Sep 11, 2023

Conversation

cmgosnell
Copy link
Member

PR Overview

This PR adds a few methods to the forest class that converts a forest's relationships into a big ol table. Starting from the seed node, I grab that nodes' direct children and merge those children with their direct parents. I used _level{n} to indicate which step in the tree the nodes refer to.

I decided to use the calculation_components_ferc1 as the core building blocks of the table instead of just using a decomposed forest. I think using only a forest could have done the job just fine, but I thought it would a) be a nice check on the forest and b) be slightly more straightforward bc the calc components table is already a table. Using the calc components table, each time you want to get a level of parent/child connections from the calc comps table I first select for the parent nodes and then select the child nodes from that subset of the table. This way you never get parents records that have children that got pruned from the forest and you never have children records that refer to a different parent.

Once the subset of the calc components table is selected each round, a new set of _level{n+1} nodes gets merged onto their _level{n} parents.

Other notes:

  • I added in the weight of the children for every level.

PR Checklist

  • Merge the most recent version of the branch you are merging into (probably dev).
  • All CI checks are passing. Run tests locally to debug failures
  • Make sure you've included good docstrings.
  • For major data coverage & analysis changes, run data validation tests
  • Include unit tests for new functions and classes.
  • Defensive data quality/sanity checks in analyses & data processing functions.
  • Update the release notes and reference reference the PR and related issues.
  • Do your own explanatory review of the PR to help the reviewer understand what's going on and identify issues preemptively.

@zaneselvans
Copy link
Member

I cancelled the CI since it was already failing. And the failure is on GitHub's side. Some issue with actions right now sitewide.

https://www.githubstatus.com/history

@zaneselvans zaneselvans self-assigned this Sep 6, 2023
@zaneselvans zaneselvans added the ferc1 Anything having to do with FERC Form 1 label Sep 6, 2023
@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Patch coverage: 8.8% and project coverage change: -0.3% ⚠️

Comparison is base (d9d1cb1) 88.6% compared to head (8f81e9c) 88.4%.

Additional details and impacted files
@@                 Coverage Diff                  @@
##           explode_tree_fixes   #2832     +/-   ##
====================================================
- Coverage                88.6%   88.4%   -0.3%     
====================================================
  Files                      90      90             
  Lines                   10791   10825     +34     
====================================================
+ Hits                     9569    9572      +3     
- Misses                   1222    1253     +31     
Files Changed Coverage Δ
src/pudl/output/ferc1.py 85.8% <8.8%> (-4.7%) ⬇️

☔ View full report in Codecov by Sentry.

📢 Have feedback on the report? Share it here.

@zaneselvans zaneselvans marked this pull request as draft September 11, 2023 04:59
@zaneselvans zaneselvans marked this pull request as ready for review September 11, 2023 05:14
@zaneselvans zaneselvans merged commit 4cab17f into explode_tree_fixes Sep 11, 2023
6 of 7 checks passed
@zaneselvans zaneselvans deleted the explode_forest_as_table branch September 11, 2023 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ferc1 Anything having to do with FERC Form 1
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants