Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Metabase query documentation page to report aggregated medication dispense totals for Pallium, grouped by medicine, including total quantity dispensed and billed amount.
Changes:
- Introduces a new “Medication Dispense Summary - Pallium” markdown query doc.
- Provides a parameterized (optional) Metabase date filter and an aggregation query over completed dispenses with billed/paid charge items.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+21
to
+24
| SELECT | ||
| pk.name AS medicine_name, | ||
| SUM(ci.total_price) AS total_price, | ||
| SUM(md.quantity) AS total_quantity_dispensed |
|
|
||
| ## Purpose | ||
|
|
||
| Summary view of completed medication dispenses at Pallium, grouped by medicine. Each row shows the total quantity dispensed and total billed amount for a medicine. |
Comment on lines
+22
to
+24
| pk.name AS medicine_name, | ||
| SUM(ci.total_price) AS total_price, | ||
| SUM(md.quantity) AS total_quantity_dispensed |
Comment on lines
+30
to
+32
| WHERE md.status = 'completed' | ||
| AND ci.status IN ('billed','paid') | ||
| --[[AND {{created_date}}]] |
Comment on lines
+39
to
+41
| - **Metabase filters:** | ||
| - `[[AND {{created_date}}]]` is a field filter — bind it to `md.created_date` in the Metabase variable settings. | ||
| - Only dispenses with `status = 'completed'` are included. |
abhimanyurajeesh
approved these changes
Jul 14, 2026
abhimanyurajeesh
left a comment
Collaborator
There was a problem hiding this comment.
LGTM just update the notes to include the charge item status also
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Provides medication dispense summary by medicine with total quantity dispensed and total revenue