Scope report viewing to specific top level place

Consider the following hierarchy:

NPO

  • DHO
  • Team Area
    • Team Lead
    • Indawo

In this scenario I’ve created two NPOs, and completed a household task on the one, and an individual task on the other. Logging in with admin you can see both, as expected, and logging in with CHW you’re able to see only the relevant 1.

As per this discussion we have switched the DHO role to an offline user with the goal of scoping the viewable reports to a specific NPO.
However making this change seemed to have no effect as can be seen in the attached screen shots.
Am I missing something?


While logged in as admin:

The hierarchy:
image

The two reports (one per NPO):
image


The DHO user info:

Configured as offline:

While logged in as DHO:

The hierarchy:
image

The reports:
image

This is not the behavior that I would expect to see. :thinking: This hierarchy and inheritance stuff gets really confusing, really quickly and maybe I am not understanding the setup correctly.

Based on your screenshots, I am thinking the hierarchy of places/people/reports looks something like this:

If this is the case, I would expect DHO Test to be able to see the COPC: Individual Activity report, but not the COPC: Household Screening report (@diana can let me know if I am right or just going crazy here…).

@Anro can you confirm if your actual hierarchy matches this diagram? Especially: is the contact for the DHO Test user a child of NPO?

Exactly my thoughts :smile: , initially thought this to be a quick change.
That’s completely understandable, I’ll add an excerpt of our base_settings.json to supply more context surrounding our setup.

@jkuester your understanding of the hierarchy is spot on.
The DHO is indeed a child of the NPO as can be seen here (while logged in as admin):

The Individual Activity on the household member within NPO:
(as a side note, I’ve seen that the “Person” level tasks/reports show up on their immediate parent level - I’m guessing this is expected behavior)

The Household Screening on the household within the Test NPO:

base_settings.json:

{
  ...
  "roles": {
    "dho": {
      "name": "usertype.dho",
      "offline": true
    },
    "team_lead": {
      "name": "usertype.team_lead",
      "offline": true
    },
    "chw": {
      "name": "usertype.chw",
      "offline": true
    },
    "admin_support": {
      "name": "usertype.admin_support",
      "offline": false
    },
    "system_admin": {
      "name": "usertype.admin",
      "offline": false
    },

    "db_reader": {
      "name": "usertype.db_reader",
      "offline": false
    }
  },
  ...
  "place_hierarchy_types": [
    "npo",
    "team_area",
    "indawo",
    "dwelling",
    "household"
  ],
  "contact_types": [
    {
      "id": "npo",
      "name_key": "contact.type.npo",
      "group_key": "contact.type.npo.plural",
      "create_key": "contact.type.npo.new",
      "edit_key": "contact.type.place.edit",
      "icon": "wcg-npo",
      "create_form": "form:contact:npo:create",
      "edit_form": "form:contact:npo:edit"
    },
    {
      "id": "dho",
      "name_key": "contact.type.dho",
      "group_key": "contact.type.dho.plural",
      "create_key": "contact.type.dho.new",
      "edit_key": "contact.type.dho.edit",
      "primary_contact_key": "contact.type.dho-primary",
      "parents": [
        "npo"
      ],
      "icon": "wcg-dho",
      "create_form": "form:contact:dho:create",
      "edit_form": "form:contact:dho:edit",
      "person": true
    },
    {
      "id": "team_area",
      "name_key": "contact.type.team_area",
      "group_key": "contact.type.team_area.plural",
      "create_key": "contact.type.team_area.new",
      "edit_key": "contact.type.place.edit",
      "parents": [
        "npo"
      ],
      "icon": "wcg-team_area",
      "create_form": "form:contact:team_area:create",
      "edit_form": "form:contact:team_area:edit"
    },
    {
      "id": "team_lead",
      "name_key": "contact.type.team_lead",
      "group_key": "contact.type.team_lead.plural",
      "create_key": "contact.type.team_lead.new",
      "edit_key": "contact.type.team_lead.edit",
      "primary_contact_key": "contact.type.team_lead-primary",
      "parents": [
        "team_area"
      ],
      "icon": "wcg-team_lead",
      "create_form": "form:contact:team_lead:create",
      "edit_form": "form:contact:team_lead:edit",
      "person": true
    },
    {
      "id": "indawo",
      "name_key": "contact.type.indawo",
      "group_key": "contact.type.indawo.plural",
      "create_key": "contact.type.indawo.new",
      "edit_key": "contact.type.place.edit",
      "parents": [
        "team_area"
      ],
      "icon": "wcg-indawo",
      "create_form": "form:contact:indawo:create",
      "edit_form": "form:contact:indawo:edit"
    },
    {
      "id": "chw",
      "name_key": "contact.type.chw",
      "group_key": "contact.type.chw.plural",
      "create_key": "contact.type.chw.new",
      "edit_key": "contact.type.chw.edit",
      "primary_contact_key": "contact.type.chw-primary",
      "parents": [
        "indawo"
      ],
      "icon": "wcg-chw",
      "create_form": "form:contact:chw:create",
      "edit_form": "form:contact:chw:edit",
      "person": true
    },
    {
      "id": "dwelling",
      "name_key": "contact.type.dwelling",
      "group_key": "contact.type.dwelling.plural",
      "create_key": "contact.type.dwelling.new",
      "edit_key": "contact.type.place.edit",
      "parents": [
        "indawo"
      ],
      "icon": "wcg-dwelling",
      "create_form": "form:contact:dwelling:create",
      "edit_form": "form:contact:dwelling:edit"
    },
    {
      "id": "household",
      "name_key": "contact.type.household",
      "group_key": "contact.type.household.plural",
      "create_key": "contact.type.household.new",
      "edit_key": "contact.type.household.edit",
      "parents": [
        "dwelling"
      ],
      "icon": "wcg-household",
      "create_form": "form:contact:household:create",
      "edit_form": "form:contact:household:edit",
      "count_visits": true
    },
    {
      "id": "hhm",
      "name_key": "contact.type.hhm",
      "group_key": "contact.type.hhm.plural",
      "create_key": "contact.type.hhm.new",
      "edit_key": "contact.type.hhm.edit",
      "primary_contact_key": "contact.type.hhm-primary",
      "parents": [
        "household"
      ],
      "icon": "wcg-hhm",
      "create_form": "form:contact:hhm:create",
      "edit_form": "form:contact:hhm:edit",
      "person": true
    }
  ]
}

