Skip to content

fix: Default filtering questionnaire response in Contex builder#3549

Open
nandkishorr wants to merge 1 commit intodevelopfrom
fix/datapoint/questionnaire_response/filter
Open

fix: Default filtering questionnaire response in Contex builder#3549
nandkishorr wants to merge 1 commit intodevelopfrom
fix/datapoint/questionnaire_response/filter

Conversation

@nandkishorr
Copy link
Contributor

@nandkishorr nandkishorr commented Feb 26, 2026

Proposed Changes

  • Default filtering questionnaire response with completed status

Merge Checklist

  • Tests added/fixed
  • Update docs in /docs
  • Linting Complete
  • Any other necessary step

Only PR's with test cases included and passing lint and test pipelines will be reviewed

@ohcnetwork/care-backend-maintainers @ohcnetwork/care-backend-admins

Summary by CodeRabbit

  • Bug Fixes
    • Questionnaire reports now correctly filter and display only completed responses, ensuring accurate reporting and data consistency across all questionnaire-related outputs.

@nandkishorr nandkishorr self-assigned this Feb 26, 2026
@nandkishorr nandkishorr requested a review from a team as a code owner February 26, 2026 10:07
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b45422f and 14b51d9.

📒 Files selected for processing (1)
  • care/emr/reports/context_builder/data_points/questionnaire.py

📝 Walkthrough

Walkthrough

Modified questionnaire response filtering logic to include status validation. Imported QuestionnaireResponseStatusChoices and applied a status filter across two context builders to restrict results to completed questionnaire responses alongside existing encounter and questionnaire existence filters.

Changes

Cohort / File(s) Summary
Questionnaire Response Filtering
care/emr/reports/context_builder/data_points/questionnaire.py
Imported QuestionnaireResponseStatusChoices from questionnaire response spec. Added status filter (status=QuestionnaireResponseStatusChoices.completed.value) to both QuestionnaireContextBuilder.get_context and QuestionnaireResponsesContextBuilder.get_context queryset construction to ensure only completed responses are included.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description is minimal and vague—it mentions the change but lacks detail about what 'completed status' filtering accomplishes or why it's needed. Expand the description with context: explain the business rationale, reference the associated issue, and detail how this filtering improves the system behavior.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding default filtering for questionnaire responses by completed status.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/datapoint/questionnaire_response/filter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.23%. Comparing base (b45422f) to head (14b51d9).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3549   +/-   ##
========================================
  Coverage    76.23%   76.23%           
========================================
  Files          473      473           
  Lines        22117    22118    +1     
  Branches      2309     2309           
========================================
+ Hits         16860    16861    +1     
  Misses        4740     4740           
  Partials       517      517           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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