Creating address field in Patient registration module, with a hierarchal structure and tailored sub-fields

Application Name: OpenMRS Version Number: 2.3.1 Question: We are currently stuck in a predicament and would be grateful for your help. In the patient registration module, we want to write a field named ‘ADDRESS’ where we want the following configuration. We would have a drop-down of ‘Province’. Based on our choice in the ‘Province’ background, we should get a dropdown for ‘District’. Based on our choice in the ‘District’ dropdown, we should get a dropdown ‘Locality’. Is there a way we can achieve that using the application modules in the OpenMRS?

Hi @seshasowri!

You should definitely be able to achieve this with two modules: the Address Hierarchy module allows you store a proper hierarchy of address components, e.g., linking provinces -> districts -> localities. See that page and it’s subpages for more on that module.

From there, you can read on our page about the registration app configuration how to integrate the registration app with the address hierarchy module.

IIRC, this doesn’t actually give you traditional drop-downs, but it does give you proper autocompletion in those fields.

Hope that helps!

1 Like

Sure thanks for this,its a good catch , however i had another option but i hope its kinda long to implement. Its about creating field Address as coded concept and use a uuid as an id that will map other concepts we want to appear in the dropdown list,Like i said its kinda long Forexample check here

@sharif That’s definitely the right approach for patient attributes that OpenMRS doesn’t have built-in support for, but addresses are a quite difficult area, so we have some more specialised tools :slightly_smiling_face:.

ohh sure thanks

I have been able to use the address hierarchy module, but I am having trouble using the ‘Free-text address entry feature’. I have set the global property ’ addresshierarchy.allowFreetext’ to true. However, the entries in the field are not showing the ‘Other’ option, ergo not displaying the text box to enter the ‘free text’. Would be grateful if anyone has any suggestion or insight in this regard.

@ibacher - Hi, could you please look at the issue stated above by @seshasowri? I am also running in to this issue and do not know how to allow a free text box using the address hierarchy module. Thanks.

This may be a feature that doesn’t exist in the registration application. Unfortunately, the addresshierarchy.allowFreetext global property only controls the behaviour of the legacy view controlled by the address hierarchy and not the registration component.

@dkayiwa Did I miss something in the registration app?

Correct. It was implemented only in the legacyui. How to use the Address Hierarchy Module with the Reference Application

1 Like