GreenInfo-Network / seattle-building-dashboard

Energy benchmarking for Seattle
https://greeninfo-network.github.io/seattle-building-dashboard/
ISC License
1 stars 0 forks source link

Trim property_type #71

Closed tomay closed 9 months ago

tomay commented 9 months ago

Some of these include a newline, so they end up twice in the picklist, and the behavior when selecting one of these is all around broken:

image

image

image

tomay commented 9 months ago

Hmm, I'm not really sure what to do about this. If we trim() every field, that's 62 * 3663 227,106 operations, which is a lot to do before the page loads.

We could: a) Only trim() property_type, since we know this has a problem , and hope that no other raw values create issues b) Ask Mike not to include newlines upstream (somehow) c) Fix the data in place on CARTO, so we don't have to wait for another deploy to get this fix in place

I'm thinking we should do a, b, and c

tomay commented 9 months ago

For the data cleanup in CARTO, you can see the issue with the following SQL:

SELECT count(*) FROM public.seattle_buildings_2021_update where year = 2021 and property_type LIKE 'Distribution Center%'
=> 47
SELECT count(*) FROM public.seattle_buildings_2021_update where year = 2021 and property_type = 'Distribution Center'
=> 3

2021 is the only year that has this issue

So we can fix it with:

UPDATE public.seattle_buildings_2021_update set property_type = 'Distribution Center' where year = 2021 and property_type LIKE 'Distribution Center%'
tomay commented 9 months ago

For now I've fixed the data on CARTO, and have logged a question with Mike to ask if we can avoid introducing these errors in the future. I will only add in a trim step, if it seems that there is no upstream solution