catalyst-cooperative / pudl

The Public Utility Data Liberation Project provides analysis-ready energy system data to climate advocates, researchers, policymakers, and journalists.
https://catalyst.coop/pudl
MIT License
468 stars 107 forks source link

enable proper treatment of inter-table xbrl meta calculations @cmgosnell #2622

Closed cmgosnell closed 1 year ago

cmgosnell commented 1 year ago

there seeming two types of inter-table calculations:

  1. those that have calculation components that are entirely sourced from other tables
  2. those that have some but not all of their calculation components from other tables.

In the exploded table context, the # 1 option seems easy to deal with. When

For but the # 2 option... what should we do? @jrea-rmi We could:

An example to keep it tanglible: in the electric_operating_expenses_ferc1 table there are two calculated fields ('power_production_expenses_steam_power' & power_production_expenses_hydraulic_power) that each have one calculation component that is source from that plant tables:

[{'name': 'steam_power_generation_operations_expense', 'weight': 1.0},
 {'name': 'steam_power_generation_maintenance_expense', 'weight': 1.0},
 {'name': 'operation_supervision_and_engineering_expense',
  'weight': 1.0,
  'source_table': ['plants_steam_ferc1',
   'plants_hydro_ferc1',
   'plants_pumped_storage_ferc1']}]

All examples of calcs with any inter-table calculation components

income_statement_inter_table_calcs = [
    {
        'xbrl_factoid': 'power_production_expenses_steam_power',
        'table_name': 'electric_operating_expenses_ferc1',
        'calculations': [
            {'name': 'steam_power_generation_operations_expense', 'weight': 1.0},
            {'name': 'steam_power_generation_maintenance_expense', 'weight': 1.0},
            {'name': 'operation_supervision_and_engineering_expense',
             'weight': 1.0,
             'source_table': [
                 'plants_steam_ferc1',
                 'plants_hydro_ferc1',
                 'plants_pumped_storage_ferc1']}]},
    {
        'xbrl_factoid': 'power_production_expenses_hydraulic_power',
        'table_name': 'electric_operating_expenses_ferc1',
        'calculations': [
            {'name': 'hydraulic_power_generation_operations_expense',
             'weight': 1.0},
            {'name': 'hydraulic_power_generation_maintenance_expense',
             'weight': 1.0},
            {'name': 'operation_supervision_and_engineering_expense',
             'weight': 1.0,
             'source_table': [
                 'plants_steam_ferc1',
                 'plants_hydro_ferc1',
                 'plants_pumped_storage_ferc1']}]},
    {
        'xbrl_factoid': 'sales_for_resale',
        'table_name': 'electric_operating_revenues_ferc1',
        'calculations': [
            {'name': 'demand_charges_revenue_sales_for_resale',
             'weight': 1.0,
             'source_table': []},
            {'name': 'energy_charges_revenue_sales_for_resale',
             'weight': 1.0,
             'source_table': []},
            {'name': 'other_charges_revenue_sales_for_resale',
             'weight': 1.0,
             'source_table': []}]},
    {
        'xbrl_factoid': 'residential_sales',
        'table_name': 'electric_operating_revenues_ferc1',
        'calculations': [
            {'name': 'residential_sales_billed',
             'weight': 1.0,
             'source_table': ['electricity_sales_by_rate_schedule_ferc1']},
            {'name': 'residential_sales_unbilled',
             'weight': 1.0,
             'source_table': ['electricity_sales_by_rate_schedule_ferc1']}]},
    {
        'xbrl_factoid': 'public_street_and_highway_lighting',
        'table_name': 'electric_operating_revenues_ferc1',
        'calculations': [
            {'name': 'public_street_and_highway_lighting_billed',
             'weight': 1.0,
             'source_table': ['electricity_sales_by_rate_schedule_ferc1']},
            {'name': 'public_street_and_highway_lighting_unbilled',
             'weight': 1.0,
             'source_table': ['electricity_sales_by_rate_schedule_ferc1']}]},
    {
        'xbrl_factoid': 'interdepartmental_sales',
        'table_name': 'electric_operating_revenues_ferc1',
        'calculations': [
            {'name': 'interdepartmental_sales_billed',
             'weight': 1.0,
             'source_table': ['electricity_sales_by_rate_schedule_ferc1']},
            {'name': 'interdepartmental_sales_unbilled',
             'weight': 1.0,
             'source_table': ['electricity_sales_by_rate_schedule_ferc1']}]},
    {
        'xbrl_factoid': 'sales_to_ultimate_consumers',
        'table_name': 'electric_operating_revenues_ferc1',
        'calculations': [
            {'name': 'residential_sales', 'weight': 1.0},
            {'name': 'public_street_and_highway_lighting', 'weight': 1.0},
            {'name': 'other_sales_to_public_authorities', 'weight': 1.0},
            {'name': 'sales_to_railroads_and_railways', 'weight': 1.0},
            {'name': 'interdepartmental_sales', 'weight': 1.0},
            {'name': 'commercial_and_industrial_sales',
                'weight': 1.0,
                'source_table': ['electricity_sales_by_rate_schedule_ferc1']}]},
    {
        'xbrl_factoid': 'other_sales_to_public_authorities',
        'table_name': 'electric_operating_revenues_ferc1',
        'calculations': [
            {'name': 'other_sales_to_public_authorities_billed',
             'weight': 1.0,
             'source_table': ['electricity_sales_by_rate_schedule_ferc1']},
            {'name': 'other_sales_to_public_authorities_unbilled',
             'weight': 1.0,
             'source_table': ['electricity_sales_by_rate_schedule_ferc1']}]},
    {
        'xbrl_factoid': 'sales_to_railroads_and_railways',
        'table_name': 'electric_operating_revenues_ferc1',
        'calculations': [
            {'name': 'sales_to_railroads_and_railways_billed',
             'weight': 1.0,
             'source_table': ['electricity_sales_by_rate_schedule_ferc1']},
            {'name': 'sales_to_railroads_and_railways_unbilled',
             'weight': 1.0,
             'source_table': ['electricity_sales_by_rate_schedule_ferc1']}]}]