Hi @Anro

This is a mystery indeed. Can you please share the JSON body of both reports and the submitting contact?

2 Likes

Hi @diana

Of course, thank you so much for taking the time to look into this!
Due to the push for app form changes this side, I’m going to add the entire relevant hierarchy here as well as the records for both NPOs.
I’d rather have all details available as I’m unsure if I’ll be in a place to reproduce this exact structure later on.
Apologies for it being such a cumbersome response.


NPO

NPO:

{
  "_id": "0bd0456e61e8d00a621e041570000025",
  "_rev": "2-4d9731340c69d47c40ec8c47c491207b",
  "type": "contact",
  "name": "NPO",
  "projects": "C-SHARP",
  "location_type": "metro",
  "sub_districts": "eastern",
  "nodes": "eastern:NOMZAMO_CDC:eastern",
  "contact_type": "npo",
  "reported_date": 1697445684241,
  "contact": {
    "_id": "0bd0456e61e8d00a621e041570000dc6",
    "parent": {
      "_id": "0bd0456e61e8d00a621e041570000025"
    }
  }
}

DHO:

{
  "_id": "0bd0456e61e8d00a621e041570000dc6",
  "_rev": "1-d2d6d0e2a0e4b478b7ecd1c0f2900121",
  "type": "contact",
  "first_name": "DHO",
  "last_name": "TEST",
  "email": "dho_test@gmail.com",
  "phone": "+27713211501",
  "primary": true,
  "contact_type": "dho",
  "name": "DHO TEST",
  "parent": {
    "_id": "0bd0456e61e8d00a621e041570000025"
  },
  "reported_date": 1697445684337
}

Team Area 1:

{
  "_id": "0bd0456e61e8d00a621e04157000189e",
  "_rev": "1-536bf114ee50259b7ab58c39adbb5c21",
  "type": "contact",
  "name": "Team Area 1",
  "sub_districts": "eastern",
  "nodes": "eastern:NOMZAMO_CDC:eastern",
  "contact_type": "team_area",
  "parent": {
    "_id": "0bd0456e61e8d00a621e041570000025"
  },
  "reported_date": 1697445684713
}

