Skip to content

Count building PINs correctly - #26

Merged
wrridgeway merged 1 commit into
mainfrom
improve-building-pin-count
Oct 22, 2026
Merged

wrridgeway merged 1 commit into
mainfrom
improve-building-pin-count

Conversation

@wrridgeway

@wrridgeway wrridgeway commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

My last iteration of this output counted the number of building units that would appear in the output, rather than the total number of units that are actually in a condo building. This PR fixes the count, but also shifts from units to PINs, just to make sure there's no confusion as to what's being counted.

Updated output here: O:\CCAODATA\recurring-data-requests\condo-chars-prep\output\city_condo_review_2026.xlsx

Comment on lines +4 to +15
WITH pins AS (
SELECT
SUBSTR(parid, 1, 10) AS pin10,
taxyr AS year,
COUNT(*) AS pins
FROM iasworld.pardat
WHERE cur = 'Y'
AND deactivat IS NULL
GROUP BY
SUBSTR(parid, 1, 10),
taxyr
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Unfortunately none of the views we join on already include a PIN or unit count, and window functions are slow, so I decided to use pardat to make this calculation as resource light as possible.

@wrridgeway wrridgeway self-assigned this Oct 21, 2026
@wrridgeway
wrridgeway marked this pull request as ready for review October 21, 2026 18:42
@wrridgeway
wrridgeway requested a review from a team as a code owner October 21, 2026 18:42

@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.

Makes sense, thank you!

@wrridgeway
wrridgeway merged commit 3a62a41 into main Oct 22, 2026
3 checks passed
@wrridgeway
wrridgeway deleted the improve-building-pin-count branch October 22, 2026 15:00
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.

2 participants