balance_sheet_inter_table_calcs = [
    {
        'xbrl_factoid': 'utility_plant_and_construction_work_in_progress',
        'table_name': 'utility_plant_summary_ferc1',
        'calculations': [
            {'name': 'utility_plant',
             'weight': 1.0,
             'source_table': ['balance_sheet_assets_ferc1']},
            {'name': 'utility_plant_in_service_classified_and_unclassified',
                'weight': 1.0},
            {'name': 'utility_plant_leased_to_others', 'weight': 1.0},
            {'name': 'utility_plant_held_for_future_use', 'weight': 1.0},
            {'name': 'construction_work_in_progress', 'weight': 1.0},
            {'name': 'utility_plant_acquisition_adjustment', 'weight': 1.0}]},
    {
        'xbrl_factoid': 'accumulated_provision_for_depreciation_amortization_and_depletion_of_plant_utility',
        'table_name': 'balance_sheet_assets_ferc1',
        'calculations': [
            {'name': 'depreciation_utility_plant_in_service',
             'weight': 1.0,
             'source_table': ['utility_plant_summary_ferc1']},
            {'name': 'amortization_and_depletion_of_producing_natural_gas_land_and_land_rightsutility_plant_in_service',
                'weight': 1.0,
                'source_table': ['utility_plant_summary_ferc1']},
            {'name': 'amortization_of_underground_storage_land_and_land_rightsutility_plant_in_service',
                'weight': 1.0,
                'source_table': ['utility_plant_summary_ferc1']},
            {'name': 'amortization_of_other_utility_plant_utility_plant_in_service',
                'weight': 1.0,
                'source_table': ['utility_plant_summary_ferc1']},
            {'name': 'depreciation_amortization_and_depletion_utility_plant_in_service',
                'weight': 1.0,
                'source_table': ['utility_plant_summary_ferc1']},
            {'name': 'depreciation_amortization_and_depletion_utility_plant_leased_to_others',
                'weight': 1.0,
                'source_table': ['utility_plant_summary_ferc1']},
            {'name': 'depreciation_and_amortization_utility_plant_held_for_future_use',
                'weight': 1.0,
                'source_table': ['utility_plant_summary_ferc1']},
            {'name': 'abandonment_of_leases',
                'weight': 1.0,
                'source_table': ['utility_plant_summary_ferc1']},
            {'name': 'amortization_of_plant_acquisition_adjustment',
                'weight': 1.0,
                'source_table': ['utility_plant_summary_ferc1']}]},
    {
        'xbrl_factoid': 'utility_plant_and_construction_work_in_progress',
        'table_name': 'balance_sheet_assets_ferc1',
        'calculations': [
            {'name': 'utility_plant', 'weight': 1.0},
            {'name': 'utility_plant_in_service_classified_and_unclassified',
                'weight': 1.0,
                'source_table': ['utility_plant_summary_ferc1']},
            {'name': 'utility_plant_leased_to_others',
                'weight': 1.0,
                'source_table': ['utility_plant_summary_ferc1']},
            {'name': 'utility_plant_held_for_future_use',
                'weight': 1.0,
                'source_table': ['utility_plant_summary_ferc1']},
            {'name': 'construction_work_in_progress', 'weight': 1.0},
            {'name': 'utility_plant_acquisition_adjustment',
                'weight': 1.0,
                'source_table': ['utility_plant_summary_ferc1']}]},
    {
        'xbrl_factoid': 'nuclear_fuel_net',
        'table_name': 'balance_sheet_assets_ferc1',
        'calculations': [
            {'name': 'nuclear_fuel_materials_and_assemblies_stock_account_major_only',
             'weight': 1.0},
            {'name': 'nuclear_fuel_assemblies_in_reactor_major_only',
                'weight': 1.0},
            {'name': 'spent_nuclear_fuel_major_only', 'weight': 1.0},
            {'name': 'nuclear_fuel_in_process_of_refinement_conversion_enrichment_and_fabrication',
                'weight': 1.0},
            {'name': 'nuclear_fuel_materials_and_assemblies',
                'weight': 1.0,
                'source_table': []},
            {'name': 'spent_nuclear_fuel',
                'weight': 1.0, 'source_table': []},
            {'name': 'nuclear_fuel_under_capital_leases', 'weight': 1.0},
            {'name': 'accumulated_provision_for_amortization_of_nuclear_fuel_assemblies',
                'weight': -1.0},
            {'name': 'nuclear_fuel', 'weight': 1.0}]},
    {
        'xbrl_factoid': 'nuclear_materials_held_for_sale',
        'table_name': 'balance_sheet_assets_ferc1',
        'calculations': [
            {'name': 'nuclear_materials_held_for_sale_uranium',
             'weight': 1.0,
             'source_table': []},
            {'name': 'nuclear_materials_held_for_sale_plutonium',
                'weight': 1.0,
                'source_table': []},
            {'name': 'nuclear_materials_held_for_sale_other',
                'weight': 1.0,
                'source_table': []}]},
    {
        'xbrl_factoid': 'nuclear_fuel_in_process_of_refinement_conversion_enrichment_and_fabrication',
        'table_name': 'balance_sheet_assets_ferc1',
        'calculations': [
            {'name': 'fabrication_costs_nuclear_fuel_in_process_of_refinement_conversion_enrichment_and_fabrication',
             'weight': 1.0,
             'source_table': []},
            {'name': 'nuclear_materials_nuclear_fuel_in_process_of_refinement_conversion_enrichment_and_fabrication',
                'weight': 1.0,
                'source_table': []},
            {'name': 'allowance_for_funds_construction_nuclear_fuel_in_process_of_refinement_conversion_enrichment_and_fabrication',
                'weight': 1.0,
                'source_table': []},
            {'name': 'other_overhead_construction_costs_nuclear_fuel_in_process_of_refinement_conversion_enrichment_and_fabrication',
                'weight': 1.0,
                'source_table': []
            }
        ]
    }
]
jrea-rmi commented 1 year ago

