Hierarchy type='contact'

for persons we have contacts with type=“person” and contact_type null or whatever you want, for places we have type=“contact” and contact_type=“c10_site” or other hierarchy place.
It looks natural to use type=“person” contact_type=“chw” or type=‘person’ contact_type=“nurse”', and it would be cool to be able to use this logic even for places, type=“place” contact_type=“c10_site”
is there a way to have contact forms that save docs with type=“place” ?

hi @bamatic

Unfortunately, saving docs with type="place" will break your functionality at the moment.

Before configurable hierarchies, there were 4 hardcoded contact types: “person”, “clinic”, “health_center” and “district_hospital”, so we only used one field in the contact doc, the type field, using one of these hardcoded values.

With configurable hierarchies, you can have as many contact types as you want, and your configurable type contacts will use type="contact" and contact_type="<your type>".

My belief is that a single hardcoded type that is not reused (type="contact") makes it easier to code against and avoid confusion.
I agree that it might seem more natural to use type=person and type=place, however reusing the person type that way is an invitation for confusion, bugs in core code and application code (because we have to be backwards compatible, the hardcoded “person” type without “contact_type” will still work).

Can you give us an example where using type=place and type=person vs type=contact would make a significant difference?

I am stuck somewhere and trying to read and find a solution.
I have a configurable hierarchy with about five (5) levels, national_office, county_office, sub_county_office, link_facility, community_unit, chw_area and house_hold.
I have created the forms for contact and app, and have created the config files (base_settings, messages-en (currently empty content))
Pushing app files to my test VM and running the application loads the default app, starting with the New District and not what I was expecting, not sure what I missed?

Hi @oyierphil
Please provide more detail about these steps. What happens if you try to update the config again?

@diana, I have used the commands below:

  1. Convert and Build Forms (Contact Forms, App Forms)
    sudo cht --url=https://medic:password@ --accept-self-signed-certs convert-contact-forms upload-contact-forms --skip-validate
  2. CHT Localization - Custom translations (Currently, file is empty, for testing purposes)
    sudo cht --url=https://medic:password@ --accept-self-signed-certs upload-contact-forms upload-app-forms --skip-validate
  3. Building Target Widgets
    sudo cht --url=https://medic:password@ --accept-self-signed-certs compile-app-settings upload-app-settings
  4. Deploy the blank project
    sudo cht --url=https://medic:password@ --accept-self-signed-certs --skip-validate

I have just run command 4 to deploy the project and no form is loaded when I login as the admin, while I can create households when I login as a chw.

Since this is a test VM, I can share login details for your review

hi @oyierphil

I’m checking the contact_types definition in your settings and it seems to be using the default config. Are you editing that section or just adding the contact forms?
It seems that your settings match the default hierarchy.