Skip to content

Add OP Patient Due Report documentation with SQL query and parameters - #170

Open
sonzsara wants to merge 2 commits into
mainfrom
ENG-1148
Open

sonzsara wants to merge 2 commits into
mainfrom
ENG-1148

Conversation

@sonzsara

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 12:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Both due reports can include soft-deleted records and encounter links, and missing Metabase alias guidance can cause optional filters to fail.

3 open issues
What changed in this PR

Adds SSMM outpatient and inpatient due-report documentation to the accounting query collection, supporting follow-up on outstanding patient balances.

Changes:

  • Adds SQL queries showing patient identifiers, account balances, encounter details, and tags.
  • Separates non-inpatient and inpatient reports, including first discharge time for inpatient encounters.
  • Documents optional Metabase parameters, rounding, and result ordering.
File Description
Care/​Accounting/​op_patient_due_report_ssmm.md Adds the non-inpatient due query, parameters, and usage notes.
Care/​Accounting/​ip_patient_due_report_ssmm.md Adds the inpatient due query with discharge time, parameters, and usage notes.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 29, 2026 12:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Missing soft-deletion predicates can incorrectly include deleted records, obsolete identifiers, and accounts linked through deleted charge items in the outstanding-dues report.

3 open issues

Review effort: Balanced

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Analytics SQL Review — OP patient due report (SSMM)

Ticket (ENG-1148): list every patient account with money due that is linked to a non-ip encounter, via paid/billed charge items or primary_encounter_id.

Delivery: The logic matches the ask: the CTE unions the charge-item and primary-encounter paths, the imp exclusion is applied, and the balance is above 0. The grain is one row per account. The lint report is clean.

Verdict: not yet safe to publish. The numbers aren't trustworthy until the validity and facility filters are added:

  • No entered_in_error/deleted exclusion on the account, encounter or charge items.
  • No facility scoping, so it's unclear whether this reports only SSMM or every facility.

Docs are otherwise accurate and the folder and filename are correct. The ticket has no refinement comments, so the facility scope and status semantics above are questions for the author.

Generated by Analytics SQL Reviewer for #170 · auto · 14.4 AIC · ⊞ 5.1K

WHERE primary_encounter_id IS NOT NULL
)

SELECT *

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Low — SELECT * wrapper. The outer SELECT * FROM (...) t exists only to re-sort after DISTINCT ON. Acceptable here (no JSONB columns are exposed), but list the columns explicitly if you add more. Also, the Notes should say why config_id = 21 (SSMM identifier config) is hardcoded and when to update it. The existing note says only that it's the SSMM ID.

Copilot AI balanced review requested due to automatic review settings October 30, 2026 08:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the SSMM outpatient patient due report documentation.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

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.

2 participants