Skip to content

Commit

Permalink
add dependencies, rename from importance to order
Browse files Browse the repository at this point in the history
  • Loading branch information
owades committed Jun 23, 2023
1 parent 4ac0c07 commit cf954c5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ config(materialized='ephemeral') }}

WITH stg_gtfs_quality__intended_checks AS (
SELECT {{ static_feed_downloaded_successfully() }} AS check, {{ compliance_schedule() }} AS feature, {{ schedule_url() }} AS entity, false AS is_manual, 1 AS reports_importance
SELECT {{ static_feed_downloaded_successfully() }} AS check, {{ compliance_schedule() }} AS feature, {{ schedule_url() }} AS entity, false AS is_manual, 1 AS reports_order
UNION ALL
SELECT {{ no_validation_errors() }}, {{ compliance_schedule() }}, {{ schedule_feed() }}, false, 2
UNION ALL
Expand Down

0 comments on commit cf954c5

Please sign in to comment.