Skip to content

Create-tableau-dashboard-based-on-iasworld-tests - #1093

Open
Damonamajor wants to merge 12 commits into
masterfrom
1088-create-tableau-dashboard-based-on-iasworld-tests
Open

Create-tableau-dashboard-based-on-iasworld-tests#1093
Damonamajor wants to merge 12 commits into
masterfrom
1088-create-tableau-dashboard-based-on-iasworld-tests

Conversation

@Damonamajor

@Damonamajor Damonamajor commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

This is the query that I have been using to test. It seems like it gets updated pretty frequently, so although it passessed yesterday, it is failing today. Here's an example of a PIN which fails in this query, but has updated info for matching class_equals_luc: Parid 25343080220000

image
WITH view_rows AS (
    SELECT test_name, parid, taxyr
    FROM z_ci_1088_create_tableau_dashboard_based_on_iasworld_tests_qc.vw_report_iasworld_test_pardat
),
test_failure_rows AS (
    SELECT 'iasworld_pardat_adrno_length_lte_5' AS test_name, parid, taxyr
    FROM z_dev_damajor_test_failure.iasworld_pardat_adrno_length_lte_5
    UNION ALL
    SELECT 'iasworld_pardat_class_equals_luc', parid, taxyr
    FROM z_dev_damajor_test_failure.iasworld_pardat_class_equals_luc
    UNION ALL
    SELECT 'iasworld_pardat_cur_in_accepted_values', parid, taxyr
    FROM z_dev_damajor_test_failure.iasworld_pardat_cur_in_accepted_values
    UNION ALL
    SELECT 'iasworld_pardat_nbhd_matches_legdat_township', parid, taxyr
    FROM z_dev_damajor_test_failure.iasworld_pardat_nbhd_matches_legdat_township
    UNION ALL
    SELECT 'iasworld_pardat_nbhd_matches_spatial_town_nbhd', parid, taxyr
    FROM z_dev_damajor_test_failure.iasworld_pardat_nbhd_matches_spatial_town_nbhd
    UNION ALL
    SELECT 'iasworld_pardat_seq_all_sequential_exist', parid, taxyr
    FROM z_dev_damajor_test_failure.iasworld_pardat_seq_all_sequential_exist
    UNION ALL
    SELECT 'iasworld_pardat_unique_by_parid_taxyr', parid, taxyr
    FROM z_dev_damajor_test_failure.iasworld_pardat_unique_by_parid_taxyr
)
SELECT
    COALESCE(v.test_name, f.test_name) AS test_name,
    COALESCE(v.parid, f.parid) AS parid,
    COALESCE(v.taxyr, f.taxyr) AS taxyr,
    CASE
        WHEN v.parid IS NULL THEN 'only in old failures'
        WHEN f.parid IS NULL THEN 'only in new failures'
    END AS source
FROM view_rows v
FULL OUTER JOIN test_failure_rows f
    ON v.test_name = f.test_name
    AND v.parid = f.parid
    AND v.taxyr = f.taxyr
WHERE v.parid IS NULL OR f.parid IS NULL
ORDER BY parid, test_name

I'm not sure this is exactly the structure you wanted. It doesn't create an individual view for each of the subqueries, but that also feels like a lot to mantain, document, etc.. For me a single view makes the most sense, but happy to reconfigure it based on your feedback.

I also left out this section until we get a solid grasp on what we want

Note that there are a few scattered QC views that have iasWorld tests defined on their schema, namely qc.vw_iasworld_sales_, qc.vw_report_town_close_res_parcels_not_set_to_cost_approach, qc.vw_neg_asmt_value, and reporting.vw_pin_value_long. It would be best to try to move these tests into the qc.vw_report_iasworld_test_ view for whichever table is most important in the test, but I haven't looked at these tests in detail, so I don't have a sense of how hard that will be. In the worst case scenario, it's fine to continue using these views as the basis for the new table definitions.

It also doesn't union all iasworld views since we are only testing a single one first.

@Damonamajor Damonamajor linked an issue Aug 18, 2026 that may be closed by this pull request
@Damonamajor Damonamajor changed the title WIP Create-tableau-dashboard-based-on-iasworld-tests Aug 19, 2026
@Damonamajor
Damonamajor marked this pull request as ready for review August 19, 2026 14:51
@Damonamajor
Damonamajor requested a review from a team as a code owner August 19, 2026 14:51
@Damonamajor

