Openvpms Localization and Addresses

There is a project that I think is designed to bring all the localization issues under 1 umbrella but I wanted to discuss a specific issue thats arisen in a side extension Ia am working on to get some input on working through it.  

I am discovering that the Australian Address system is actually more unique than I thought.

The australian standard is:

http://auspost.com.au/media/documents/Appendix-01.pdf

Basically it is 

  • Name of Addressee (mandatory)
  • Reference Line (optional)
  • Street address, Box number, or Locked Bag number (mandatory)
  • Locality name or the name of the office of delivery (mandatory), State or Territory abbreviation(Mandatory),  The postcode (mandatory) (all on the last line

Obviously the contact.location archetype was designed around this (the suburb is the locality)

So thats ok but then we look overseas and things get interesting.

taking our closest neighbour


NZ

https://www.nzpost.co.nz/sites/default/files/uploads/shared/standards-guides/adv356-address-and-layout-guide.pdf

Mr H G Guy (Recipient)(mandatory)
195A Halifax Street North (Street)(mandatory)
Tahunanui (Suburb)(optional except sometimes its mandatory)
Nelson 7011 (Town, Postcode)(mandatory)

The suburb is mandatory if the suburb name is in common use
for the address.
You can leave out central city suburbs (eg. ‘Auckland Central’).
Don’t use the name of a complex site, such as a university or
retirement village, for the suburb unless it’s commonly used
as a suburb, such as ‘Trentham Military Camp’.
• Use the correct town or city name – for example ‘Lower Hutt’
for a Lower Hutt address, rather than ‘Wellington’.
For a full list refer to www.nzpost.co.nz
• If the suburb name isn’t commonly used, leave it out.

Clear as mud right - but the important differential is NZ breaks it self into Towns not states for postal reasons.  

So we use the Town as the state name right? but then the archetype doesnt look right? perhaps we should rename the contact archetype field for state to locality?

we use the word state hardwired into the code so it isnt as easy as just a rename at the arcehtype level.  This is set into many of the address functions 


Ok so moving forward looking at USA.

They use

  • Reference Line (Optional)
  • Name of Addressee or Company (mandatory)
  • Address Line - but the Unit is after the street....(mandatory)
  • City Name, State, ZIP + 4 (City Name, State and Post Code)(mandatory)

The post code is not directly correlated with City Name, I think at best guess its a many-many relationship with all falling under the same state.

So we could translate or suburb to become the city name and the state becomes the locality.  

relationships between state and zipcode and state and cityname, ZIP code is actually a finer detail setting than the CITY, but I am not sure if there is a possibilty of a zip code having multiple cities (if it lies across a town border)


The Uk gets even more complicated at some point if you dont use these addresses all the time you just type the whole lot into the address field and ignore state, suburb and postcode

There are 1.7million postcodes in the UK. UK doesnt use counties but they use Cities, and then villages in address formats.

 

I think the point I make is maybe a slight change to the default contact archetype might be wise atleast localizing the database values ie

<node name="postcode" path="/details/code"
      type="java.lang.String" minCardinality="0" readOnly="false">
</node>

You can leave the node name alone the point is node can be renamed based on localization.

<node name="state" path="/details/locality"
      type="java.lang.String" minCardinality="0">
    <assertion name="lookup">
        <property name="type" value="targetLookup"/>
        <property name="relationship"
                  value="lookupRelationship.countryLocality"/>
        <property name="value" value="/details/country"/>
        <errorMessage>An error message</errorMessage>
    </assertion>
</node>

Eg you could rename State to Town for the Uk system.

<node name="suburb" path="/details/area"
      type="java.lang.String" minCardinality="0">
    <assertion name="lookup">
        <property name="type" value="targetLookup"/>
        <property name="relationship"
                  value="lookupRelationship.localityArea"/>
        <property name="value" value="/details/locality"/>
        <errorMessage>An error message</errorMessage>
    </assertion>
</node>

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Openvpms Localization and Addresses

>Locality name or the name of the office of delivery (mandatory), State or Territory abbreviation(Mandatory),  The postcode (mandatory) (all on the last line)

.... and this last line all in UPPERCASE with no punctuation.

When I first installed OpenVPMS a few years ago I noted that the data file containing all Australian towns and postcodes is in uppercase but  when the dataload (?) script is run as part of the install, all the towns get converted to propercase thus creating incorrect posting format. (I changed the 10-15 most commonly used towns to uppercase and as a new client comes in with a new address, I change that town to uppercase).

Re: Openvpms Localization and Addresses

Ben - to add in from my experiences:

a) Hong Kong - no postcodes, no 'states' but 3 areas that are put in the State field, Hong Kong (HK), Kowloon (KLN), and New Territories (NT). Around 450 'suburbs'. Did not change the titles in the contact.location archetype.

b) South Africa - 4digit post codes, and although they have 9 Provinces (== states) the postal system does not use then, but rather Areas (some 1005 of them). Around 18000 'suburbs'.  [Actually there are more because the SA post office has both English and Afrikaans names for a large number of places - but we omitted the Afrikaans ones.]  I extended the width of the suburb node to 50 as some of the names are long (eg University Of Kwazulu Natal Post Office).  In the contact.location archetype I titled state as Area, but left suburb as Suburb.

Regards, Tim G

Re: Openvpms Localization and Addresses

Ben -

I admire you for taking on the challenge of international addressing.  It's a mess.  I've seen other projects really struggle with this issue.  One that comes to mind is the mkgmap project that takes openstreetmap data and packages it for use on a Garmin GPS.  They really struggled with this for quite a while in the context of address searching.

Many of the issues are minor and ultimately come down to how the address is to be displayed on an envelope, in a report and so on.  I would think that these issues are easily addressable through template development as long as the individual elements of an address are (or could be) exposed.  I'm surprised how powerful template-side processing can be.  I'm able to use OVPMS and track taxes in two-tax environment simply by using modified templates. So if something needs to be capitalized, or the order changed (as in Russia where the city comes first, addressee last), let the templates handle it.

As for the OVPMS internals, I'd try looking at the similarities between addressing schemes as opposed to trying to accommodate all the variations.  Canada also has it peculiarities, but like all countries, has an inherent ranking system.  Whether the ranking is one of Country - State/Province - City - Street - Number or one of Country - City - Suburb - Street - Number, there is a ranking.   I wonder if it might be possible to get away from internal terms such as area, locality, etc. and allow the international user to specify what corresponds to the various rank levels.  For example, Rank1 would generally correspond to Country, but what about Rank2?  In Canada, it would be a Province, but it seems that in Hong Kong it may be an Area.  Rank3 in Canada would be City, whereas in Hong Kong, it appears to be a Suburb.  As long as the db can deal with the ranking scheme, then the international user might be able to just assign display terms within the archetype to correspond to the various ranks... either manually or through a script.  It seems that a ranking scheme would lend itself well to ordering and filtering within the program and yet be flexible enough to handle a wide variety of local postal-administrative patterns.

Thanks very much for looking into this.  It would be exciting to see us broaden our reach internationally.

Sam

Kamloops, Canada

Re: Openvpms Localization and Addresses

There are a couple of ways of supporting this.

The contact.location archetype can be customised as required by the locale.

Its then a matter of how that information is accessed in reports. Currently there are the party:getPracticeAddress(), party:getBillingAddress(...) and party:getCorrespondenceAddress(...). These require an address, suburb, state, and postcode node in the contact.location archetype.

To avoid this requirement, the address formatting can be done entirely in the report.

This means a lot of duplication however, so the above functions could be changed to evaluate an expression configured to format address for the current locale.

This expression would take a contact.location as an argument, and return the appropriate text. 

The expression could be an xpath expression configured in a property file, or as a lookup which is linked to via the practice.

Re: Openvpms Localization and Addresses

BTW - this is the structure UBL uses to represent addresses: http://docs.oasis-open.org/ubl/os-UBL-2.0/uml/UBL-2.0-AddressAssembly.jpg

We use UBL documents in ESCI.

This address structure is designed to be able to represent addresses around the world, although formatting is up to the user.

 

Re: Openvpms Localization and Addresses

Too really get localization going I think we need to support using message.properties to replace archetype display names.

In doing this we allow the creation of a system which can conform to any system.

 

 

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Openvpms Localization and Addresses

There is a project for archetype internationalisation here: http://www.openvpms.org/project/archetype-internationalisation

I would prefer to preprocess archetypes using a tool such as freemarker.

I think this would also allow support for conditional inclusion/exclusion of nodes based on property values.

Syndicate content