[ENG-486] add extensions to encounter#3668
Conversation
📝 WalkthroughWalkthroughThis PR refactors field mapping lambdas in encounter context builders for conciseness and consistency, while adding a new public ChangesEncounter Context Field Refinements
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR adds an
Confidence Score: 5/5The change is a small, additive data point on the report context builder with no modifications to models, migrations, or business logic — safe to merge. The No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "ft: add extensions to encounter" | Re-trigger Greptile |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
care/emr/reports/context_builder/data_points/encounter.py (1)
319-328: ⚡ Quick winMark
extensionswith a non-string field type.This field returns a
dict, butFieldstill defaults its metadata to"string". For a new public JSON field, that mismatch is a pretty avoidable way to confuse schema/UI consumers and any nested-path tooling built on top ofField.type.♻️ Proposed fix
extensions = Field( display="Encounter Extensions", mapping=lambda e: e.extensions or {}, + field_type="json", preview_value={ "encounter_attender": { "attender_name": "Jane Doe", }, },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@care/emr/reports/context_builder/data_points/encounter.py` around lines 319 - 328, The Field named extensions is declared with a mapping that returns a dict but left with the default string type; change its Field type to a non-string JSON type (e.g. type="json" or FieldType.JSON depending on your Field API) so the metadata matches the actual dict return value; update the Field call for extensions (the Field(...) instantiation in this module) to include the appropriate non-string type and keep the existing mapping/preview/description as-is.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@care/emr/reports/context_builder/data_points/encounter.py`:
- Around line 319-328: The Field named extensions is declared with a mapping
that returns a dict but left with the default string type; change its Field type
to a non-string JSON type (e.g. type="json" or FieldType.JSON depending on your
Field API) so the metadata matches the actual dict return value; update the
Field call for extensions (the Field(...) instantiation in this module) to
include the appropriate non-string type and keep the existing
mapping/preview/description as-is.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 94b63f3e-f075-495d-ae2f-2176c55e98a5
📒 Files selected for processing (1)
care/emr/reports/context_builder/data_points/encounter.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3668 +/- ##
===========================================
- Coverage 75.85% 75.85% -0.01%
===========================================
Files 479 479
Lines 23043 23044 +1
Branches 2380 2380
===========================================
Hits 17480 17480
Misses 4990 4990
- Partials 573 574 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Proposed Changes
ENG-486
Merge Checklist
/docsOnly 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