Indawo 1:

{
  "_id": "0bd0456e61e8d00a621e04157000445d",
  "_rev": "1-4a182697741484567f9b89e7dcfa7fd9",
  "type": "contact",
  "name": "Indawo 1",
  "contact_type": "indawo",
  "parent": {
    "_id": "0bd0456e61e8d00a621e04157000189e",
    "parent": {
      "_id": "0bd0456e61e8d00a621e041570000025"
    }
  },
  "reported_date": 1697445686249
}

CHW (submitting contact):

{
  "_id": "0bd0456e61e8d00a621e041570006c8d",
  "_rev": "1-e6ab53cdced3111350ba2c259bfe918b",
  "type": "contact",
  "first_name": "CHW_1",
  "last_name": "TEST",
  "email": 0,
  "phone": "+27712371704",
  "contact_type": "chw",
  "name": "CHW_1 TEST",
  "parent": {
    "_id": "0bd0456e61e8d00a621e04157000445d",
    "parent": {
      "_id": "0bd0456e61e8d00a621e04157000189e",
      "parent": {
        "_id": "0bd0456e61e8d00a621e041570000025"
      }
    }
  },
  "reported_date": 1697445686759
}

Dwelling:

{
  "_id": "4404e761-d6c2-4265-8a94-db11790d8ac1",
  "_rev": "1-78751dfe09e3f83b99179f88da80e649",
  "parent": {
    "_id": "0bd0456e61e8d00a621e04157000445d",
    "parent": {
      "_id": "0bd0456e61e8d00a621e04157000189e",
      "parent": {
        "_id": "0bd0456e61e8d00a621e041570000025"
      }
    }
  },
  "type": "contact",
  "visit_date": "2023-09-25",
  "name": "Dwelling",
  "description": "",
  "postal_code": "7570",
  "location": "",
  "gps_issue": "",
  "gps_issue_other": "",
  "dwelling_type": "health_service",
  "dwelling_type_other": "",
  "residential_type": "",
  "health_service_type": "clinic",
  "personal_services_type": "",
  "g_retail": {
    "retail_type": "",
    "shop_type": "",
    "food_stores_type": ""
  },
  "g_entertainment": {
    "entertainment_type": "",
    "social_type": "",
    "sports_type": ""
  },
  "g_industrial": {
    "industrial_type": "",
    "workshop_type": ""
  },
  "office_type": "",
  "education_type": "",
  "g_travel_related": {
    "travel_related_type": "",
    "transport_type": "",
    "short_stay_residential_type": ""
  },
  "g_public_services": {
    "public_services_type": "",
    "other_government_services_type": "",
    "parastatal_type": "",
    "community_services_type": ""
  },
  "outbuilding_type": "",
  "inaccessible_type": "",
  "open_space_type": "",
  "second_use": {
    "dwelling_type": "",
    "dwelling_type_other": "",
    "residential_type": "",
    "health_service_type": "",
    "personal_services_type": "",
    "g_retail": {
      "retail_type": "",
      "shop_type": "",
      "food_stores_type": ""
    },
    "g_entertainment": {
      "entertainment_type": "",
      "social_type": "",
      "sports_type": ""
    },
    "g_industrial": {
      "industrial_type": "",
      "workshop_type": ""
    },
    "office_type": "",
    "education_type": "",
    "g_travel_related": {
      "travel_related_type": "",
      "transport_type": "",
      "short_stay_residential_type": ""
    },
    "g_public_services": {
      "public_services_type": "",
      "other_government_services_type": "",
      "parastatal_type": "",
      "community_services_type": ""
    },
    "outbuilding_type": "",
    "inaccessible_type": "",
    "open_space_type": ""
  },
  "notes": "",
  "geolocation": "",
  "meta": {
    "created_by": "admin",
    "created_by_person_uuid": "",
    "created_by_place_uuid": ""
  },
  "contact_type": "dwelling",
  "reported_date": 1697445915410,
  "form_version": {
    "time": 1697445669439,
    "sha256": "d98d845b4d61cc58c2ec5b9c883fbd264446a5c7e69beabc7a15b2c1dad94e94"
  }
}

Household:

