Skip to content

Commit

Permalink
Add reports order (#2768)
Browse files Browse the repository at this point in the history
* add reports_importance value for each check

* add dependencies, rename from importance to order
  • Loading branch information
owades authored Jun 26, 2023
1 parent 7701d97 commit 5789e4f
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ models:
Boolean flag for whether the associated check was performed by hand (via Airtable) or automatically.
tests:
- not_null
- name: reports_order
description: |
Integer value that declares which order a given check should appear on the reports site. It can be null for checks that don't appear on the reports site.
# Index tables

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cross_join AS (
feature,
entity,
is_manual,
reports_order,

organization_source_record_id,
service_source_record_id,
Expand Down Expand Up @@ -93,6 +94,7 @@ int_gtfs_quality__guideline_checks_index AS (
feature,
entity,
is_manual,
reports_order,

organization_source_record_id,
service_source_record_id,
Expand Down
5 changes: 5 additions & 0 deletions warehouse/models/mart/gtfs_quality/_mart_gtfs_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ models:
Boolean flag for whether the associated check was performed by hand (via Airtable) or automatically.
tests:
- not_null
- &reports_order
name: reports_order
description: |
Integer value that declares which order a given check should appear on the reports site. It can be null for checks that don't appear on the reports site.
- name: fct_daily_service_combined_guideline_checks
description: |
**Documentation coming soon**
Expand Down Expand Up @@ -229,6 +233,7 @@ models:
- *status
- name: feature
- *is_manual
- *reports_order
- name: fct_schedule_feed_files
description: |
All files found in zipfiles downloaded in the GTFS schedule v2 pipeline.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fct_daily_organization_combined_guideline_checks AS (
feature,
check,
is_manual,
reports_order,
{{ guidelines_aggregation_logic() }} as status,
{{ guidelines_aggregation_logic_reports() }} as reports_status,
organization_key,
Expand All @@ -29,7 +30,7 @@ fct_daily_organization_combined_guideline_checks AS (
ARRAY_AGG(DISTINCT gtfs_dataset_key IGNORE NULLS ORDER BY gtfs_dataset_key) AS gtfs_dataset_keys_included_array,
ARRAY_AGG(DISTINCT schedule_feed_key IGNORE NULLS ORDER BY schedule_feed_key) AS schedule_feed_keys_included_array
FROM int_gtfs_quality__guideline_checks_long
GROUP BY date, organization_key, organization_source_record_id, organization_name, feature, check, is_manual
GROUP BY date, organization_key, organization_source_record_id, organization_name, feature, check, is_manual, reports_order
)

SELECT * FROM fct_daily_organization_combined_guideline_checks
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fct_daily_service_combined_guideline_checks AS (
feature,
check,
is_manual,
reports_order,
{{ guidelines_aggregation_logic() }} as status,
{{ guidelines_aggregation_logic_reports() }} as reports_status,
service_key,
Expand All @@ -28,7 +29,7 @@ fct_daily_service_combined_guideline_checks AS (
ARRAY_AGG(DISTINCT gtfs_dataset_key IGNORE NULLS ORDER BY gtfs_dataset_key) AS gtfs_dataset_keys_included_array,
ARRAY_AGG(DISTINCT schedule_feed_key IGNORE NULLS ORDER BY schedule_feed_key) AS schedule_feed_keys_included_array
FROM int_gtfs_quality__guideline_checks_long
GROUP BY date, service_key, service_name, feature, check, is_manual
GROUP BY date, service_key, service_name, feature, check, is_manual, reports_order
)

SELECT * FROM fct_daily_service_combined_guideline_checks
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ checks AS (
check,
reports_status,
is_manual,
reports_order,
FROM {{ ref('fct_daily_organization_combined_guideline_checks') }}
-- This filtering is temporary, and could also be done further downstream:
WHERE feature = {{ compliance_schedule() }}
Expand Down Expand Up @@ -44,7 +45,8 @@ fct_monthly_reports_site_organization_guideline_checks AS (
checks.feature,
checks.check,
checks.reports_status,
checks.is_manual
checks.is_manual,
checks.reports_order
FROM idx_monthly_reports_site AS idx
LEFT JOIN generate_biweekly_dates AS dates
USING (publish_date)
Expand Down
Loading

0 comments on commit 5789e4f

Please sign in to comment.