How to create a hierarchy of contact from parent to child?

how to create a heirarchy of mohp, district, community and household ?

Hi @durga.tukilogic ,

Could you please try specifying the hierarchy in base_settings.json file which you can find in app_settings folder of your project? You can list your hierarchy in place_hierarchy_types. May be you can try adding something like below in the base_settings.json:

"place_hierarchy_types": [

How to create role for this heirarchy and i have added this heirarchy on base_settings.json still not working.

Still the heirarchy i am not getting in my role part

In base_settings.json, you need to specify the hierarchy under contact_types. Please see the hierarchy reference here:

If you want to look at examples of how it is done, you can find some below:

Although the file name is app_settings.json in the first example, you can use the same code for contact_types in base_settings.json as well. The settings will eventually get compiled into the app_settings.json file with the compile-app-settings action of the cht-conf tool.

1 Like

Roles can be defined independently of the hierarchy. To create a new role, you need to add it to a section called .roles in the app settings file (preferably base_settings.json). Here is the reference document:

You can also add roles and give them permissions from the App Management page. However, these roles can be overwritten when you upload new settings. So please make sure that you add them to the settings file too. One way to do this could be:

  1. Create/edit roles and permissions from App Management page and click on Submit.
  2. Go to the Backup app code tab on the app management page
  3. Click on Download current settings
  4. Copy the roles and permissions from the downloaded copy of your settings file to your settings file.

I have a follow up to this question. I have followed the guide to Set Hierarchy and updated my app_setting.json successfully

      "id": "district_hospital",
      "name_key": "contact.type.district_hospital",
      "group_key": "contact.type.district_hospital.plural",
      "create_key": "",
      "edit_key": "",
      "icon": "medic-district-hospital",
      "create_form": "form:contact:district_hospital:create",
      "edit_form": "form:contact:district_hospital:edit"
INFO compile-app-settings complete. 
INFO Starting action: backup-app-settings… 
INFO backup-app-settings complete. 
INFO Starting action: upload-app-settings… 
INFO Settings updated successfully 
INFO upload-app-settings complete. 
INFO All actions completed. 

My understanding of adding this contact_type is I would have district_hospital as an “entity” I can create

My expectation was if I click the Blue + sign in addition to the two options below, I would also have the option to create a new district hospital.


Is my understanding correct ?

Hi @Ben_Kiarie

Great question! Which blue icon are you clicking?
I believe the blue icon, right now, will only allow to create contact types that have the currently viewed contact as a parent, and you can create the contact type that does not have a parent from the main contacts list - there should be a separate button in the lower part of the contacts list on the LeftHandSide