{
  "_id": "726e330e-47d7-40a2-b862-60e6f4206c19",
  "_rev": "1-fb99e991783f74b54d6495d397aa9cf4",
  "parent": {
    "_id": "4404e761-d6c2-4265-8a94-db11790d8ac1",
    "parent": {
      "_id": "0bd0456e61e8d00a621e04157000445d",
      "parent": {
        "_id": "0bd0456e61e8d00a621e04157000189e",
        "parent": {
          "_id": "0bd0456e61e8d00a621e041570000025"
        }
      }
    }
  },
  "type": "contact",
  "name": "Household",
  "reg_date": "2023-09-25",
  "consent_granted": "yes",
  "share_data_granted": "yes",
  "contact": {
    "_id": "882ebdc9-e3ac-442c-b85d-3d72c124b262"
  },
  "meta": {
    "created_by": "admin",
    "created_by_person_uuid": "",
    "created_by_place_uuid": ""
  },
  "contact_type": "household",
  "reported_date": 1697446039435,
  "form_version": {
    "time": 1697445670538,
    "sha256": "61a2245086ee00c4cc051ad52c1cae23635bb41d57ef4f98efc3e9240e5f772c"
  }
}

Household Member:

{
  "_id": "882ebdc9-e3ac-442c-b85d-3d72c124b262",
  "_rev": "1-0037793d2966e7a9ebe9a6ab256313b2",
  "type": "contact",
  "first_name": "Member",
  "middle_name": "",
  "last_name": "Test",
  "maiden_name": "",
  "name": "Member Test",
  "resident": "yes",
  "phone_raw": "",
  "phone_raw_alt": "",
  "obtained_personal_details": "no",
  "pmi_number": "",
  "sex": "other",
  "date_of_birth": "2023-10-05",
  "dob_method": "dob_confirmed",
  "weeks": "1",
  "months": "0",
  "years": "0",
  "age_unit": "Weeks",
  "age": "1",
  "when_member": "at_birth",
  "contact_type": "hhm",
  "meta": {
    "created_by": "admin",
    "created_by_person_uuid": "",
    "created_by_place_uuid": ""
  },
  "reported_date": 1697446039435,
  "parent": {
    "_id": "726e330e-47d7-40a2-b862-60e6f4206c19",
    "parent": {
      "_id": "4404e761-d6c2-4265-8a94-db11790d8ac1",
      "parent": {
        "_id": "0bd0456e61e8d00a621e04157000445d",
        "parent": {
          "_id": "0bd0456e61e8d00a621e04157000189e",
          "parent": {
            "_id": "0bd0456e61e8d00a621e041570000025"
          }
        }
      }
    }
  },
  "form_version": {
    "time": 1697445670538,
    "sha256": "61a2245086ee00c4cc051ad52c1cae23635bb41d57ef4f98efc3e9240e5f772c"
  }
}

Individual Activity:

{
  "_id": "fad0f3d8-e3fc-48d5-a2c1-a0b72fcbea9f",
  "_rev": "1-841571783065356621787d0d3ac4b7b6",
  "form": "copc-individualactivity",
  "type": "data_record",
  "content_type": "xml",
  "reported_date": 1697446783778,
  "contact": {
    "_id": "0bd0456e61e8d00a621e041570006c8d",
    "parent": {
      "_id": "0bd0456e61e8d00a621e04157000445d",
      "parent": {
        "_id": "0bd0456e61e8d00a621e04157000189e",
        "parent": {
          "_id": "0bd0456e61e8d00a621e041570000025"
        }
      }
    }
  },
  "from": "+27713211504",
  "form_version": {
    "time": 1697445665316,
    "sha256": "274a3789f669da64911a3f811e70a0407225cc911bff69813b0caefd1ac4e71b"
  },
  "hidden_fields": [
    "meta"
  ],
  "fields": {
    "inputs": {
      "meta": {
        "location": {
          "lat": "",
          "long": "",
          "error": "",
          "message": ""
        },
        "deprecatedID": ""
      },
      "source": "contact",
      "source_id": "",
      "task_id": "",
      "contact": {
        "_id": "882ebdc9-e3ac-442c-b85d-3d72c124b262",
        "patient_id": "",
        "name": "Member Test",
        "parent": {
          "_id": "726e330e-47d7-40a2-b862-60e6f4206c19",
          "name": "Household",
          "parent": {
            "_id": "4404e761-d6c2-4265-8a94-db11790d8ac1",
            "name": "Dwelling",
            "phone": "",
            "parent": {
              "_id": "0bd0456e61e8d00a621e04157000445d"
            }
          }
        }
      }
    },
    "patient_id": "882ebdc9-e3ac-442c-b85d-3d72c124b262",
    "patient_name": "Member Test",
    "client_info": {
      "belongsto": "Household",
      "note_place": "",
      "client_present": "yes",
      "visitdate": "2023-09-25",
      "visitsuccess": "yes"
    },
    "parent_info": {
      "mother_hhm": "no",
      "mother_name": "Not Known",
      "mother_alive": "yes",
      "father_hhm": "no",
      "father_name": "Not Known",
      "father_alive": "yes"
    },
    "individual_notes": "Here is a comment",
    "meta": {
      "instanceID": "uuid:c1bdc483-0702-4f9c-abce-b38816225a39"
    }
  },
  "geolocation_log": [
    {
      "timestamp": 1697446783786,
      "recording": {
        "latitude": 37.42532544431031,
        "longitude": -122.08555928266584,
        "altitude": 0,
        "accuracy": 114,
        "altitudeAccuracy": 0,
        "heading": null,
        "speed": null
      }
    }
  ],
  "geolocation": {
    "latitude": 37.42532544431031,
    "longitude": -122.08555928266584,
    "altitude": 0,
    "accuracy": 114,
    "altitudeAccuracy": 0,
    "heading": null,
    "speed": null
  }
}

