-
Notifications
You must be signed in to change notification settings - Fork 4
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
Integrate mydec sales into vw_pin_sale #588
base: master
Are you sure you want to change the base?
Integrate mydec sales into vw_pin_sale #588
Conversation
) | ||
/* Some sales in mydec have multiple rows for one pin on a given sale date. | ||
Sometimes they have different dates than iasworld prior to 2021 and when | ||
joined back onto unique_sales will create duplicates by pin/sale date. */ | ||
WHERE num_single_day_sales = 1 | ||
OR (YEAR(mydec_date) > 2020) | ||
OR (YEAR(sale_date) > 2020) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably just use the year column we create in the inner query, huh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in this change makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in we define year
a few lines above this, let's just use that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's take care of this before we merge.
Just gonna nibble around the edges on this for the first bite. I'll look at the data and inspect the filters once this round of changes is made. |
Impressively mouthy sentence |
) | ||
/* Some sales in mydec have multiple rows for one pin on a given sale date. | ||
Sometimes they have different dates than iasworld prior to 2021 and when | ||
joined back onto unique_sales will create duplicates by pin/sale date. */ | ||
WHERE num_single_day_sales = 1 | ||
OR (YEAR(mydec_date) > 2020) | ||
OR (YEAR(sale_date) > 2020) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's take care of this before we merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few tiny suggestions, we're really close.
Co-authored-by: William Ridgeway <10358980+wrridgeway@users.noreply.github.com>
This PR uses brings in mydec sales into
default.vw_pin_sale
only if thedoc_no
does not already exist in iasworld. We coalesce columns with priority given to iasworld, and add a new column calledsource
which lets us know which table the sale was pulled from; iasworld or mydec.If a mydec
doc_no
does not exist in iasworld, but does exist in mydec, we will bring that sale into this view. If thedoc_no
exists in both tables we will use the iasworlddoc_no
.We (discussed with @jeancochrane ) also changed the error threshold for the this test since we are letting in a bunch of sales that were previously no longer in iasworld. It pushes the test failures from 3997 to 4600.
We will need to make a large amount of PRs in other repos to accommodate this. Most likely a bunch of
where source ='iasworld'
filters.View at
FROM z_ci_583_create_a_sales_view_that_combines_iasworld_mydec_and_ccrd_sales_default.vw_pin_sale
Quick integrity checks
Total counts
Filter deed type
Filter same sale within 365 days
This figure is different because after a talk with Billy it was decided that we should be
using doc_no's from mydec in the calculation of this filter even for ias
doc_no
observations.is_mydec_date
checkSales by year counts