GreenInfo-Network / nyc-crash-mapper-chart-view

Chart view for NYC Crash Mapper that allows for viewing Trends, Comparing, and Ranking of various NYC geographies
http://vis.crashmapper.org
MIT License
2 stars 1 forks source link

Intersections data: pretty the names #77

Closed gregallensworth closed 6 years ago

gregallensworth commented 6 years ago

Relevant to #73, some data thoughts:

The intersections in the nyc_intersections table, their names are visually overbearing: WASHINGTON STREET & OAK AVENUE

To what degree could these be made easier on the eyes?

As always, it's never quite so easy to Title Case things, as there are intentional outliers: "MLK" and "USA" should be all caps, while "McColough" and "O'Brian" are intentionally mixed-case. This could be a significantly larger project to vet names and correct them individually...

danrademacher commented 6 years ago

Client says just make the boroughs uppercase so everything matches. Don't try for sentence case. Maybe just do this with CSS?

danrademacher commented 6 years ago

Client requested abbreviations without knowing it was on our list of potential needs. Her words:

Ranking : is it possible to abbreviate avenue, place, street and boulevard and not capitalize the abbreviation? Also East and West should be E and W

I'm a little thrown by "not capitalize the abbreviation" -- seems like we should go all caps or sentence case. So let's stick with all caps for now

gregallensworth commented 6 years ago

This is coming along slowly but surely.

First set of queries: define street1 and street2 fields, and populate them.

ALTER TABLE nyc_intersections ADD COLUMN street1 VARCHAR(40)
ALTER TABLE nyc_intersections ADD COLUMN street1 VARCHAR(40) 

UPDATE nyc_intersections SET street1=split_part(name, ' & ', 1)
UPDATE nyc_intersections SET street2=split_part(name, ' & ', 2)

The queries to actually do the renaming, are in the file attached. They cover the W S E N SE SW NE NW suffixes, and the street names so far detected in the data. They also cover a few common abbreviations. sql_queries_for_street_names.txt

Sadly, the way to apply these SQL queries is via the CARTo web UI, where you copy, alt-tab, paste, alt-tab, copy, ...

Notes:

gregallensworth commented 6 years ago

Then of course, the final touch after correcting street name & suffix, and then street prefix, ... is to concatenate them back together:

UPDATE nyc_intersections SET name = CONCAT(street1, ' & ', street2)

And then the cleanup:

VACUUM FULL nyc_intersections
gregallensworth commented 6 years ago

All done!

danrademacher commented 6 years ago

Hmm, testing locally, I still see "EAST" a lot

image

and "WEST"

image

Shouldn't those have become "E" and "W"?

gregallensworth commented 6 years ago

Finally all redone.

I went back to the dataset on P and reworked the name correction stuff. Version up in the DB at CARTO (and visible on the site, live and development) has the best names I have come up with so far.