Skip to content

Commit 2c060fc

Browse files
committed
Add report on new MLSP joined users with query and parameters
1 parent cd1d68c commit 2c060fc

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
# Report on New MLSP Joined
3+
> Active users belonging to a JAK facility organization with their join date
4+
5+
## Purpose
6+
7+
Lists distinct active users who are assigned to a facility organization whose name contains **"jak"** (case-insensitive) — used to track newly on-boarded MLSP staff at JAK-linked organizations. Each row shows the user id, full name, and the `date_joined` timestamp.
8+
9+
## Parameters
10+
11+
| Parameter | Type | Description | Example |
12+
|-----------|------|-------------|---------|
13+
| `date_joined` | DATE / range | Metabase date filter (typically bound to `users_user.date_joined`) | `'2026-06-01'` |
14+
15+
---
16+
17+
## Query
18+
19+
```sql
20+
SELECT DISTINCT
21+
users_user.id,
22+
users_user.first_name || ' ' || users_user.last_name AS full_name,
23+
users_user.date_joined
24+
FROM users_user
25+
JOIN emr_facilityorganizationuser
26+
ON users_user.id = emr_facilityorganizationuser.user_id
27+
JOIN emr_facilityorganization
28+
ON emr_facilityorganizationuser.organization_id = emr_facilityorganization.id
29+
WHERE users_user.is_active = TRUE
30+
AND LOWER(emr_facilityorganization.name) LIKE '%jak%'
31+
--[[AND {{date_joined}}]]
32+
ORDER BY full_name;
33+
```
34+
35+
## Notes
36+
37+
- **Organization filter:** `LOWER(emr_facilityorganization.name) LIKE '%jak%'` matches any facility organization whose name contains the substring "jak" (case-insensitive). Update the pattern if the naming convention changes.
38+
- **Metabase filter:**
39+
- `[[AND {{date_joined}}]]` is a field filter — bind it to `users_user.date_joined` in the Metabase variable settings.
40+
- Results are ordered alphabetically by `full_name`.
41+
42+
*Last updated: 2026-07-06*

0 commit comments

Comments
 (0)