Improve handling of addresses outside the province
- Dominant language
- Java
- Stars
- 17
- Forks
- 7
- Avg merge
- 10h 2m
- Merged PRs (30d)
- 15
Description
Min of Advanced Education has out of province addresses that are being mangled by the current geocoder. For example, when the geocoder is faced with an address that is outside BC, it tries to interpret it as an address somewhere within BC to sometimes hilarious effect. For example:
13 oakwood ave toronto on
becomes:
Premier, BC
Ministry of Advanced Education would be happy if an out of province address returned a fullAddress of ON, CA with a matchPrecision of Province. If an input address is outside of Canada, fullAddress should return the ISO Alpha-2 country code and a matchPrecision of Country.
Here is one approach to the problem:
Add a global populated places table to the current geocoder, load it from geonames.org, and add support for a parameter that indicates address may be located outside of BC. Here are some details:
scopeGlobal is a new parameter that if true, indicates addressString might be located outside the jurisdiction of the geocoder (e.g., another province, another country).
if scopeGlobal=false (the default), the geocoder assumes address is located within the geocoder's jurisdiction (e.g., BC). This is the current geocoder's behavior.
if scopeGlobal=true, the geocoder will check if the input address is located within a province other than BC or a country other than Canada. If the input address is found outside of BC but within Canada, return a fullAddress of the ISO subCountry code (e.g., ON) plus the ISO Alpha2 Country code (e.g., CA) and a matchPrecision of Province. If input address is found outside of Canada, return a fullAddress of the ISO country code and a matchPrecision of Country. Also raise an address.outsideJurisdiction fault with a penalty of 1 and a match precision of Province or Country.
We could also set lat/lon to province or country point. This will require province and country location tables.
We could only recognize ISO Country and sub-country codes and rely on abbreviation mappings to handle common country names such as Canada, Japan, South Korea, China, United States of America
Contributor guide
No contributing guide indexed for this repository
Research direction
No files, tests, or entry points are identified. Start by reviewing the current geocoder's handling of addressString and the proposed scopeGlobal parameter, then trace how fullAddress, matchPrecision, lat/lon, and address.outsideJurisdiction are returned; done means the described province and country responses work without mangling out-of-jurisdiction addresses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100