First, reviewing income_statement_inter_table_calcs. Generally, 'sales_for_resale' and 'electricity_sales_by_rate_schedule_ferc1' detail tables aren't something we're using now, so might be useful in the future but I don't think the billed vs. unbilled components are necessary to account for now.

For the other calculations, I believe each can be edited to avoid using multiple tables:

Here's what I think the revised calculations should be for these fields:

    {
        'xbrl_factoid': 'power_production_expenses_steam_power',
        'table_name': 'electric_operating_expenses_ferc1',
        'calculations': [
            {'name': 'steam_power_generation_operations_expense', 'weight': 1.0},
            {'name': 'steam_power_generation_maintenance_expense', 'weight': 1.0}]},
    {
        'xbrl_factoid': 'power_production_expenses_hydraulic_power',
        'table_name': 'electric_operating_expenses_ferc1',
        'calculations': [
            {'name': 'hydraulic_power_generation_operations_expense',
             'weight': 1.0},
            {'name': 'hydraulic_power_generation_maintenance_expense',
             'weight': 1.0}]},
    {
        'xbrl_factoid': 'sales_to_ultimate_consumers',
        'table_name': 'electric_operating_revenues_ferc1',
        'calculations': [
            {'name': 'residential_sales', 'weight': 1.0},
            {'name': 'public_street_and_highway_lighting', 'weight': 1.0},
            {'name': 'other_sales_to_public_authorities', 'weight': 1.0},
            {'name': 'sales_to_railroads_and_railways', 'weight': 1.0},
            {'name': 'interdepartmental_sales', 'weight': 1.0},
            {'name': 'small_or_commercial_sales_electric_operating_revenue ', 'weight': 1.0},
            {'name': 'large_or_industrial_sales_electric_operating_revenue', 'weight': 1.0},]}
jrea-rmi commented 1 year ago

It appears to me that all the balance sheet table calcs reference fields that are entirely within the same table, is that right?

e-belfer commented 1 year ago

Overlaps with #2623