Damonamajor commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

I'm not sure this is exactly the structure you wanted. It doesn't create an individual view for each of the subqueries, but that also feels like a lot to mantain, document, etc.. For me a single view makes the most sense, but happy to reconfigure it based on your feedback.

I also left out this section until we get a solid grasp on what we want

Note that there are a few scattered QC views that have iasWorld tests defined on their schema, namely qc.vw_iasworld_sales_, qc.vw_report_town_close_res_parcels_not_set_to_cost_approach, qc.vw_neg_asmt_value, and reporting.vw_pin_value_long. It would be best to try to move these tests into the qc.vw_report_iasworld_test_ view for whichever table is most important in the test, but I haven't looked at these tests in detail, so I don't have a sense of how hard that will be. In the worst case scenario, it's fine to continue using these views as the basis for the new table definitions.

It also doesn't union all iasworld views since we are only testing a single one first.

FROM {{ source('spatial', 'neighborhood') }}
),

pardat_seq AS (

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

named like this due to sequential tests.

ARRAY['adrno'],
ARRAY[CAST(pardat.adrno AS VARCHAR)]
) AS additional_fields
FROM {{ source('iasworld', 'pardat') }} AS pardat

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can pull the from pardat into it's own object and remove this from each query as well

        AND pardat.cur = 'Y'
        AND pardat.deactivat IS NULL

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did this, I think it makes it easier to follow.

pardat.parid,
CAST(NULL AS INTEGER) AS card,
CAST(NULL AS INTEGER) AS lline,
legdat.township_code,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We often only need the join for township code, which should be deriveable from class, but we are also getting some errors for tests based on this. Let me know if we want this join for each. We can also move it up to the CTE.

LEFT JOIN distinct_town_nbhd
ON pardat.nbhd = distinct_town_nbhd.town_nbhd
WHERE distinct_town_nbhd.town_nbhd IS NULL
AND pardat.nbhd NOT LIKE '%999'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this in both nbhd queries, it seems only in this one and not the previous one

pardat.who,
pardat.wen,
MAP(
ARRAY['luc'],

@Damonamajor Damonamajor Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already select class as one of our base columns. Do we want it as additional too? This goes for class or township values.

SELECT
'iasworld_pardat_cur_in_accepted_values' AS test_name,
'cur should be ''Y'' or ''D''' AS test_description,
CAST(NULL AS VARCHAR) AS test_category,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all of the tests have a value for meta.category

@jeancochrane jeancochrane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice start here! I think the fundamentals of this approach are correct, and the output looks good.

That being said, it feels to me like this implementation might end up requiring a lot of repetitive boilerplate that could become difficult to maintain, i.e. a separate subquery for each individual test that needs to select the same set of columns in the same exact way. I thought it might be interesting to factor out as much of the boilerplate as possible into a shared macro, and I ended up producing a follow-up PR implementing that approach (#1095). Take a look at that PR and let me know if you think it's prohibitively confusing; if the macro stuff is impossible to understand, I'm down to continue forward with the more boilerplate-heavy approach we have here, and only refactor to a macro approach if/when it becomes unwieldy.

@Damonamajor

Copy link
Copy Markdown
Contributor Author

Very nice start here! I think the fundamentals of this approach are correct, and the output looks good.

That being said, it feels to me like this implementation might end up requiring a lot of repetitive boilerplate that could become difficult to maintain, i.e. a separate subquery for each individual test that needs to select the same set of columns in the same exact way. I thought it might be interesting to factor out as much of the boilerplate as possible into a shared macro, and I ended up producing a follow-up PR implementing that approach (#1095). Take a look at that PR and let me know if you think it's prohibitively confusing; if the macro stuff is impossible to understand, I'm down to continue forward with the more boilerplate-heavy approach we have here, and only refactor to a macro approach if/when it becomes unwieldy.

I'll take a look through it tomorrow, but it seems like a more efficient system.

* Sketch out alernate proposal for iasWorld test result view architecture

* Second draft of iasWorld test result view proposal, using macro

* Fix typo in name of pardat.nbhd test

* Small edits to macro approach based on pre-review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Tableau dashboard based on iasWorld tests

2 participants