Skip to content

[ENG-925] removed encounter_class_history field - #3743

Merged
vigneshhari merged 7 commits into
developfrom
ENG-925-remove-encounter-class-history-field-from-encounter
Aug 27, 2026
Merged

[ENG-925] removed encounter_class_history field#3743
vigneshhari merged 7 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
    • Simplified encounter data by removing encounter-class history from records and API responses.
    • Encounter class is now provided when creating encounters and included in encounter listings.
    • Existing encounters are migrated automatically to the updated data structure.

@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

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: ff8e4b40-5e37-4803-8d61-98c440671c89

📥 Commits

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

📒 Files selected for processing (2)
  • care/emr/resources/encounter/spec.py
  • care/emr/tests/test_encounter_api.py
💤 Files with no reviewable changes (1)
  • 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

Changes

Encounter class history removal

Layer / File(s) Summary
Scope encounter API fields
care/emr/resources/encounter/spec.py, care/emr/tests/test_encounter_api.py
Encounter class is declared on create and list specifications. Encounter class history tracking and serialization are removed. Fixtures set an explicit encounter class, and the obsolete update test is removed.
Remove encounter class history
care/emr/migrations/0082_remove_encounter_encounter_class_history.py, care/emr/admin/encounter.py, care/emr/tests/test_medication_dispense_api.py
The migration removes the model field. Administration exports and medication dispense fixtures no longer reference encounter class history.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 35575

The PR removes the encounter class history field and prevents encounter class changes after creation; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: vigneshhari

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: removing the encounter_class_history field from Encounter.
Description check ✅ Passed The description explains the main changes and includes the merge checklist. The optional Architecture changes section is not required, but the required Associated Issue section and issue link are miss…
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.
Full details: Description check

Explanation

The description explains the main changes and includes the merge checklist. The optional Architecture changes section is not required, but the required Associated Issue section and issue link are missing. Checklist items are also unchecked.

  • Fix all pre-merge checks with AI
✨ 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.66%. Comparing base (9a397f0) to head (3557527).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3743      +/-   ##
===========================================
+ Coverage    79.63%   79.66%   +0.03%     
===========================================
  Files          482      482              
  Lines        23282    23278       -4     
  Branches      2427     2426       -1     
===========================================
+ Hits         18540    18545       +5     
+ Misses        4140     4132       -8     
+ Partials       602      601       -1     

☔ 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.

Comment thread care/emr/api/viewsets/encounter.py Outdated
@vigneshhari
vigneshhari merged commit 3c9f3c2 into develop Aug 27, 2026
11 checks passed
@vigneshhari
vigneshhari deleted the ENG-925-remove-encounter-class-history-field-from-encounter branch August 27, 2026 04:08
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.

3 participants