From b4cd03ece07d02936d6992ab27c6b37a318c285a Mon Sep 17 00:00:00 2001 From: sonzsara Date: Mon, 31 Aug 2026 12:10:25 +0530 Subject: [PATCH 1/3] Add documentation for list of users with manager role assigned to specific organizations --- ...e_assigned_to_specific_organizations_kc.md | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Care/Organisation/list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md diff --git a/Care/Organisation/list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md b/Care/Organisation/list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md new file mode 100644 index 0000000..7e5e60c --- /dev/null +++ b/Care/Organisation/list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md @@ -0,0 +1,44 @@ + +# List of Users with Manager Role Assigned to Specific Organizations + +> Staff members with a specific role assignment at a specific organization + +## Purpose + +Lists users assigned to the manager role (`role_id = 100`) for the selected organization (`organization_id = 101`), including the staff member's display name, organization name, and role name. + +## Parameters + +| Parameter | Type | Description | Example | +|-----------|------|-------------|---------| +| *(none)* | - | Query uses hardcoded role and organization ids | - | + +--- + +## Query + +```sql +SELECT + TRIM(COALESCE(u.prefix || ' ', '') || u.first_name || ' ' || u.last_name) AS staff_name, + o.name AS organization_name, + r.name AS role_name +FROM emr_organizationuser ou +INNER JOIN users_user u + ON u.id = ou.user_id +INNER JOIN emr_organization o + ON o.id = ou.organization_id + AND o.deleted = FALSE +INNER JOIN security_rolemodel r + ON r.id = ou.role_id +WHERE ou.role_id = 100 + AND ou.organization_id = 101 +ORDER BY staff_name; +``` + +## Notes + +- **Hardcoded filters:** `ou.role_id = 100` and `ou.organization_id = 101` are fixed in the query. Update these values if you want to inspect a different role or organization. +- **No Metabase variables:** The query currently has no optional `[[...]]` filters and runs as a static lookup. +- Results are ordered alphabetically by staff name. + +*Last updated: 2026-08-31* From 2245442c1f20db8e386ecb99503158efd10839e2 Mon Sep 17 00:00:00 2001 From: Sona Sara Shibu Date: Mon, 31 Aug 2026 15:18:26 +0530 Subject: [PATCH 2/3] Update list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md --- ...s_with_manager_role_assigned_to_specific_organizations_kc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Care/Organisation/list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md b/Care/Organisation/list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md index 7e5e60c..97f208c 100644 --- a/Care/Organisation/list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md +++ b/Care/Organisation/list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md @@ -27,11 +27,11 @@ INNER JOIN users_user u ON u.id = ou.user_id INNER JOIN emr_organization o ON o.id = ou.organization_id - AND o.deleted = FALSE INNER JOIN security_rolemodel r ON r.id = ou.role_id WHERE ou.role_id = 100 AND ou.organization_id = 101 + AND ou.deleted = FALSE ORDER BY staff_name; ``` From 76adac91fce3d92fc1d13b934d33a81bf5dada68 Mon Sep 17 00:00:00 2001 From: Sona Sara Shibu Date: Tue, 8 Sep 2026 11:10:45 +0530 Subject: [PATCH 3/3] Update list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md --- ...s_with_manager_role_assigned_to_specific_organizations_kc.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Care/Organisation/list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md b/Care/Organisation/list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md index 97f208c..9118982 100644 --- a/Care/Organisation/list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md +++ b/Care/Organisation/list_of_users_with_manager_role_assigned_to_specific_organizations_kc.md @@ -32,6 +32,8 @@ INNER JOIN security_rolemodel r WHERE ou.role_id = 100 AND ou.organization_id = 101 AND ou.deleted = FALSE + AND u.deleted = FALSE + AND r.deleted = FALSE ORDER BY staff_name; ```