NOTE: This is a public repository. Images or logs containing protected health information (PHI) must be fully-redacted.
Describe the Bug
After adding a new place level(Supervisor Area), I attempt to move contacts (CHW Areas) to be the children of this new place.
However, I get a hierarchy constraint error…
ERROR Error: Hierarchy Constraints: contacts of type ‘health_center’ cannot have parent of type ‘contact’
The medic docs recommend we have the new place type with properties
“type” set to contact
“contact_type” set to the custom_place_name
Here is a sample doc
{
-
_id: “746bd4b2-7902-4914-b822-f1aaa2558407”,
-
_rev: “1-f2fce26d7635201acf882e0e34e7d0bc”,
-
parent: {
- _id: “27a70730-eba6-4409-9cbe-4934a50c02fa”},
-
type: “contact”,
-
contact_type: “supervisor_area”,
-
contact: {
- _id: “029be058-aae5-48bd-85c3-9ee4419da7ac”},
-
name: “Supervisor Abby Supervisor Area”,
-
geolocation: “”,
-
peer_group_notes: “”,
-
reported_date: 1632995571188
}
How To Reproduce The Issue
- Creat a Supervisor Area place
- Get a list of CHW Areas you need to migrate to the new Level
- Use the medic-conf move-contacts command
- See error
Expected Behavior
I expect to migrate contacts in the new hierarchy without errors.
Environment
- Instance: (eg: alpha.dev.medicmobile.org, etc)
- Browser: (eg: Firefox, Chrome, incognito mode, etc, which worked, which didn’t)
- Client platform: (eg: Windows, MacOS, Linux)
- App: (eg: webapp, admin, sentinel, api, couch2pg, medic-conf, etc)
- Version: 3.7
Additional Context
The workaround was to edit the “type” property to have the value "custom_place_name’
e.g “type”: “supervisor_area”. But will need to later change it back to “type”:“contact” after a successful migration.