Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add original place id when postalcode is overridden #1635

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Joxit
Copy link
Member

@Joxit Joxit commented Aug 30, 2022

👋 I did some awesome work for the Pelias project and would love for everyone to have a look at it and provide feedback.


Here's the reason for this change 🚀

Addresses from OpenAddresses can override parent place name (such as postalcode). When this happens, we don't know where the postalcode came from, especially if there was one from another source (like WOF).

Also, since postalcodes are part of an document's parents, not having a gid makes the API less consistent.


Here's what actually got changed 👏

In renamePlacenames middleware, I added an option that allows us to add/override the postalcode gid. Thanks to this, we will know where the data comes from.


Here's how others can test the changes 👀

You can try with 815 Tennessee St, San Francisco, CA 94107, États-Unis where the postalcode_gid will be openaddresses:address:us/ca/san_francisco:819b088d2837cf5d

{
  "id": "us/ca/san_francisco:819b088d2837cf5d",
  "gid": "openaddresses:address:us/ca/san_francisco:819b088d2837cf5d",
  "layer": "address",
  "source": "openaddresses",
  "source_id": "us/ca/san_francisco:819b088d2837cf5d",
  "country_code": "US",
  "name": "815 Tennessee Street",
  "housenumber": "815",
  "street": "Tennessee Street",
  "postalcode": "94107",
  "postalcode_gid": "openaddresses:address:us/ca/san_francisco:819b088d2837cf5d",
  "accuracy": "point",
  "country": "États-Unis",
  "country_gid": "whosonfirst:country:85633793",
  "country_a": "USA",
  "region": "Californie",
  "region_gid": "whosonfirst:region:85688637",
  "region_a": "CA",
  "county": "San Francisco",
  "county_gid": "whosonfirst:county:102087579",
  "county_a": "SF",
  "locality": "San Francisco",
  "locality_gid": "whosonfirst:locality:85922583",
  "locality_a": "SF",
  "neighbourhood": "Dogpatch",
  "neighbourhood_gid": "whosonfirst:neighbourhood:85882179",
  "continent": "Amérique du Nord",
  "continent_gid": "whosonfirst:continent:102191575",
  "label": "815 Tennessee Street, San Francisco, CA, USA"
}

Maybe when the postalcode is already present in the parent object we may not override it with OA data ?

Feel free the close the PR if this is not valuable for the project 😄

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.

1 participant