Test NPO

NPO:

{
  "_id": "eb1927a6-90ee-4e0c-be30-a239b67ac45a",
  "_rev": "1-bd8b8e45e24c33d9fa3f4fe901b66370",
  "parent": "",
  "type": "contact",
  "name": "Test NPO",
  "location_type": "metro",
  "sub_districts": "eastern",
  "nodes": "eastern:EERSTE_RIVER_CDC:eastern",
  "contact": "",
  "geolocation": "",
  "meta": {
    "created_by": "admin",
    "created_by_person_uuid": "",
    "created_by_place_uuid": ""
  },
  "contact_type": "npo",
  "reported_date": 1697445815911,
  "form_version": {
    "time": 1697445671714,
    "sha256": "33cb84ec9200458d7c3ae1d40664b962dde426b8a6a1010c0f52d712e6bf8122"
  }
}

Team Area:

{
  "_id": "8cc8bdcf-c52b-4ed8-b0fb-cad7dbc34757",
  "_rev": "1-da43665384c2dbdccf8a3324d66ea7fa",
  "parent": {
    "_id": "eb1927a6-90ee-4e0c-be30-a239b67ac45a"
  },
  "type": "contact",
  "name": "Team Area",
  "sub_districts": "eastern",
  "nodes": "eastern:EERSTE_RIVER_CDC:eastern",
  "contact": "",
  "geolocation": "",
  "meta": {
    "created_by": "admin",
    "created_by_person_uuid": "",
    "created_by_place_uuid": ""
  },
  "contact_type": "team_area",
  "reported_date": 1697445839360,
  "form_version": {
    "time": 1697445672989,
    "sha256": "5453057456f6da5dea2814e7c5113576de80262d80b5347ae29b84697f859397"
  }
}

Indawo:

{
  "_id": "33be6736-9459-45ce-ac57-527c0ccd3d22",
  "_rev": "1-4a701f3b84507eb418a7292d5dbc50b2",
  "parent": {
    "_id": "8cc8bdcf-c52b-4ed8-b0fb-cad7dbc34757",
    "parent": {
      "_id": "eb1927a6-90ee-4e0c-be30-a239b67ac45a"
    }
  },
  "type": "contact",
  "name": "Indawo",
  "projects": "",
  "contact": "",
  "geolocation": "",
  "meta": {
    "created_by": "admin",
    "created_by_person_uuid": "",
    "created_by_place_uuid": ""
  },
  "contact_type": "indawo",
  "reported_date": 1697445858979,
  "form_version": {
    "time": 1697445671244,
    "sha256": "b0cf4aee67977fa475c038574aeff0550b3b38025aadbfe7dc40cfe0595b3750"
  }
}

CHW (submitting contact):

