Skip to content

Add Reception Counter Report with IP/OP Split for SSMM staff reconciliation - #174

Open
sonzsara wants to merge 1 commit into
mainfrom
ENG-1237
Open

sonzsara wants to merge 1 commit into
mainfrom
ENG-1237

Conversation

@sonzsara

Copy link
Copy Markdown
Contributor

No description provided.

@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 — Reception counter closing report with IP/OP split (SSMM)

Ticket (ENG-1237): a per-staff invoiced vs. collected summary, split into IP and OP, with an optional date.

Verdict: not safe to publish yet. The staff filter is fully commented out in both CTEs, so the report aggregates all staff and does not deliver the "selected staff member" the ticket asks for. The Notes section describes the filter as mandatory, which contradicts the SQL. There is also a question about whether draft invoices should count.

Looks fine:

  • deleted = FALSE is applied on both tables.
  • entered_in_error and cancelled invoices are excluded.
  • Payments are limited to active, complete ones.
  • The IP/OP grain is right: one row per class, plus Total.
  • The LEFT JOINs to the account and encounter are intended, and the Notes explain the no-encounter → OP fallback.
  • The lint report is clean.

Generated by Analytics SQL Reviewer for #174 · auto · 19.6 AIC · ⊞ 5.3K

LEFT JOIN emr_encounter ae ON ae.id = a.primary_encounter_id
JOIN users_user u ON u.id = i.updated_by_id
WHERE i.deleted = FALSE
AND i.status NOT IN ('cancelled', 'entered_in_error')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Question about intent: NOT IN ('cancelled','entered_in_error') leaves draft invoices in invoiced_gross (the Notes say so too). A counter closing report normally counts only issued/finalized invoices, so drafts would inflate "invoiced" against "collected". Please confirm drafts should count, or switch to an explicit allow-list such as i.status IN ('issued','balanced'). Check the status values in care/emr/resources/base.py or the invoice model before using them.

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.

1 participant