Note |
---|
This is a feature in OpenMRS 1.9+ |
...
Some example OpenMRS address templates are provided here. You can copy a preferred Address Template from this page and paste into the "Manage Address Template" text box. Feel free to customize to your liking as seen in the screenshot above.
- General Address 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
- Address Template for Chile
- Address Template for Nepal
- Address Template for Haiti
Customizing Templates
You can also build your own templates.
First according to your need, select some address attribute from the table below,
Attribute type | XML Snippet |
---|---|
address1 | <property name="address1" value="Location.address1"/> |
address2 | <property name="address2" value="Location.address2"/> |
address3 | <property name="address3" value="Location.neighborhood"/> |
address4 | <property name="address4" value="Location.division"/> |
address5 | <property name="address5" value="Location.sublocation"/> |
address6 | <property name="address6" value="Location.location"/> |
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 attributes XML in the following format,
...
Now define the character size for each of the attribute you selected. The actual number of characters can be less, but not more than specified.
name = Attribute name
value = Number of characters
E.g.
...
Code Block | ||
---|---|---|
| ||
<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> |
Input suggestions; These can be used to display an example format that an element should look like.
Code Block | ||
---|---|---|
| ||
<elementRegexFormats class="properties"> <property name="longitude" value="123 45.000"/> <property name="latitude" value="123 45.000"/> ... </elementRegexFormats> |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<org.openmrs.layout.web.address.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> </org.openmrs.layout.web.address.AddressTemplate> |
Anchor Chile Chile
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<org.openmrs.layout.web.address.AddressTemplate> <nameMappings class="properties"> <property name="address3" value="Location.address3"/> <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"/> <property name="countyDistrict" value="Location.district"/> </nameMappings> <sizeMappings class="properties"> <property name="address3" value="10"/> <property name="address2" value="10"/> <property name="stateProvince" value="2"/> <property name="address1" value="50"/> <property name="postalCode" value="10"/> <property name="cityVillage" value="20"/> <property name="countyDistrict" value="20"/> </sizeMappings> <elementDefaults class="properties"> <property name="country" value="Chile"/> </elementDefaults> <lineByLineFormat> <string>address1 address2 address3</string> <string>cityVillage countyDistrict stateProvince country postalCode</string> </lineByLineFormat> </org.openmrs.layout.web.address.AddressTemplate> |
Anchor Nepal Nepal
Code Block | ||||
---|---|---|---|---|
| ||||
<org.openmrs.layout.web.address.AddressTemplate> <nameMappings class="properties"> <property name="address3" value="Ward Number"/><!--Ward Number--> <property name="address4" value="Tole"/><!--Tole--> <property name="address5" value="Landmark"/><!--Landmarks--> <property name="startDate" value="PersonAddress.startDate"/> <property name="country" value="Location.country"/> <property name="endDate" value="personAddress.endDate"/> <property name="countyDistrict" value="Location.district"/><!--District--> <property name="cityVillage" value="VDC/Municipality"/><!--VDC/Municipality--> <property name="stateProvince" value="Zone"/> </nameMappings> <sizeMappings class="properties"> <property name="address3" value="40"/> <property name="address4" value="40"/> <property name="address5" value="40"/> <property name="startDate" value="10"/> <property name="country" value="10"/> <property name="endDate" value="10"/> <property name="countyDistrict" value="40"/> <property name="cityVillage" value="40"/> <property name="stateProvince" value="40"/> </sizeMappings> <elementDefaults class="properties"> <property name="country" value="Nepal"/> </elementDefaults> <lineByLineFormat> <string>stateProvince countyDistrict</string> <string>cityVillage address3</string> <string>address4 address5</string> <string>country</string> </lineByLineFormat> </org.openmrs.layout.web.address.AddressTemplate> |
Anchor Haiti Haiti
Code Block | ||||
---|---|---|---|---|
| ||||
<org.openmrs.layout.web.address.AddressTemplate> <nameMappings class="properties"> <property name="address2" value="Ri / Nimewo Kay"/> <property name="address1" value="Lokalite"/> <property name="country" value="Peyi"/> <property name="stateProvince" value="Depatman"/> <property name="cityVillage" value="Komin"/> <property name="countyDistrict" value="Seksyon Riral"/> </nameMappings> <sizeMappings class="properties"> <property name="address2" value="40"/> <property name="address1" value="40"/> <property name="country" value="40"/> <property name="stateProvince" value="40"/> <property name="cityVillage" value="40"/> <property name="countyDistrict" value="40"/> </sizeMappings> <lineByLineFormat> <string>country</string> <string>stateProvince</string> <string>cityVillage</string> <string>countyDistrict</string> <string>address1</string> <string>address2</string> </lineByLineFormat> </org.openmrs.layout.web.address.AddressTemplate> |
...