-
Notifications
You must be signed in to change notification settings - Fork 1
Documentation on Patients Referred to Secondary Unit for Comfort Devices and Patient care #107
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-460
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.
+95
−0
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
47 changes: 47 additions & 0 deletions
47
Care/Operations/patients_referred_to_secondary_unit_for_comfort_devices_kc.md
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,47 @@ | ||
|
|
||
| # Patients Referred to Secondary Unit for Comfort Devices - KC | ||
|
|
||
| > Count of active (non-cancelled, non-rejected) resource requests in the `comfort_devices` category — i.e. patients referred to a secondary unit for comfort devices | ||
|
|
||
| ## Purpose | ||
|
|
||
| Operational metric for KC showing how many comfort-device resource requests have been raised by a facility (and optionally a specific staff member) in a given period. A "resource request" here represents a referral / request for comfort device support (e.g. air bed, wheelchair, walker) from one facility to another. | ||
|
|
||
| ## Parameters | ||
|
|
||
| | Parameter | Type | Description | Example | | ||
| |-----------|------|-------------|---------| | ||
| | `facility_id` | TEXT (UUID) | Filter by originating facility's external ID | `'a1b2c3d4-...'` | | ||
| | `created_date` | DATE / range | Metabase date filter (typically bound to `emr_resourcerequest.created_date`) | `'2026-06-01'` | | ||
| | `staff_name` | TEXT | Filter by the creating user's full name (`prefix + first + last`, trimmed) | `'Dr Asha Menon'` | | ||
|
|
||
| --- | ||
|
|
||
| ## Query | ||
|
|
||
| ```sql | ||
| SELECT | ||
| COUNT(*) | ||
| FROM | ||
| emr_resourcerequest | ||
| JOIN facility_facility ON emr_resourcerequest.origin_facility_id = facility_facility.id | ||
| JOIN users_user ON emr_resourcerequest.created_by_id = users_user.id | ||
| WHERE | ||
| emr_resourcerequest.category IN ('comfort_devices', 'COMFORT_DEVICES') | ||
| AND emr_resourcerequest.status NOT IN ('cancelled', 'rejected') | ||
| --[[AND facility_facility.external_id::text = {{facility_id}}]] | ||
| --[[AND {{created_date}}]] | ||
| --[[AND TRIM(COALESCE(users_user.prefix || ' ', '') || users_user.first_name || ' ' || COALESCE(users_user.last_name, '')) = {{staff_name}}]] | ||
| ``` | ||
|
|
||
|
|
||
| ## Notes | ||
|
|
||
| - **Metabase filters:** | ||
| - `[[AND {{created_date}}]]` is a field filter — bind it to `emr_resourcerequest.created_date` in the Metabase variable settings. | ||
| - `{{facility_id}}` and `{{staff_name}}` are exact-match text filters. | ||
|
|
||
| *Last updated: 2026-06-01* | ||
|
|
||
| ```` | ||
|
sonzsara marked this conversation as resolved.
|
||
|
|
||
48 changes: 48 additions & 0 deletions
48
Care/Operations/patients_referred_to_secondary_unit_for_patientcare_kc.md
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,48 @@ | ||
|
|
||
| # Patients Referred to Secondary Unit for Patient Care - KC | ||
|
|
||
| > Count of active (non-cancelled, non-rejected) resource requests in the `patient_care` category — i.e. patients referred to a secondary unit for patient care | ||
|
|
||
| ## Purpose | ||
|
|
||
| Operational metric for KC showing how many patient-care resource requests have been raised by a facility (and optionally a specific staff member) in a given period. A "resource request" here represents a referral / request for patient-care services from one facility to another. | ||
|
|
||
| ## Parameters | ||
|
|
||
| | Parameter | Type | Description | Example | | ||
| |-----------|------|-------------|---------| | ||
| | `facility_id` | TEXT (UUID) | Filter by originating facility's external ID | `'a1b2c3d4-...'` | | ||
| | `created_date` | DATE / range | Metabase date filter (typically bound to `emr_resourcerequest.created_date`) | `'2026-06-01'` | | ||
| | `staff_name` | TEXT | Filter by the creating user's full name (`prefix + first + last`, trimmed) | `'Dr Asha Menon'` | | ||
|
|
||
| --- | ||
|
|
||
| ## Query | ||
|
|
||
| ```sql | ||
| SELECT | ||
| COUNT(*) | ||
| FROM | ||
| emr_resourcerequest | ||
| JOIN facility_facility ON emr_resourcerequest.origin_facility_id = facility_facility.id | ||
| JOIN users_user ON emr_resourcerequest.created_by_id = users_user.id | ||
| WHERE | ||
| emr_resourcerequest.category IN ('patient_care', 'PATIENT_CARE') | ||
| AND emr_resourcerequest.status NOT IN ('cancelled', 'rejected') | ||
| --[[AND facility_facility.external_id::text = {{facility_id}}]] | ||
| --[[AND {{created_date}}]] | ||
| --[[AND TRIM(COALESCE(users_user.prefix || ' ', '') || users_user.first_name || ' ' || COALESCE(users_user.last_name, '')) = {{staff_name}}]] | ||
|
sonzsara marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
|
|
||
| ## Notes | ||
|
|
||
| - **Metabase filters:** | ||
| - `[[AND {{created_date}}]]` is a field filter — bind it to `emr_resourcerequest.created_date` in the Metabase variable settings. | ||
| - `{{facility_id}}` and `{{staff_name}}` are exact-match text filters. | ||
|
|
||
|
|
||
| *Last updated: 2026-06-01* | ||
|
|
||
| ```` | ||
|
sonzsara marked this conversation as resolved.
|
||
|
|
||
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.