google / libaddressinput

Google’s postal address library, powering Android and Chromium
Apache License 2.0
576 stars 104 forks source link

Wrong requirements for Norway? #163

Closed torkiljohnsen closed 6 years ago

torkiljohnsen commented 6 years ago

The address specification for Norway looks like this:

{  
   "locality_name_type":"post_town",
   "name":"NORWAY",
   "require":"ACZ",
   "key":"NO",
   "zipex":"0025,0107,6631",
   "zip":"\\d{4}",
   "id":"data/NO",
   "posturl":"http://adressesok.posten.no/nb/postal_codes/search",
   "fmt":"%N%n%O%n%A%n%Z %C"
}

Here it says that street address lines (A) is a requirement, but according to Posten (Norwegian postal service), it is not.

Their examples of valid post addresses also include:

Per Post 9672 Ingøy

Which is format: %N%n%Z %C, without the street address line(s) (A).

Is the recipient name (N) "Per Post" (Eng.: John Mail) be considered a valid value for street address line (A) here perhaps, so the addressing requirement ACZ is in fact met?

The address is however required to have a recipient, so either a name (N) or an organization name (O) should be specified when addressing in Norway, but I am not sure how that could be formulated?

sockix commented 6 years ago

That's interesting, but from the documentation it also seem to be the exception rather than the rule.

While I can certainly see why the %A can be considered optional... I worry that more often than allowing that field to remain empty might lead to additional incomplete addresses. This is especially true if the recipient and/or organization fields were not used (or ignored) by a client.

Do you know if leaving it causes confusion to users? Do you know how common this sort of situation is? Would it be weird to specify the contact or business in the address line?

torkiljohnsen commented 6 years ago

Some sort of recipient is definitely required, like a person's or an organization's name. Not sure if that is within the scope of the list of required elements, of if it is just implied?

Street address is not required in Norway. I myself live in a sparsely populated area of Norway, and people addresses without street names are not uncommon here. While this is true, many people without street names in their addresses are so used to web forms requiring it, that they normally just write something in that field too, just because they are used to having to please form validators. I work in ecommerce though, and I want forms to be as painless as possible 🙂

There has been an ongoing campaign to get street names for all of Norway. Very useful for firefighters and ambulances it turns out 😁. According to this article from 2013, 75% of Norway had street names at that point. The number is guaranteed higher now, so it is definitely the case for a minority of the inhabitants. From the article I linked to above though, the postal service clearly does not require street name (address line 1) yet.

sockix commented 6 years ago

So while it sounds like an address w/o an address is certainly possible... it also sounds to me that there's a risk of making that field optional given that in the far majority of cases there should be something entered. In the remaining cases, it sounds like people are already accustomed to putting something in there already, and there's momentum to have everyone enter one.

With that, wouldn't it be safer to leave it as is?

We have many users of this data (and widgets) who do not show the recipient and/or organization fields and are only interested in the core address information (ie. the remaining fields). My worry is that by removing this bit of validation, we might get additional incomplete addresses.

With all of that said, I realize that you are MUCH more familiar with addressing in Norway than I am. If you feel strongly that this should be changed, I'm happy to further this issue along and see if we can make the change. What do you think?

torkiljohnsen commented 6 years ago

Yes, I agree it would perhaps be safer to leave it as is with the street name required for Norway.

I am using a library that extends your library, which adds recipient as a mandatory field to all addresses on top of your rules, which I had a problem with since organization can replace recipient and the address would still be valid.

IMO it would be better to have proper address requirements, and then if you require less fields to be valid, you can add your own, simpler implementation on top of that. For example: I have one endpoint in our API for shipping calculations which only require locality and postal code for instance, so for this endpoint I just ignore any errors related to other fields.

But this is stuff I will address on my end… 👍 Thanks for your feedback!