Skip to content

Add count of scan and the revenue collected query#92

Open
sonzsara wants to merge 6 commits into
mainfrom
ENG-180
Open

Add count of scan and the revenue collected query#92
sonzsara wants to merge 6 commits into
mainfrom
ENG-180

Conversation

@sonzsara
Copy link
Copy Markdown
Contributor

@sonzsara sonzsara commented May 4, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds two new SSMM-focused analytics query documents intended for use in the “24 main dashboard” to (1) count scan charge items and (2) sum scan revenue from invoices.

Changes:

  • Added a “Scan Count - SSMM” query doc under Care/Encounter/.
  • Added a “Scan Revenue - SSMM” query doc under Care/Accouting/.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.

File Description
Care/Encounter/count_of_scan.md Introduces a SQL query to count scan/imaging charge items (resource categories 32, 57).
Care/Accouting/revenue_scan_ssmm.md Introduces a SQL query to sum scan/imaging charge item revenue linked to invoices.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Care/Encounter/count_of_scan.md
Comment thread Care/Encounter/count_of_scan.md Outdated
Comment thread Care/Encounter/count_of_scan.md
Comment thread Care/Encounter/count_of_scan.md
Comment thread Care/Accounting/revenue_scan_ssmm.md
Comment thread Care/Accounting/revenue_scan_ssmm.md Outdated
Comment thread Care/Accounting/revenue_scan_ssmm.md
Comment thread Care/Accounting/revenue_scan_ssmm.md
Comment thread Care/Accounting/revenue_scan_ssmm.md
@sonzsara sonzsara enabled auto-merge May 4, 2026 10:51
Comment thread Care/Accounting/revenue_scan_ssmm.md Outdated
COALESCE(SUM(ci.total_price), 0) AS total_revenue
FROM emr_chargeitem ci
JOIN emr_chargeitemdefinition cid ON ci.charge_item_definition_id = cid.id
JOIN emr_resourcecategory rc ON cid.category_id = rc.id
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

join is unnecessary here if not doing further filtering on resource category columns.

Comment thread Care/Encounter/count_of_scan.md Outdated
FROM emr_chargeitem ci
JOIN emr_chargeitemdefinition cid ON ci.charge_item_definition_id = cid.id
JOIN emr_resourcecategory rc ON cid.category_id = rc.id
WHERE rc.id IN (32, 57)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

…tegory_id directly and remove unnecessary joins
@sonzsara sonzsara requested a review from Jacobjeevan May 20, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants