Wiki Markup |
---|
Note |
This is a feature in OpenMRS 1.9 \+{note} h1. Managing Address Templates Some recommended OpenMRS address templates are provided here; Please copy past your preferred Address Template to the "Address Template xml" textbox in the+ |
Managing Address Templates
Some recommended OpenMRS address templates are provided here;
Please copy past your preferred Address Template to the "Address Template xml" textbox in the /admin/locations/addressTemplate.form
...
...
...
- Template
- Address Template for Kenya
- Address Template for Lesotho
- Address Template for Malawi
- Address Template for Rwanda
- Address Template for Spain
- Address Template for Tanzania
- Address Template for USA
Customizing Templates
You can also build your own templates according to your country.
First according to your need, select some address attribute form the Table bellow:
Attribute type | xml |
---|---|
address1 | <property name="address1" value="Location.address1"/> |
...
address2 | <property name="address2" |
...
value="Location.address2"/> |
...
address3 | <property name="address3" |
...
value="Location.address3"/> |
...
address4 | <property name="address4" |
...
value="Location.address4"/> |
...
address5 | <property name="address5" |
...
value="Location.address5"/> |
...
address6 | <property name="address6" |
...
value="Location.address6"/> |
...
cityVillage | <property name="cityVillage" |
...
value="Location.cityVillage"/> |
...
countyDistrict | <property name="countyDistrict" |
...
value="Location.district"/> |
...
stateProvince | <property name="stateProvince" |
...
value="Location.stateProvince"/> |
...
country | <property name="country" |
...
value="Location.country"/> |
...
latitude | <property name="latitude" |
...
value="Location.latitude"/> |
...
longitude | <property name="longitude" |
...
value="Location.longitude"/> |
...
postalCode | <property name="postalCode" |
...
value="Location.postalCode"/> |
...
startDate | <property name="startDate" |
...
value="PersonAddress.startDate"/> |
...
endDate | <property name="endDate" |
...
value="personAddress.endDate"/> |
...
Add
...
these
...
atribut
...
sets
...
in
...
the
...
XML
...
as
...
follows
Code Block | ||||
---|---|---|---|---|
| ||||
<nameMappings class="properties"> <property name="address2postalCode" value="Location.address2postalCode"/> <property name="address1longitude" value="Location.address1longitude"/> ... others </nameMappings> |
Now define the character size for each of the attribute you selected
Name = attribute name
value = Number of charecters
E.g.
Code Block | ||||
---|---|---|---|---|
| ||||
<sizeMappings class="properties"> <property name="cityVillage<property name="postalCode" value="Location.cityVillage"/>Now define the character size for each of the attribute you selected E.g. If postalCode is 10 character long :10"/> <property name="postalCodelongitude" value="10"/> Next design the layout... of your Address Template. This defines the top to bottom and left to right order of the address attributes E.g. others </sizeMappings> |
Next design the layout of your Address Template.
This defines the top to bottom and left to right order of the address attributes
E.g.
Code Block | ||||
---|---|---|---|---|
| ||||
<lineByLineFormat> <string>address1</string> <string>address2</string> <string>cityVillage stateProvince country postalCode</string> <string>latitude longitude</string> <string>startDate endDate</string> </lineByLineFormat> <elementDefaults> |
(OPtional) You can add default values for the attribute as bellow
E.g.
Code Block | ||||
---|---|---|---|---|
| ||||
<elementDefaults> <property name="country" value="Kenya"/> </elementDefaults> ... <elementRegex> <property name="longitude" value="^(\\d{1,3}\\s)\\d\\d.(\\d{2,3})\\s*$"/></elementDefaults> |
(OPtional) You can define Reguler expressions to validate input, and also help the user by giving input sugessions
E.g.
Reguler expressions to validation;
Code Block | ||||
---|---|---|---|---|
| ||||
<elementRegex> <property name="latitudelongitude" value="^(\\d{1,3}\\s)\\d\\d.(\\d{2,3})\\s*$"/>$"/> <property name="latitude" value="^(\\d{1,3}\\s)\\d\\d.(\\d{2,3})\\s*$"/> ... </elementRegex> |
Input sugessions;
Code Block | ||||
---|---|---|---|---|
| ||||
<elementRegexFormats>
<property name="longitude" value="123 45.000"/>
<property name="latitude" value="123 45.000"/>
...
</elementRegexFormats>
|
Fianly you can bundle all in one xml as
Code Block | ||||
---|---|---|---|---|
| ||||
<addressTemplate> <nameMappings class="properties"> <property name="postalCode" value="Location.postalCode"/> ... </nameMappings> <sizeMappings class="properties"> <property name="postalCode" value="10"/> ... </elementRegex>/sizeMappings> <lineByLineFormat> <string>address1</string> <elementRegexFormats> <string>address2</string> <property name="longitude" value="123 45.000"/> ... </lineByLineFormat> ... <property name="latitude" value="123 45.000"/> ... </elementRegexFormats> {anchor:General} {code:language=xml|title=General Address Template|controls=true}addressTemplate> |
Please reffer the sample for further clarication
Anchor | ||||
---|---|---|---|---|
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<addressTemplate>
<nameMappings class="properties">
<property name="postalCode" value="Location.postalCode"/>
<property name="longitude" value="Location.longitude"/>
<property name="address2" value="Location.address2"/>
<property name="address1" value="Location.address1"/>
<property name="startDate" value="PersonAddress.startDate"/>
<property name="country" value="Location.country"/>
<property name="endDate" value="personAddress.endDate"/>
<property name="stateProvince" value="Location.stateProvince"/>
<property name="latitude" value="Location.latitude"/>
<property name="cityVillage" value="Location.cityVillage"/>
</nameMappings>
<sizeMappings class="properties">
<property name="postalCode" value="10"/>
<property name="longitude" value="10"/>
<property name="address2" value="40"/>
<property name="address1" value="40"/>
<property name="startDate" value="10"/>
<property name="country" value="10"/>
<property name="endDate" value="10"/>
<property name="stateProvince" value="10"/>
<property name="latitude" value="10"/>
<property name="cityVillage" value="10"/>
</sizeMappings>
<lineByLineFormat>
<string>address1</string>
<string>address2</string>
<string>cityVillage stateProvince country postalCode</string>
<string>latitude longitude</string>
<string>startDate endDate</string>
</lineByLineFormat>
</addressTemplate>{code}
{anchor:Kenya}
{code:language=xml|title=Address Template for Kenya|controls=true} |
Anchor | ||||
---|---|---|---|---|
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<addressTemplate>
<nameMappings class="properties">
<property name="postalCode" value="Location.postalCode"/>
<property name="longitude" value="Location.longitude"/>
<property name="address3" value="Location.estateNearestCentre"/>
<property name="address2" value="Location.sectionHomestead"/>
<property name="address1" value="Location.address1"/>
<property name="country" value="Location.country"/>
<property name="stateProvince" value="Location.province"/>
<property name="latitude" value="Location.latitude"/>
<property name="address6" value="Location.location"/>
<property name="address5" value="Location.sublocation"/>
<property name="cityVillage" value="Location.townVillage"/>
<property name="countyDistrict" value="Location.district"/>
<property name="address4" value="Location.division"/>
</nameMappings>
<sizeMappings class="properties">
<property name="postalCode" value="6"/>
<property name="longitude" value="10"/>
<property name="address3" value="24"/>
<property name="address2" value="55"/>
<property name="address1" value="55"/>
<property name="country" value="10"/>
<property name="townshipDivision" value="24"/>
<property name="stateProvince" value="24"/>
<property name="subregion" value="24"/>
<property name="latitude" value="10"/>
<property name="region" value="24"/>
<property name="cityVillage" value="24"/>
<property name="countyDistrict" value="24"/>
</sizeMappings>
<elementDefaults class="properties">
<property name="country" value="Kenya"/>
</elementDefaults>
<elementRegex class="properties">
<property name="longitude" value="^(\\d{1,3}\\s)\\d\\d.(\\d{2,3})\\s*$"/>
<property name="latitude" value="^(\\d{1,3}\\s)\\d\\d.(\\d{2,3})\\s*$"/>
</elementRegex>
<elementRegexFormats class="properties">
<property name="longitude" value="123 45.000"/>
<property name="latitude" value="123 45.000"/>
</elementRegexFormats>
<lineByLineFormat>
<string>address1</string>
<string>address2</string>
<string>address3 cityVillage</string>
<string>address5 address6</string>
<string>address4 countyDistrict</string>
<string>stateProvince postalCode</string>
<string>latitude longitude</string>
<string>country</string>
</lineByLineFormat>
</addressTemplate>{code}
{anchor:Lesotho}
{code:language=xml|title=Address Template for Lesotho|controls=true} |
Anchor | ||||
---|---|---|---|---|
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<addressTemplate>
<nameMappings class="properties">
<property name="countyDistrict" value="Location.district"/>
<property name="cityVillage" value="Location.village"/>
</nameMappings>
<sizeMappings class="properties">
<property name="countyDistrict" value="40"/>
<property name="cityVillage" value="40"/>
</sizeMappings>
<elementDefaults class="properties">
<property name="country" value="Lesotho"/>
</elementDefaults>
<lineByLineFormat>
<string>countyDistrict</string>
<string>cityVillage</string>
</lineByLineFormat>
</addressTemplate>{code}
{anchor:Malawi}
{code:language=xml|title=Address Template for Malawi|controls=true} |
Anchor | ||||
---|---|---|---|---|
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<addressTemplate>
<nameMappings class="properties">
<property name="address3" value="Location.neighborhood"/>
<property name="stateProvince" value="Location.district"/>
<property name="address1" value="Location.address1"/>
<property name="countyDistrict" value="Location.traditionalAuthority"/>
<property name="cityVillage" value="Location.village"/>
</nameMappings>
<sizeMappings class="properties">
<property name="address3" value="20"/>
<property name="stateProvince" value="20"/>
<property name="address1" value="40"/>
<property name="countyDistrict" value="20"/>
<property name="cityVillage" value="20"/>
</sizeMappings>
<elementDefaults class="properties">
<property name="country" value="Malawi"/>
</elementDefaults>
<lineByLineFormat>
<string>address1</string>
<string>address3</string>
<string>cityVillage</string>
<string>countyDistrict</string>
<string>stateProvince</string>
</lineByLineFormat>
</addressTemplate>{code}
{anchor:Rwanda}
{code:language=xml|title=Address Template for Rwanda|controls=true} |
Anchor | ||||
---|---|---|---|---|
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<addressTemplate>
<nameMappings class="properties">
<property name="address3" value="Location.cell"/>
<property name="stateProvince" value="Location.province"/>
<property name="address1" value="Location.rwandanNeighborhood"/>
<property name="countyDistrict" value="Location.district"/>
<property name="cityVillage" value="Location.sector"/>
</nameMappings>
<sizeMappings class="properties">
<property name="address3" value="40"/>
<property name="stateProvince" value="40"/>
<property name="address1" value="40"/>
<property name="countyDistrict" value="40"/>
<property name="cityVillage" value="40"/>
</sizeMappings>
<elementDefaults class="properties">
<property name="country" value="Rwanda"/>
</elementDefaults>
<lineByLineFormat>
<string>stateProvince</string>
<string>countyDistrict</string>
<string>cityVillage</string>
<string>address3</string>
<string>address1</string>
</lineByLineFormat>
</addressTemplate>{code}
{anchor:Spain}
{code:language=xml|title=Address Template for Spain|controls=true} |
Anchor | ||||
---|---|---|---|---|
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<addressTemplate>
<nameMappings class="properties">
<property name="address2" value="Location.address2"/>
<property name="stateProvince" value="Location.stateProvince"/>
<property name="address1" value="Location.address1"/>
<property name="longitude" value="Location.longitude"/>
<property name="postalCode" value="Location.postalCode"/>
<property name="cityVillage" value="Location.cityVillage"/>
<property name="country" value="Location.country"/>
<property name="latitude" value="Location.latitude"/>
</nameMappings>
<sizeMappings class="properties">
<property name="address2" value="40"/>
<property name="stateProvince" value="10"/>
<property name="address1" value="40"/>
<property name="longitude" value="10"/>
<property name="postalCode" value="10"/>
<property name="cityVillage" value="10"/>
<property name="country" value="10"/>
<property name="latitude" value="10"/>
</sizeMappings>
<lineByLineFormat>
<string>address1</string>
<string>address2</string>
<string>cityVillage stateProvince country postalCode</string>
<string>latitude longitude</string>
</lineByLineFormat>
</addressTemplate>{code}
{anchor:Tanzania}
{code:language=xml|title=Address Template for Tanzania|controls=true} |
Anchor | ||||
---|---|---|---|---|
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<addressTemplate>
<nameMappings class="properties">
<property name="address6" value="Location.region"/>
<property name="address5" value="Location.ward"/>
<property name="countyDistrict" value="Location.district"/>
<property name="cityVillage" value="Location.villageStreet"/>
</nameMappings>
<sizeMappings class="properties">
<property name="address6" value="14"/>
<property name="address5" value="22"/>
<property name="countyDistrict" value="17"/>
<property name="cityVillage" value="50"/>
</sizeMappings>
<lineByLineFormat>
<string>cityVillage</string>
<string>address5</string>
<string>countyDistrict</string>
<string>address6</string>
</lineByLineFormat>
</addressTemplate>{code}
{anchor:USA}
{code:language=xml|title=Address Template for USA|controls=true} |
Anchor | ||||
---|---|---|---|---|
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<addressTemplate>
<nameMappings class="properties">
<property name="address2" value="Location.address2"/>
<property name="stateProvince" value="Location.state"/>
<property name="address1" value="Location.address1"/>
<property name="postalCode" value="Location.zipCode"/>
<property name="cityVillage" value="Location.city"/>
</nameMappings>
<sizeMappings class="properties">
<property name="address2" value="50"/>
<property name="stateProvince" value="2"/>
<property name="address1" value="50"/>
<property name="postalCode" value="10"/>
<property name="cityVillage" value="20"/>
</sizeMappings>
<elementDefaults class="properties">
<property name="country" value="USA"/>
</elementDefaults>
<lineByLineFormat>
<string>address1</string>
<string>address2</string>
<string>cityVillage stateProvince postalCode</string>
</lineByLineFormat>
</addressTemplate>{code} |