Skip to content

Switch attribute source for parcel shapefiles - #1125

Merged
wrridgeway merged 3 commits into
masterfrom
update-parcel-attribute-sourcing
Nov 5, 2026
Merged

wrridgeway merged 3 commits into
masterfrom
update-parcel-attribute-sourcing

Conversation

@wrridgeway

@wrridgeway wrridgeway commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

This PR moves us away from the old attributes source since our current system (ias) of record seems to agree much better with tax district data from other county sources. This testing was originally performed in #1100.

-- Use ptaxsim as our "truth"
with tax as (
	select distinct substr(pin, 1, 10) as pin10,
		year,
		tax_code_num as truth
	from tax.pin
),
diffs as (
	select new.pin10,
		new.year,
		new.tax_code as new,
		old.tax_code as old,
		pins.truth as truth,
		case
			when new.tax_code != pins.truth
			and old.tax_code != pins.truth then 'both'
			-- Assume null tax codes are incorrect
			when (
				(
					new.tax_code != pins.truth
					or new.tax_code is null
				)
				and old.tax_code = pins.truth
			) then 'new'
			when (
				(
					old.tax_code != pins.truth
					or old.tax_code is null
				)
				and new.tax_code = pins.truth
			) then 'old'
		end as which_is_wrong
	from z_dev_wridgeway_spatial.parcel as new
		left join spatial.parcel as old on new.pin10 = old.pin10
		and new.year = old.year
		inner join tax as pins on new.pin10 = pins.pin10
		and new.year = pins.year
	where (new.tax_code != old.tax_code)
		or (
			new.tax_code is null
			and old.tax_code is not null
		)
		or (
			new.tax_code is not null
			and old.tax_code is null
		)
)
select which_is_wrong,
	count() as parcels
from diffs
group by which_is_wrong
WhichIsWrong Parcels
old 530127
new 416
both 90

@wrridgeway
wrridgeway marked this pull request as ready for review November 5, 2026 20:50
@wrridgeway
wrridgeway requested a review from a team as a code owner November 5, 2026 20:50

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

As someone who never successfully figured out how to connect to the SQL server, I'm happy about this.

wrridgeway and others added 2 commits November 5, 2026 15:43
Co-authored-by: Jean Cochrane <jeancochrane@users.noreply.github.com>
Co-authored-by: Jean Cochrane <jeancochrane@users.noreply.github.com>
@wrridgeway
wrridgeway merged commit 7014a3f into master Nov 5, 2026
11 checks passed
@wrridgeway
wrridgeway deleted the update-parcel-attribute-sourcing branch November 5, 2026 22:51
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