Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Care/Operations/userbycount_medicationadministered_ssmm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# User by Count - Medication Administered

> Number of medication administrations recorded by each user, ordered by activity level

## Purpose

This query tracks medication administration activity by user, showing how many medication administrations each staff member has recorded. It's useful for measuring staff workload, medication administration patterns, and identifying the most active administrators in the system.

## Parameters

| Parameter | Type | Description | Example |
|-----------|------|-------------|---------|
| `medicationadministration_date` | DATE | Filters administrations by creation date | `DATE(emr_medicationadministration.created_date) = '2026-01-06'` |
| `user_name` | TEXT | Filters by user name | `'John'` |

---

## Query

```sql
SELECT
CONCAT(u.first_name, ' ', u.last_name) AS user_name,
COUNT(ma.id) AS total_medicationadministration
FROM emr_medicationadministration ma
JOIN users_user u ON ma.created_by_id = u.id
WHERE ma.deleted = FALSE
-- [[AND {{medicationadministration_date}}]]
-- [[AND CONCAT(u.first_name, ' ', u.last_name) = {{user_name}}]]
GROUP BY u.first_name, u.last_name
ORDER BY total_medicationadministration DESC;
```


## Notes

- Only includes active medication administrations (deleted = FALSE)
- Results are ordered by administration count (highest to lowest) to show most active staff first


*Last updated: 2026-01-06*
41 changes: 41 additions & 0 deletions Care/Operations/userbycount_medicineprescribed_ssmm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# User by Count - Medicine Prescribed

> Number of medication prescribed by each user, ordered by activity level

## Purpose

This query tracks medication prescription activity by user, showing how many prescriptions each staff member has created. It's useful for measuring prescriber productivity, workload distribution, and identifying the most active prescribers in the system.

## Parameters

| Parameter | Type | Description | Example |
|-----------|------|-------------|---------|
| `medicationrequestprescription_date` | DATE | Filters prescriptions by creation date | `DATE(emr_medicationrequestprescription.created_date) = '2026-01-06'` |
| `user_name` | TEXT | Filters by user name | `'John'` |

---

## Query

```sql
SELECT
CONCAT(u.first_name, ' ', u.last_name) AS user_name,
COUNT(mrp.id) AS total_medicationrequestprescription
FROM emr_medicationrequestprescription mrp
JOIN users_user u ON mrp.prescribed_by_id = u.id
WHERE mrp.deleted = FALSE
-- [[AND {{medicationrequestprescription_date}}]]
-- [[AND CONCAT(u.first_name, ' ', u.last_name) = {{user_name}}]]
GROUP BY u.first_name, u.last_name
ORDER BY total_medicationrequestprescription DESC;
```



## Notes

- Only includes active prescriptions (deleted = FALSE)
- Results are ordered by prescription count (highest to lowest) to show most active prescribers first


*Last updated: 2026-01-06*
40 changes: 40 additions & 0 deletions Care/Operations/usersbycount_medicationdispensed_ssmm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Users by Count - Medication Dispensed

> Number of medication dispenses recorded by each user, ordered by activity level

## Purpose

This query tracks medication dispensing activity by user, showing how many medication dispenses each staff member has recorded. It's useful for measuring pharmacy staff workload, dispensing patterns, and identifying the most active dispensers in the system.

## Parameters

| Parameter | Type | Description | Example |
|-----------|------|-------------|---------|
| `medicationdispense_date` | DATE | Filters dispenses by creation date | `DATE(emr_medicationdispense.created_date) = '2026-01-06'` |
| `user_name` | TEXT | Filters by user name | `'John'` |

---

## Query

```sql
SELECT
CONCAT(u.first_name, ' ', u.last_name) AS user_name,
COUNT(md.id) AS total_medicationdispense
FROM emr_medicationdispense md
JOIN users_user u ON md.created_by_id = u.id
WHERE md.deleted = FALSE
-- [[AND {{medicationdispense_date}}]]
-- [[AND CONCAT(u.first_name, ' ', u.last_name) = {{user_name}}]]
GROUP BY u.first_name, u.last_name
ORDER BY total_medicationdispense DESC;
```


## Notes

- Only includes active medication dispenses (deleted = FALSE)
- Results are ordered by dispense count (highest to lowest) to show most active staff first


*Last updated: 2026-01-06*