Skip to content

fix:changed the default value of extra details in Healthcare service#3569

Open
nandkishorr wants to merge 1 commit intodevelopfrom
fix/healthcare_service/extra_details
Open

fix:changed the default value of extra details in Healthcare service#3569
nandkishorr wants to merge 1 commit intodevelopfrom
fix/healthcare_service/extra_details

Conversation

@nandkishorr
Copy link
Contributor

@nandkishorr nandkishorr commented Mar 10, 2026

Proposed Changes

  • updated the default value to None.

Associated Issue

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
    • The extra_details field 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.

@nandkishorr nandkishorr self-assigned this Mar 10, 2026
@nandkishorr nandkishorr requested a review from a team as a code owner March 10, 2026 06:05
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

📝 Walkthrough

Walkthrough

The pull request removes the default empty string value from the extra_details field in BaseHealthcareServiceSpec, making the field required during model instantiation and validation without any accompanying logic or control-flow modifications.

Changes

Cohort / File(s) Summary
Healthcare Service Specification
care/emr/resources/healthcare_service/spec.py
Removed default value from extra_details field in BaseHealthcareServiceSpec, transitioning it from an optional parameter with an empty string default to a required field.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete—it states 'updated the default value to None' but the actual change removes the default entirely (not sets it to None), creating a discrepancy with the code changes. Clarify what was actually changed, ensure the description matches the code modifications, and mark completed checklist items as this appears to be a completed PR.
Title check ❓ Inconclusive The title mentions changing the default value of extra_details, but the raw summary reveals the field is now required (no default), not simply changed to a different default value. Clarify whether the default was changed to None or removed entirely. Consider: 'Make extra_details required in BaseHealthcareServiceSpec' or 'Remove default value from extra_details field'.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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/healthcare_service/extra_details

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 924ca74 and f3aacef.

📒 Files selected for processing (1)
  • care/emr/resources/healthcare_service/spec.py

name: str
styling_metadata: dict = {}
extra_details: str = ""
extra_details: str
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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.py

Repository: 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.py

Repository: 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.py

Repository: 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
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.22%. Comparing base (924ca74) to head (f3aacef).
⚠️ Report is 6 commits behind head on develop.

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

@nandkishorr nandkishorr changed the title fix:changed the default value fix:changed the default value of extra details in Healthcare service Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant