Skip to content

Add IP/OP/Emergency Encounter Count documentation for SSMM#100

Open
sonzsara wants to merge 5 commits into
mainfrom
ENG-320
Open

Add IP/OP/Emergency Encounter Count documentation for SSMM#100
sonzsara wants to merge 5 commits into
mainfrom
ENG-320

Conversation

@sonzsara

Copy link
Copy Markdown
Contributor

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.

Pull request overview

Adds a new Markdown query documentation page for the SSMM operational dashboard question covering daily month-to-date (through yesterday) IP bed occupancy, OP encounters, and Emergency encounters.

Changes:

  • Added Care/Encounter/ip_op_emer_encounter_count_ssmm.md documenting the dashboard purpose, date window, and SQL query.
  • Implemented SQL CTEs to generate a day series, compute daily occupied beds, and aggregate OP/Emergency volumes.

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

Comment on lines +57 to +61
SELECT
created_date::date AS encounter_date,
COUNT(DISTINCT patient_id) FILTER (WHERE encounter_class = 'amb') AS ambulatory_count,
COUNT(DISTINCT patient_id) FILTER (WHERE encounter_class = 'emer') AS emergency_count
FROM emr_encounter

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The DISTINCT patient_id filtering for encounters is intentional it counts unique patients rather than total encounters, since patients can have multiple encounters on the same day.

Comment thread Care/Encounter/ip_op_emer_encounter_count_ssmm.md Outdated

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Comment thread Care/Encounter/ip_op_emer_encounter_count_ssmm.md Outdated
Comment thread Care/Encounter/ip_op_emer_encounter_count_ssmm.md
Comment thread Care/Encounter/ip_op_emer_encounter_count_ssmm.md
…ries, and adjust date conditions for accuracy

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread Care/Encounter/ip_op_emer_encounter_count_ssmm.md
Comment thread Care/Encounter/ip_op_emer_encounter_count_ssmm.md
Comment thread Care/Encounter/ip_op_emer_encounter_count_ssmm.md

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment on lines +4 to +8
> Daily counts of occupied inpatient beds, ambulatory (OP) and emergency patients for the current month-to-date (up to yesterday)

## Purpose

Operational dashboard query giving a one-row-per-day view of patient volume at SSMM for the current month:
Comment thread Care/Encounter/ip_op_emer_encounter_count_ssmm.md

## Notes

- **Date window** — `dates` CTE generates one row per day from the **start of the current month** through **yesterday** (`CURRENT_DATE - INTERVAL '1 day'`). Today is intentionally excluded so the report only shows completed days.
Comment thread Care/Encounter/ip_op_emer_encounter_count_ssmm.md
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.

4 participants