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
Fix retained_earnings_ferc1
transform
#2645
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
…ooperative/pudl into retained_earnings_fix
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## dev #2645 +/- ##
=====================================
Coverage 87.1% 87.2%
=====================================
Files 86 86
Lines 10043 10097 +54
=====================================
+ Hits 8755 8811 +56
+ Misses 1288 1286 -2
☔ View full report in Codecov by Sentry. |
Plan of action based on discussion with @zaneselvans
|
With the updates above, the table fields are able to be calculated and can be integrated into the explosion process. For the full ETL, the table as-is has 7.9% of calculations not summing correctly. This requires further diagnosis. Update: this issue has been diagnosed. See subsequent commits for resolution. |
Notes from messing around with the data:I apologize if I sound like I'm being dense here... I'm just running through the FERC 1 ETL debugging notebook and finally actually getting to see what in the data. These are just my running notes from that process. Maybe we can sit down with the notebook and the custom transform methods briefly? 😵💫
At a high level it seems funny that at the end of this transform we're retaining what feels like a few pieces of duplicative information:
I suspect that this doesn't make sense to me because I don't understand how we need to use these values later on to replicate the XBRL calculations. |
Hopefully this answers all your questions.
I'm not sure what you mean about two sets of starting/ending balances. I see two components in the raw XBRL instant data, These are two different components that sum to
DBF has factoids in Re: the metadata - technically these values can be calculated using the same formula, but with one year's prior data. I think for simplicity though, we should relate to them as reported values. We are in practice checking that they are the same as the ending balance for the prior year's data. Lines 4457-59 attempt to add existing metadata associated with DBF
This table only deals with the structured data currently, correct.
I'm not sure we are looking at the same table. At the end of
We can't drop the factoid because we need it as a |
Addresses #1811 and #2016.
Issues addressed in this PR:
amount
column fromretained_earnings_ferc1
: At present, there is anamount
,starting_balance
andending_balance
column.amount
andstarting_balance
originate from the source data, whileending_balance
is produced and filled with amount when reconciling duplicate years' data in thecondense_double_year_earnings_types_dbf
method. At present, this is only filled when the data has overlapping years. I've updated this method to fill all NA values forending_balance
withamount
where available. This adds approximately another 6k values into theending_balance
column and resolves the ambiguity surrounding the relationship between the 3 columns.condense_double_year_earnings_types_dbf
intoreconcile_double_year_earnings_types_dbf
, to retain the_previous_year
versions of existing factoids that require starting balances for their calculations.retained_earnings_ferc1
table based on the form itself, and checks them to be correct.Questions for the reviewer:
balance
column, but I don't have 100% certainty about what's a debit and what's a credit and some factoids could be either. Thoughts here?Notes about table weirdnesses:
starting_balance
andending_balance
as columns or factoids. When starting balance values are included in calculations in other tables, they are included as factoids and summed in thedollar_value
column.ending_balance
as a value to be calculated (e.g.,utility_plant_summary_ferc1
), they do not directly calculate it using thestarting_balance
, even if starting balance is reported (e.g.balance_sheet_assets_ferc1
).retained_earnings_ferc1
is a weirdo because it hasstarting_balance
in 2 places: as a factoid for the table and as a column for each variable. We collapse these two values into one in thecondense_double_year_earnings_types_dbf
method but this means that we're losing the ability to add this value as a component in the calculations in theending_balance
column. In general, tables mirror the vertical addition structure used by FERC, and we're deviating from this format in this instance by reshaping the data.dollar_value
orending_balance
). The retained_earnings table hasstarting_balance
andending_balance
columns for all variables, but there are calculations which require the addition of a starting balance and the ending balance of other components to get to the ending balance.Design decisions:
To deal with the above, we could do one of the following:
unappropriated_retained_earnings_start_balance
andunappropriated_retained_earnings_ending_balance
(etc.) as factoids, reassigning theending_value
column to be adollar_value
column and dropping thestarting_balance
data. We'd lose half the data in this table this way.unappropriated_retained_earnings_start_balance
andunappropriated_retained_earnings_ending_balance
(etc.) as factoids, keepingstarting_balance
andending_balance
and just filling in the values for this column as they presently are in the table (in effect, undo the work fromcondense_double_year_earnings_types_dbf
). This table is frustratingly less clean than it was before, but we can do the calculation checks. Even so, we'll still have to deal with the same issue being present in the xbrl data, where there is only one factoid with a starting and ending balance, possibly by following a similar workaround to that used for theelectric_plant_depreciation_changes_ferc1
table.Remaining tasks:
condense_double_year_earnings_type_dbf
to keep the filling behavior without dropping the previous year factoidsreconcile_table_calculations()
methodPR Checklist
dev
).