Skip to content

Add documentation for Nursing Procedures Count by Facility query - #139

Open
sonzsara wants to merge 3 commits into
mainfrom
ENG-833
Open

Add documentation for Nursing Procedures Count by Facility query#139
sonzsara wants to merge 3 commits into
mainfrom
ENG-833

Conversation

@sonzsara

@sonzsara sonzsara commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

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 under Care/Clinical describing a Metabase query to count specific nursing procedures by facility, scoped to an organization and optionally filtered by visit date.

Changes:

  • Introduces documentation for “Nursing Procedures Count by Facility” (purpose, parameters, SQL, notes).
  • Adds a SQL query that expands questionnaire response JSON to count selected procedure values per facility.
  • Documents hardcoded questionnaire/question IDs and Metabase filter usage.

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

Comment thread Care/Clinical/nursing_procedures_count_by_facility_kc.md
Comment thread Care/Clinical/nursing_procedures_count_by_facility_kc.md
Comment thread Care/Clinical/nursing_procedures_count_by_facility_kc.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 no new comments.

Suppressed comments (2)

Care/Clinical/nursing_procedures_count_by_facility_kc.md:38

  • org_id can return multiple rows (when the external_id predicate is commented out), and the INNER JOIN org_id will then multiply filtered_encounters rows for facilities whose geo_organization_cache overlaps multiple org IDs. That can inflate the downstream COUNT(*). Consider aggregating org IDs into a single array row (or using EXISTS) to avoid join-multiplication while keeping the same filtering behavior.
    INNER JOIN org_id
        ON facility_facility.geo_organization_cache && ARRAY[org_id.id]::integer[]

Care/Clinical/nursing_procedures_count_by_facility_kc.md:86

  • The Notes claim "organization_id is required" but the SQL currently has the external_id predicate commented out, so the query will run without providing organization_id. Please update the note to match the current SQL behavior (or instruct readers to uncomment the predicate when they want organization scoping).
- **`organization_id` is required** (no `[[...]]` wrapper) — the query will not run without a value.

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