fix:changed the default value of extra details in Healthcare service#3569
fix:changed the default value of extra details in Healthcare service#3569nandkishorr wants to merge 1 commit intodevelopfrom
Conversation
📝 WalkthroughWalkthroughThe pull request removes the default empty string value from the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@care/emr/resources/healthcare_service/spec.py`:
- Line 37: The field extra_details in
care/emr/resources/healthcare_service/spec.py was changed to a required field
causing PATCH payloads to fail validation; make extra_details optional again by
restoring an explicit default (e.g. extra_details: Optional[str] = None or
extra_details: str = "" ) on the Pydantic model definition so update/partial
requests that omit it will pass validation (adjust imports to include Optional
if used); this fixes the breaking change without altering validation flow in
base.py.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 62e4d0e8-011f-4ded-bd59-eddb65033610
📒 Files selected for processing (1)
care/emr/resources/healthcare_service/spec.py
| name: str | ||
| styling_metadata: dict = {} | ||
| extra_details: str = "" | ||
| extra_details: str |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Healthcare service spec / viewset binding =="
fd '.*healthcare_service.*\.py$' care | xargs -r rg -n -C3 \
'BaseHealthcareServiceSpec|HealthcareServiceWriteSpec|get_update_pydantic_model|get_create_pydantic_model|pydantic_model'
echo
echo "== Existing healthcare service API tests touching extra_details or partial updates =="
rg -n -C3 'extra_details|patch|partial|update' care/emr/tests/test_healthcare_service_api.pyRepository: ohcnetwork/care
Length of output: 4202
🏁 Script executed:
# Check the actual spec file definition at line 37
cat -n care/emr/resources/healthcare_service/spec.py | sed -n '30,45p'Repository: ohcnetwork/care
Length of output: 628
🏁 Script executed:
# Search for PATCH tests in healthcare service tests
rg -n 'patch|PATCH' care/emr/tests/test_healthcare_service_api.pyRepository: ohcnetwork/care
Length of output: 41
🏁 Script executed:
# Check if there are any partial update / omitted field tests
rg -n 'partial|omit' care/emr/tests/test_healthcare_service_api.pyRepository: ohcnetwork/care
Length of output: 41
🏁 Script executed:
# Examine the base viewset to understand validation flow
cat -n care/emr/api/viewsets/base.py | sed -n '130,160p'Repository: ohcnetwork/care
Length of output: 1292
🏁 Script executed:
# Check the update validation flow in base.py
cat -n care/emr/api/viewsets/base.py | sed -n '220,250p'Repository: ohcnetwork/care
Length of output: 1371
🏁 Script executed:
# Look for any partial update / PATCH test patterns more broadly
fd 'test.*healthcare' care/emr/tests | xargs rg -l 'patch|PATCH|partial' 2>/dev/null || echo "No PATCH tests found"Repository: ohcnetwork/care
Length of output: 79
Line 37 makes extra_details required, breaking partial update payloads.
The removal of the default value transforms extra_details into a required field. Both create and update flows validate against the pydantic model before deserialization (base.py:142–145, 233–236), so any PATCH request omitting extra_details will fail validation—even if the field is unchanged. This is a breaking API change. The test suite doesn't catch this because all test cases dutifully include extra_details in both create and update payloads, and there are no PATCH tests.
Recommend either keeping the field optional on input (with an explicit default like = None or = ""), or validating and handling the absence before the pydantic model gets involved.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@care/emr/resources/healthcare_service/spec.py` at line 37, The field
extra_details in care/emr/resources/healthcare_service/spec.py was changed to a
required field causing PATCH payloads to fail validation; make extra_details
optional again by restoring an explicit default (e.g. extra_details:
Optional[str] = None or extra_details: str = "" ) on the Pydantic model
definition so update/partial requests that omit it will pass validation (adjust
imports to include Optional if used); this fixes the breaking change without
altering validation flow in base.py.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3569 +/- ##
========================================
Coverage 76.22% 76.22%
========================================
Files 474 474
Lines 22270 22270
Branches 2325 2325
========================================
Hits 16976 16976
Misses 4765 4765
Partials 529 529 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Proposed Changes
Associated Issue
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
extra_detailsfield in healthcare service records is now required during creation. Previously optional with an empty default value, you must now explicitly provide this field when initializing healthcare service records.