pelias / labels

Pelias Label generation
https://pelias.io
MIT License
4 stars 9 forks source link

NYC special case logic for address formatter #39

Closed blackmad closed 3 years ago

blackmad commented 4 years ago

Hey, it's the NYC hacks! This is maybe the third time in my life I have written these. I don't know how else to do this except for a bunch of special case logic.

The comments + test cases I hope do a decent job of explaining what I'm trying to do here

// NYC is special for addresses // - The borough is used for the locality in addresses // - Except in Queens, where ideally the neighbourhood is

// We still want to return "neighborhood, borough, region_a" when a user searches for a neighborhood
// otherwise it looks incomplete, so skip to returning the borough in that case
// Otherwise, in Queens only, use the neighborhood for the city in address labels
orangejulius commented 4 years ago

Cool, I'll give this a thorough testing tomorrow but it looks broadly correct. I agree we probably can't escape special casing for Queens in particular.

blackmad commented 3 years ago

duplication removed

orangejulius commented 3 years ago

Okay, I've updated this PR to handle both venues/addresses in Manhattan (they will have New York as the last line value, rather than Manhattan), as well as neighbourhoods in Manhattan (they will have Manhattan, New York as the lastline).

I've also fixed up some tests that had incorrect or misleading values that weren't affecting the outcome but could be confusing, and moved all the NYC specific stuff to its own function. We should be all good now!