-
Notifications
You must be signed in to change notification settings - Fork 1
Add report on new MLSP joined users with query and parameters #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sonzsara
wants to merge
1
commit into
main
Choose a base branch
from
ENG-691
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
|
|
||
| # Report on New MLSP Joined | ||
| > Active users belonging to a JAK facility organization with their join date | ||
|
|
||
| ## Purpose | ||
|
|
||
| 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. | ||
|
|
||
| ## Parameters | ||
|
|
||
| | Parameter | Type | Description | Example | | ||
| |-----------|------|-------------|---------| | ||
| | `date_joined` | DATE / range | Metabase date filter (typically bound to `users_user.date_joined`) | `'2026-06-01'` | | ||
|
|
||
| --- | ||
|
|
||
| ## Query | ||
|
|
||
| ```sql | ||
| SELECT DISTINCT | ||
| users_user.id, | ||
| users_user.first_name || ' ' || users_user.last_name AS full_name, | ||
| users_user.date_joined | ||
| FROM users_user | ||
| JOIN emr_facilityorganizationuser | ||
| ON users_user.id = emr_facilityorganizationuser.user_id | ||
| JOIN emr_facilityorganization | ||
| ON emr_facilityorganizationuser.organization_id = emr_facilityorganization.id | ||
| WHERE users_user.is_active = TRUE | ||
| AND LOWER(emr_facilityorganization.name) LIKE '%jak%' | ||
| --[[AND {{date_joined}}]] | ||
| ORDER BY full_name; | ||
|
sonzsara marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| ## Notes | ||
|
|
||
| - **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. | ||
| - **Metabase filter:** | ||
| - `[[AND {{date_joined}}]]` is a field filter — bind it to `users_user.date_joined` in the Metabase variable settings. | ||
| - Results are ordered alphabetically by `full_name`. | ||
|
|
||
| *Last updated: 2026-07-06* | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.