-
-
Notifications
You must be signed in to change notification settings - Fork 133
Integrate last 4 RUS tables #5145
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
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0246bae
draft schema and column renaming for last 4 rus tables
cmgosnell b3c1538
initial transforms of three of four tables
cmgosnell b711db6
transform the two part depreciaiton table
cmgosnell ec65635
rename depish table to be more consistent w/ ferc1
cmgosnell 99cca91
field definition -> schema migrations
cmgosnell b4bb9d6
add validations for rus7 table
cmgosnell 9049892
add rus12 util plant changes validations
cmgosnell 81d1bf6
Merge branch 'main' into rus-final
cmgosnell 7a6453b
add validations to rus12 non-utility asset tables
cmgosnell 774ceab
add rus12 depreciation misc validations
cmgosnell 36c978d
borken validations for depreciation
cmgosnell 96a4e45
depreciation changes validtions
cmgosnell 54a6926
fix field descriptions, etc, responding to pr comments
cmgosnell 437f983
final validation fixes
cmgosnell 7a2862d
ahhhhhh i mixed up less then with greater than when will my dyslexic …
cmgosnell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
dbt/models/rus12/core_rus12__yearly_depreciation_changes/schema.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| version: 2 | ||
| sources: | ||
| - name: pudl | ||
| tables: | ||
| - name: core_rus12__yearly_depreciation_changes | ||
| data_tests: | ||
| - expect_columns_not_all_null | ||
| - check_row_counts_per_partition: | ||
| arguments: | ||
| table_name: core_rus12__yearly_depreciation_changes | ||
| partition_expr: "EXTRACT(YEAR FROM report_date)" | ||
| - dbt_utils.expression_is_true: | ||
| arguments: | ||
| expression: accruals + retirements_less_net_salvage + adjustments_and_transfers <= ending_balance | ||
| config: | ||
| error_if: ">18" | ||
| where: depreciation_and_amortization_item != 'retirement_work_in_progress' | ||
| description: "Check that annual changes don't exceed ending balance." | ||
| - subcomponents_sum_to_total: | ||
| arguments: | ||
| group_by_columns: [borrower_id_rus, report_date] | ||
| categorical_column: depreciation_and_amortization_group | ||
| value_column: accruals | ||
| total_label: "total_depreciation" | ||
| row_condition: depreciation_and_amortization_group='electric_plant_in_service' | ||
| description: "Check the totals for all of the depreciation_and_amortization_group's that are just the sum of the components." | ||
| - subcomponents_sum_to_total: | ||
| arguments: | ||
| group_by_columns: [borrower_id_rus, report_date] | ||
| categorical_column: depreciation_and_amortization_group | ||
| value_column: retirements_less_net_salvage | ||
| total_label: "total_depreciation" | ||
| row_condition: depreciation_and_amortization_group='electric_plant_in_service' | ||
| description: "Check the totals for all of the depreciation_and_amortization_group's that are just the sum of the components." | ||
| - subcomponents_sum_to_total: | ||
| arguments: | ||
| group_by_columns: [borrower_id_rus, report_date] | ||
| categorical_column: depreciation_and_amortization_group | ||
| value_column: adjustments_and_transfers | ||
| total_label: "total_depreciation" | ||
| row_condition: depreciation_and_amortization_group='electric_plant_in_service' | ||
| description: "Check the totals for all of the depreciation_and_amortization_group's that are just the sum of the components." | ||
| - subcomponents_sum_to_total: | ||
| arguments: | ||
| group_by_columns: [borrower_id_rus, report_date] | ||
| categorical_column: depreciation_and_amortization_group | ||
| value_column: ending_balance | ||
| total_label: "total_depreciation" | ||
| row_condition: depreciation_and_amortization_group='electric_plant_in_service' | ||
| description: "Check the totals for all of the depreciation_and_amortization_group's that are just the sum of the components." | ||
| columns: | ||
| - name: report_date | ||
| - name: borrower_id_rus | ||
| - name: depreciation_and_amortization_group | ||
| - name: depreciation_and_amortization_item | ||
| - name: composite_depreciation_rate | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| max_value: 100.0 | ||
| row_condition: depreciation_and_amortization_item !='retirement_work_in_progress' | ||
| config: | ||
| error_if: ">1" | ||
| description: "Check that most of the composite_depreciation_rate's within 0-100." | ||
| - name: accruals | ||
| - name: retirements_less_net_salvage | ||
| - name: adjustments_and_transfers | ||
| - name: ending_balance | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| row_condition: depreciation_and_amortization_item !='retirement_work_in_progress' | ||
| config: | ||
| error_if: ">34" | ||
| description: "Check that most of the ending_balance's are positive - excluding the retirement_work_in_progress." | ||
| - name: is_total |
23 changes: 23 additions & 0 deletions
23
dbt/models/rus12/core_rus12__yearly_depreciation_misc/schema.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| version: 2 | ||
| sources: | ||
| - name: pudl | ||
| tables: | ||
| - name: core_rus12__yearly_depreciation_misc | ||
| data_tests: | ||
| - expect_columns_not_all_null | ||
| - check_row_counts_per_partition: | ||
| arguments: | ||
| table_name: core_rus12__yearly_depreciation_misc | ||
| partition_expr: "EXTRACT(YEAR FROM report_date)" | ||
| columns: | ||
| - name: report_date | ||
| - name: borrower_id_rus | ||
| - name: depreciation_and_amortization_item | ||
| - name: ending_balance | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| config: | ||
| error_if: ">126" | ||
| description: "Check that most of the ending_balance's are positive. About 4% of the table is negative, which seems reasonable." |
43 changes: 43 additions & 0 deletions
43
dbt/models/rus12/core_rus12__yearly_non_utility_plant_changes/schema.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| version: 2 | ||
| sources: | ||
| - name: pudl | ||
| tables: | ||
| - name: core_rus12__yearly_non_utility_plant_changes | ||
| data_tests: | ||
| - expect_columns_not_all_null | ||
| - check_row_counts_per_partition: | ||
| arguments: | ||
| table_name: core_rus12__yearly_non_utility_plant_changes | ||
| partition_expr: "EXTRACT(YEAR FROM report_date)" | ||
| - dbt_utils.expression_is_true: | ||
| arguments: | ||
| expression: retirements + additions + adjustments_and_transfers <= ending_balance | ||
| description: "Check that annual changes don't exceed ending balance." | ||
| config: | ||
| error_if: ">2" | ||
| columns: | ||
| - name: report_date | ||
| - name: borrower_id_rus | ||
| - name: non_utility_plant_item | ||
| - name: additions | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| config: | ||
| error_if: ">1" | ||
| description: "Check that most of the additions are positive." | ||
| - name: retirements | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| config: | ||
| error_if: ">1" | ||
| description: "Check that most of the retirements are positive." | ||
| - name: adjustments_and_transfers | ||
| - name: ending_balance | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 |
81 changes: 81 additions & 0 deletions
81
dbt/models/rus12/core_rus12__yearly_utility_plant_changes/schema.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| version: 2 | ||
| sources: | ||
| - name: pudl | ||
| tables: | ||
| - name: core_rus12__yearly_utility_plant_changes | ||
| data_tests: | ||
| - expect_columns_not_all_null | ||
| - check_row_counts_per_partition: | ||
| arguments: | ||
| table_name: core_rus12__yearly_utility_plant_changes | ||
| partition_expr: "EXTRACT(YEAR FROM report_date)" | ||
| - subcomponents_sum_to_total: | ||
| arguments: | ||
| group_by_columns: [borrower_id_rus, report_date] | ||
| categorical_column: utility_plant_group | ||
| value_column: retirements | ||
| total_label: "total" | ||
| row_condition: utility_plant_group NOT IN ('electric_plant_in_service', 'utility_plant_in_service', 'total_utility_plant') | ||
| description: "Check the totals for all of the utility_plant_group's that are just the sum of the components." | ||
| - subcomponents_sum_to_total: | ||
| arguments: | ||
| group_by_columns: [borrower_id_rus, report_date] | ||
| categorical_column: utility_plant_group | ||
| value_column: additions | ||
| total_label: "total" | ||
| row_condition: utility_plant_group NOT IN ('electric_plant_in_service', 'utility_plant_in_service', 'total_utility_plant') | ||
| description: "Check the totals for all of the utility_plant_group's that are just the sum of the components." | ||
| - subcomponents_sum_to_total: | ||
| arguments: | ||
| group_by_columns: [borrower_id_rus, report_date] | ||
| categorical_column: utility_plant_group | ||
| value_column: adjustments_and_transfers | ||
| total_label: "total" | ||
| row_condition: utility_plant_group NOT IN ('electric_plant_in_service', 'utility_plant_in_service', 'total_utility_plant') | ||
| description: "Check the totals for all of the utility_plant_group's that are just the sum of the components." | ||
| - subcomponents_sum_to_total: | ||
| arguments: | ||
| group_by_columns: [borrower_id_rus, report_date] | ||
| categorical_column: utility_plant_group | ||
| value_column: ending_balance | ||
| total_label: "total" | ||
| row_condition: utility_plant_group NOT IN ('electric_plant_in_service', 'utility_plant_in_service', 'total_utility_plant') | ||
| description: "Check the totals for all of the utility_plant_group's that are just the sum of the components." | ||
| - dbt_utils.expression_is_true: | ||
| arguments: | ||
| expression: retirements + additions + adjustments_and_transfers <= ending_balance | ||
| description: "Check that annual changes don't exceed ending balance." | ||
| config: | ||
| error_if: ">72" | ||
| columns: | ||
| - name: report_date | ||
| - name: borrower_id_rus | ||
| - name: utility_plant_group | ||
| - name: utility_plant_item | ||
| - name: retirements | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| config: | ||
| error_if: ">21" | ||
| description: "Check that most of the retirements are positive." | ||
| - name: additions | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| row_condition: utility_plant_item!='construction_work_in_progress' | ||
| config: | ||
| error_if: ">199" | ||
| description: "Check that most of the additions are positive - expect construction_work_in_progress. This is about 1% of the table." | ||
| - name: adjustments_and_transfers | ||
| - name: ending_balance | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| config: | ||
| error_if: ">19" | ||
| description: "Check that most of the ending balances are positive." | ||
| - name: is_total | ||
80 changes: 80 additions & 0 deletions
80
dbt/models/rus12/out_rus12__yearly_depreciation_changes/schema.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| version: 2 | ||
| sources: | ||
| - name: pudl | ||
| tables: | ||
| - name: out_rus12__yearly_depreciation_changes | ||
| data_tests: | ||
| - expect_columns_not_all_null | ||
| - check_row_counts_per_partition: | ||
| arguments: | ||
| table_name: out_rus12__yearly_depreciation_changes | ||
| partition_expr: "EXTRACT(YEAR FROM report_date)" | ||
| - dbt_utils.expression_is_true: | ||
| arguments: | ||
| expression: accruals + retirements_less_net_salvage + adjustments_and_transfers <= ending_balance | ||
| config: | ||
| error_if: ">18" | ||
| where: depreciation_and_amortization_item != 'retirement_work_in_progress' | ||
| description: "Check that annual changes don't exceed ending balance." | ||
| - subcomponents_sum_to_total: | ||
| arguments: | ||
| group_by_columns: [borrower_id_rus, report_date] | ||
| categorical_column: depreciation_and_amortization_group | ||
| value_column: accruals | ||
| total_label: "total_depreciation" | ||
| row_condition: depreciation_and_amortization_group='electric_plant_in_service' | ||
| description: "Check the totals for all of the depreciation_and_amortization_group's that are just the sum of the components." | ||
| - subcomponents_sum_to_total: | ||
| arguments: | ||
| group_by_columns: [borrower_id_rus, report_date] | ||
| categorical_column: depreciation_and_amortization_group | ||
| value_column: retirements_less_net_salvage | ||
| total_label: "total_depreciation" | ||
| row_condition: depreciation_and_amortization_group='electric_plant_in_service' | ||
| description: "Check the totals for all of the depreciation_and_amortization_group's that are just the sum of the components." | ||
| - subcomponents_sum_to_total: | ||
| arguments: | ||
| group_by_columns: [borrower_id_rus, report_date] | ||
| categorical_column: depreciation_and_amortization_group | ||
| value_column: adjustments_and_transfers | ||
| total_label: "total_depreciation" | ||
| row_condition: depreciation_and_amortization_group='electric_plant_in_service' | ||
| description: "Check the totals for all of the depreciation_and_amortization_group's that are just the sum of the components." | ||
| - subcomponents_sum_to_total: | ||
| arguments: | ||
| group_by_columns: [borrower_id_rus, report_date] | ||
| categorical_column: depreciation_and_amortization_group | ||
| value_column: ending_balance | ||
| total_label: "total_depreciation" | ||
| row_condition: depreciation_and_amortization_group='electric_plant_in_service' | ||
| description: "Check the totals for all of the depreciation_and_amortization_group's that are just the sum of the components." | ||
| columns: | ||
| - name: report_date | ||
| - name: borrower_id_rus | ||
| - name: borrower_name_rus | ||
| - name: state | ||
| - name: depreciation_and_amortization_group | ||
| - name: depreciation_and_amortization_item | ||
| - name: composite_depreciation_rate | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| max_value: 100.0 | ||
| row_condition: depreciation_and_amortization_item !='retirement_work_in_progress' | ||
| config: | ||
| error_if: ">1" | ||
| description: "Check that most of the composite_depreciation_rate's within 0-100." | ||
| - name: accruals | ||
| - name: retirements_less_net_salvage | ||
| - name: adjustments_and_transfers | ||
| - name: ending_balance | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| row_condition: depreciation_and_amortization_item !='retirement_work_in_progress' | ||
| config: | ||
| error_if: ">34" | ||
| description: "Check that most of the ending_balance's are positive - excluding the retirement_work_in_progress." | ||
| - name: is_total |
25 changes: 25 additions & 0 deletions
25
dbt/models/rus12/out_rus12__yearly_depreciation_misc/schema.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| version: 2 | ||
| sources: | ||
| - name: pudl | ||
| tables: | ||
| - name: out_rus12__yearly_depreciation_misc | ||
| data_tests: | ||
| - expect_columns_not_all_null | ||
| - check_row_counts_per_partition: | ||
| arguments: | ||
| table_name: out_rus12__yearly_depreciation_misc | ||
| partition_expr: "EXTRACT(YEAR FROM report_date)" | ||
| columns: | ||
| - name: report_date | ||
| - name: borrower_id_rus | ||
| - name: borrower_name_rus | ||
| - name: state | ||
| - name: depreciation_and_amortization_item | ||
| - name: ending_balance | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| config: | ||
| error_if: ">126" | ||
| description: "Check that most of the ending_balance's are positive. About 4% of the table is negative, which seems reasonable." |
45 changes: 45 additions & 0 deletions
45
dbt/models/rus12/out_rus12__yearly_non_utility_plant_changes/schema.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| version: 2 | ||
| sources: | ||
| - name: pudl | ||
| tables: | ||
| - name: out_rus12__yearly_non_utility_plant_changes | ||
| data_tests: | ||
| - expect_columns_not_all_null | ||
| - check_row_counts_per_partition: | ||
| arguments: | ||
| table_name: out_rus12__yearly_non_utility_plant_changes | ||
| partition_expr: "EXTRACT(YEAR FROM report_date)" | ||
| - dbt_utils.expression_is_true: | ||
| arguments: | ||
| expression: retirements + additions + adjustments_and_transfers <= ending_balance | ||
| description: "Check that annual changes don't exceed ending balance." | ||
| config: | ||
| error_if: ">2" | ||
| columns: | ||
| - name: report_date | ||
| - name: borrower_id_rus | ||
| - name: borrower_name_rus | ||
| - name: state | ||
| - name: non_utility_plant_item | ||
| - name: additions | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| config: | ||
| error_if: ">1" | ||
| description: "Check that most of the additions are positive." | ||
| - name: retirements | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 | ||
| config: | ||
| error_if: ">1" | ||
| description: "Check that most of the retirements are positive." | ||
| - name: adjustments_and_transfers | ||
| - name: ending_balance | ||
| data_tests: | ||
| - dbt_expectations.expect_column_values_to_be_between: | ||
| arguments: | ||
| min_value: 0.0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.