Repository navigation
Conversation
There was a problem hiding this comment.
🟡 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
There was a problem hiding this comment.
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/deletedexclusion 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 * |
There was a problem hiding this comment.
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.


No description provided.