Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new query documentation page under Care/Clinical/ for reporting patient mobility status counts by district, using each patient’s latest mobility questionnaire response.
Changes:
- Introduces a new markdown doc describing purpose, parameters, and the SQL query for “Mobility Status Report by District”.
- Adds Metabase parameter guidance for date filtering and notes on sorting.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… and maintainability
| @@ -0,0 +1,56 @@ | |||
|
|
|||
| # Mobility Status Report by District | |||
|
|
||
| ## Purpose | ||
|
|
||
| For each patient, find the **most recent** answer to the mobility-status question and pivot the counts by the patient's district. |
Jacobjeevan
requested changes
Jul 1, 2026
| AND emr_patient.deceased_datetime IS NULL | ||
| CROSS JOIN LATERAL jsonb_array_elements(emr_questionnaireresponse.responses) AS rs | ||
| WHERE emr_questionnaireresponse.responses @> '[{"question_id": "e4b0d3f4-77fb-4fb6-9213-9c62fa6b5695"}]'::jsonb | ||
|
|
Collaborator
There was a problem hiding this comment.
filter by questionnaire id as well as well as response status.
You will have to join to questionnaire table since questionnaire_id is the pk, rather than uuid.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.