{
 "_id": "221e91d3-29f8-403f-9edb-65d09b0a4fa6",
 "_rev": "3-0c87aacdd8c44d44f93b552691fc4e9f",
 "parent": {
   "_id": "33be6736-9459-45ce-ac57-527c0ccd3d22",
   "parent": {
     "_id": "8cc8bdcf-c52b-4ed8-b0fb-cad7dbc34757",
     "parent": {
       "_id": "eb1927a6-90ee-4e0c-be30-a239b67ac45a"
     }
   }
 },
 "type": "contact",
 "user_for_contact": {},
 "first_name": "anro",
 "last_name": "chw",
 "name": "anro chw",
 "email": "",
 "phone": "+27713211509",
 "role": "chw",
 "meta": {
   "created_by": "admin",
   "created_by_person_uuid": "",
   "created_by_place_uuid": ""
 },
 "contact_type": "chw",
 "reported_date": 1697446312856,
 "form_version": {
   "time": 1697445668095,
   "sha256": "391b660deb6ce223ef5154d63b95ca08395b87fd5320f6833022897c090e950e"
 }
}

Dwelling:

{
  "_id": "13c09771-558a-4fdc-a9ef-598e4c750736",
  "_rev": "1-cd306e806321e71797ba1e2e7c0b7f40",
  "parent": {
    "_id": "33be6736-9459-45ce-ac57-527c0ccd3d22",
    "parent": {
      "_id": "8cc8bdcf-c52b-4ed8-b0fb-cad7dbc34757",
      "parent": {
        "_id": "eb1927a6-90ee-4e0c-be30-a239b67ac45a"
      }
    }
  },
  "type": "contact",
  "visit_date": "2023-09-25",
  "name": "Dwelling",
  "description": "",
  "postal_code": "7570",
  "location": "",
  "gps_issue": "",
  "gps_issue_other": "",
  "dwelling_type": "residential",
  "dwelling_type_other": "",
  "residential_type": "flats",
  "health_service_type": "",
  "personal_services_type": "",
  "g_retail": {
    "retail_type": "",
    "shop_type": "",
    "food_stores_type": ""
  },
  "g_entertainment": {
    "entertainment_type": "",
    "social_type": "",
    "sports_type": ""
  },
  "g_industrial": {
    "industrial_type": "",
    "workshop_type": ""
  },
  "office_type": "",
  "education_type": "",
  "g_travel_related": {
    "travel_related_type": "",
    "transport_type": "",
    "short_stay_residential_type": ""
  },
  "g_public_services": {
    "public_services_type": "",
    "other_government_services_type": "",
    "parastatal_type": "",
    "community_services_type": ""
  },
  "outbuilding_type": "",
  "inaccessible_type": "",
  "open_space_type": "",
  "second_use": {
    "dwelling_type": "",
    "dwelling_type_other": "",
    "residential_type": "",
    "health_service_type": "",
    "personal_services_type": "",
    "g_retail": {
      "retail_type": "",
      "shop_type": "",
      "food_stores_type": ""
    },
    "g_entertainment": {
      "entertainment_type": "",
      "social_type": "",
      "sports_type": ""
    },
    "g_industrial": {
      "industrial_type": "",
      "workshop_type": ""
    },
    "office_type": "",
    "education_type": "",
    "g_travel_related": {
      "travel_related_type": "",
      "transport_type": "",
      "short_stay_residential_type": ""
    },
    "g_public_services": {
      "public_services_type": "",
      "other_government_services_type": "",
      "parastatal_type": "",
      "community_services_type": ""
    },
    "outbuilding_type": "",
    "inaccessible_type": "",
    "open_space_type": ""
  },
  "notes": "",
  "geolocation": "",
  "meta": {
    "created_by": "admin",
    "created_by_person_uuid": "",
    "created_by_place_uuid": ""
  },
  "contact_type": "dwelling",
  "reported_date": 1697445879146,
  "form_version": {
    "time": 1697445669439,
    "sha256": "d98d845b4d61cc58c2ec5b9c883fbd264446a5c7e69beabc7a15b2c1dad94e94"
  }
}

Household:

