NOTE: This is a public repository. Images or logs containing protected health information (PHI) must be fully-redacted.
Describe the Bug
After successfully configuring a new place level, getting an error when attempting to load the UUID of this level on a contact creation form. E.g When creating a Health Center (now a child of a Supervisor Area level of contact_type supervisor_area and type contact).
ERROR
pyxform.errors.PyXFormError: Unknown question type ‘db:contact’.
How To Reproduce The Issue
Create a Supervisor Area level
Modify the health_center-create workflow to have the question “In which Supervisor Area will this CHW Belong”?
Set the question type to db:contact since the supervisor_area contact type has “type”: “contact”
See error when uploading the form to the server.
Expected Behavior
I expect to attach CHW Areas to the new level using the health_center-create workflow.
Hi @kitsao
I have tried adding db:supervisor_area on the type column of the form.
Getting pyxform.errors.PyXFormError: Unknown question type ‘db:supervisor_area’.
Hey @sheila_abby I see. It goes back to contact selector, which would be easy to handle in versions 3.10 +. However, since you’re on version 3.7, you’ll have to modify Pyxforms question_type_dictionary.py, in my case located on /usr/local/lib/python2.7/dist-packages/pyxform/question_type_dictionary.py to include the type you’re working with i.e.
According to the hierarchy, I believe supervisor_area should be a place with a contact attached to it consider this hierarchy table…
LEVEL
PLACE (doc->>‘type’)
CONTACT (doc->>‘type’ = ‘person’)
Highest Level (Branch)
district_hospital
branch_manager
New Level
supervisor_area
supervisor
CHW Area
health_centre
chw
Household
clinic
primary_care_giver
Patient
person
patient (no doc->>‘contact’)
So to say on couch there should be a new doc->>type which is supervisor_area which is a place. Having this place having doc->>‘type’ contact would mean it is a person hence interfering with queries around all contacts for different places. (contacts for clinic/households, contacts for health_centers/chw area…
Hey @ocornel good to see you set up configurable hierarchy. You notice that defining the hierarchy involves setting up contact_types in your app/base_settings. While you can set your personcontact_type to have multiple parents e.g.
you’ll have to check for rightful parents in your queries accordingly, to avoid what you refer to as interference. Alternatively, you can set up your hierarchy such that you have distinct people contact types for each place contact type. For example
@ocornel Clarifying your request, are you suggesting that you would prefer to have have two explicit type values { person and place }? Instead of just the one value we currently have contact?