Skip to content

[ENG-925] removed encounter_class_history field - #3743

Open
praffq wants to merge 6 commits into
developfrom
ENG-925-remove-encounter-class-history-field-from-encounter
Open

[ENG-925] removed encounter_class_history field#3743
praffq wants to merge 6 commits into
developfrom
ENG-925-remove-encounter-class-history-field-from-encounter

Conversation

@praffq

@praffq praffq commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Proposed Changes

  • remove encounter_class_history field from Encounter
  • added validation to not allow encounter class to be changed once created.

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

  • Changes
    • Removed encounter class history tracking from encounter records.
    • Encounter exports, imports, and creation workflows no longer include this field.
    • Encounter class cannot be changed after creation; attempts to update it are rejected.
    • Existing databases are updated automatically to remove the obsolete field.
  • Tests
    • Updated encounter and medication dispense scenarios to reflect the streamlined encounter data and class update validation.

@praffq
praffq requested a review from a team as a code owner August 18, 2026 17:20
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 745feec4-da00-4256-ab20-c91ef4ecbcce

📥 Commits

Reviewing files that changed from the base of the PR and between a58f89c and a73cab7.

📒 Files selected for processing (2)
  • care/emr/api/viewsets/encounter.py
  • care/emr/tests/test_encounter_api.py

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The encounter class history field is removed from persistence and encounter API handling. Encounter class changes are rejected during updates. Administration exports and test fixtures no longer reference the removed field.

Changes

Encounter class history removal

Layer / File(s) Summary
Remove encounter class history
care/emr/migrations/0082_remove_encounter_encounter_class_history.py, care/emr/resources/encounter/spec.py, care/emr/admin/encounter.py, care/emr/tests/test_medication_dispense_api.py
The migration removes the field. Encounter creation, serialization, administration export, and test setup no longer use encounter_class_history.
Enforce encounter class immutability
care/emr/api/viewsets/encounter.py, care/emr/tests/test_encounter_api.py
Encounter updates now reject changes to encounter_class with a 400 response and the message Encounter class cannot be changed. Fixtures set an initial encounter class.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to a73ca

This localized change removes the encounter class history field without any actionable merge-blocking risk remaining after normal checks and review.

Suggested reviewers: vigneshhari, rithviknishad

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: removing the encounter_class_history field.
Description check ✅ Passed The description summarizes the changes and includes the merge checklist, but it omits the required Associated Issue section.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ENG-925-remove-encounter-class-history-field-from-encounter

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

@praffq praffq changed the title removed encounter_class_history field [ENG-925] removed encounter_class_history field Aug 18, 2026
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.62%. Comparing base (9a397f0) to head (a73cab7).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3743      +/-   ##
===========================================
- Coverage    79.63%   79.62%   -0.01%     
===========================================
  Files          482      482              
  Lines        23282    23279       -3     
  Branches      2427     2427              
===========================================
- Hits         18540    18537       -3     
  Misses        4140     4140              
  Partials       602      602              

☔ View full report in Codecov by Harness.
📢 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.

2 participants