{
  "_id": "ce2f5979-1c8a-483b-ba61-355aaef91c7b",
  "_rev": "1-f25f2e79ed7a110470a005db0655002c",
  "parent": {
    "_id": "13c09771-558a-4fdc-a9ef-598e4c750736",
    "parent": {
      "_id": "33be6736-9459-45ce-ac57-527c0ccd3d22",
      "parent": {
        "_id": "8cc8bdcf-c52b-4ed8-b0fb-cad7dbc34757",
        "parent": {
          "_id": "eb1927a6-90ee-4e0c-be30-a239b67ac45a"
        }
      }
    }
  },
  "type": "contact",
  "name": "Household",
  "reg_date": "2023-09-25",
  "consent_granted": "yes",
  "share_data_granted": "yes",
  "contact": {
    "_id": "5000fc4e-291f-4f68-91c2-40dfae79375c"
  },
  "meta": {
    "created_by": "admin",
    "created_by_person_uuid": "",
    "created_by_place_uuid": ""
  },
  "contact_type": "household",
  "reported_date": 1697446088875,
  "form_version": {
    "time": 1697445670538,
    "sha256": "61a2245086ee00c4cc051ad52c1cae23635bb41d57ef4f98efc3e9240e5f772c"
  }
}

Household member:

{
  "_id": "5000fc4e-291f-4f68-91c2-40dfae79375c",
  "_rev": "1-4264c369e0941400f46cafdd741dd3d7",
  "type": "contact",
  "first_name": "Member",
  "middle_name": "",
  "last_name": "Test",
  "maiden_name": "",
  "name": "Member Test",
  "resident": "yes",
  "phone_raw": "",
  "phone_raw_alt": "",
  "obtained_personal_details": "no",
  "pmi_number": "",
  "sex": "other",
  "date_of_birth": "2023-10-05",
  "dob_method": "dob_confirmed",
  "weeks": "1",
  "months": "0",
  "years": "0",
  "age_unit": "Weeks",
  "age": "1",
  "when_member": "at_birth",
  "contact_type": "hhm",
  "meta": {
    "created_by": "admin",
    "created_by_person_uuid": "",
    "created_by_place_uuid": ""
  },
  "reported_date": 1697446088875,
  "parent": {
    "_id": "ce2f5979-1c8a-483b-ba61-355aaef91c7b",
    "parent": {
      "_id": "13c09771-558a-4fdc-a9ef-598e4c750736",
      "parent": {
        "_id": "33be6736-9459-45ce-ac57-527c0ccd3d22",
        "parent": {
          "_id": "8cc8bdcf-c52b-4ed8-b0fb-cad7dbc34757",
          "parent": {
            "_id": "eb1927a6-90ee-4e0c-be30-a239b67ac45a"
          }
        }
      }
    }
  },
  "form_version": {
    "time": 1697445670538,
    "sha256": "61a2245086ee00c4cc051ad52c1cae23635bb41d57ef4f98efc3e9240e5f772c"
  }
}

Household screening:

{
  "_id": "4ea50fd4-58ad-4d26-a4a6-77705a42bdd8",
  "_rev": "1-d611aac8a36072e80f2fac932299cf50",
  "form": "copc-hhscreening",
  "type": "data_record",
  "content_type": "xml",
  "reported_date": 1697446445577,
  "contact": {
    "_id": "221e91d3-29f8-403f-9edb-65d09b0a4fa6",
    "parent": {
      "_id": "33be6736-9459-45ce-ac57-527c0ccd3d22",
      "parent": {
        "_id": "8cc8bdcf-c52b-4ed8-b0fb-cad7dbc34757",
        "parent": {
          "_id": "eb1927a6-90ee-4e0c-be30-a239b67ac45a"
        }
      }
    }
  },
  "from": "+27713211508",
  "form_version": {
    "time": 1697445664274,
    "sha256": "5ce943fd64af74cef31cfd47e587c246e4f72d85e614e2b42d6645865ba908e1"
  },
  "hidden_fields": [
    "meta"
  ],
  "fields": {
    "inputs": {
      "meta": {
        "location": {
          "lat": "",
          "long": "",
          "error": "",
          "message": ""
        },
        "deprecatedID": ""
      },
      "source": "contact",
      "source_id": "",
      "task_id": "",
      "contact": {
        "_id": "ce2f5979-1c8a-483b-ba61-355aaef91c7b",
        "patient_id": "",
        "name": "Household",
        "parent": {
          "_id": "13c09771-558a-4fdc-a9ef-598e4c750736",
          "parent": {
            "_id": "33be6736-9459-45ce-ac57-527c0ccd3d22",
            "name": "Indawo",
            "phone": "",
            "parent": {
              "_id": "8cc8bdcf-c52b-4ed8-b0fb-cad7dbc34757"
            }
          }
        }
      }
    },
    "patient_id": "ce2f5979-1c8a-483b-ba61-355aaef91c7b",
    "patient_name": "Household",
    "hh_visit_info": {
      "hh_visit_date": "2023-09-25",
      "hh_visit_outcome": "visit_success",
      "hh_visit_type": "visit_type_campaign"
    },
    "successful_visit": {
      "hh_respondent_info": {
        "hh_visit_respondent": "yes",
        "hh_visit_respondent_hhm": "5000fc4e-291f-4f68-91c2-40dfae79375c"
      },
      "hh_hh_info": {
        "hh_bedrooms": "5",
        "hh_electricity": "electricity_offgrid",
        "hh_water_source": "ws_piped_house",
        "hh_toilet": "toilet_flush_public"
      }
    },
    "hh_notes": "This is a comment.",
    "meta": {
      "instanceID": "uuid:c4dc4950-51fb-4bf8-9ada-73c463439c93"
    }
  },
  "geolocation_log": [
    {
      "timestamp": 1697446445586,
      "recording": {
        "latitude": 37.42532544431031,
        "longitude": -122.08555928266584,
        "altitude": 0,
        "accuracy": 114,
        "altitudeAccuracy": 0,
        "heading": null,
        "speed": null
      }
    }
  ],
  "geolocation": {
    "latitude": 37.42532544431031,
    "longitude": -122.08555928266584,
    "altitude": 0,
    "accuracy": 114,
    "altitudeAccuracy": 0,
    "heading": null,
    "speed": null
  }
}

Hi @anro

Nothing looks wrong with your docs, checking your lineages, there is no indication as to why your user would see the additional report.
I even saved your docs locally, created a user and logged them in, and I do not see your additional household screening report.

If you try to login with this user in a fresh browser, do you still get that report?
Have you made any changes to your user, like changing their place or their contact while they were logged into the browser you are showing us images from?

Thanks!

1 Like

Hi @diana

As suggested I’ve used a fresh browser, edge in this case, where I usually utilize Chrome and Firefox while developing - so no cache should be present.
Just in case I still cleared the cache by doing the following:

  1. Right click.
  2. Clicked “inspect”.
  3. Clicked on the “application” tab in dev tools.
  4. Clicked on the “storage” item in the nav tree on the left.
  5. Clicked on “clear site data”.

Cleared my local instance’s db and created the hierarchy again from scratch to match this thread’s.
Thereafter I logged in as each CHW and created the tests again as before.

Individual activity via CHW_1 for the NPO:

Household screening via anro-chw for the Test NPO:

I then logged in with the dho for the npo:



As you can see I’m still getting the same result.
I have not made any changes to their place or contact of these users.
Though I’m not sure if it’s worth mentioning, we are using the user_for_contact feature, and I did change each user from an SMS user to a login one.

Hi @Anro

Though I’m not sure if it’s worth mentioning, we are using the user_for_contact feature,

It is worth mentioning, because user_for_contact could create this situation.
can you give some details about how you are using user_for_contact ?
Also, it can be helpful if you could share your instance URL and login credentials so I can check this, in case it’s not caused by user_for_contacts.

Thanks!

1 Like

Hi @diana

We’re using the user_for_contact to create a login user for the newly created DHO, Team Lead, and CHW. All of these will initially be SMS login link users.

Thereafter, we change the users to a credential user by doing to the following:

  1. Navigate to the users tab on the app management portal.
  2. Click on the relevant user and click on the disable login via sms.
  3. Supply a password and save.

I’ll be sending over those details in personal message now.

After checking the instance, and further discussions with @Anro, we found that the cause of the problem was existing users’ online/offline status not changing when switching a role from being online only to offline.

The user that @Anro was using to log in was created when the role they were assigned was online, and later the role was edited, however the user remained an online user.

I’ve created an issue to improve how the app behaves when roles are edited: Changing a role from being "online" to "offline" does not also change status of existing users having this role · Issue #8668 · medic/cht-core · GitHub

2 Likes