-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Emergency Number UserBaseMinimumSerializer #2624
base: develop
Are you sure you want to change the base?
Added Emergency Number UserBaseMinimumSerializer #2624
Conversation
📝 Walkthrough📝 WalkthroughWalkthroughThe changes involve modifications to the Changes
Suggested reviewers
Assessment against linked issues
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
care/users/api/serializers/user.py (3)
391-391
: Consider adding phone number validationWhile adding the emergency contact number is a good step, it might be nice to ensure it follows a consistent format. You know, just to avoid those awkward moments when someone enters "call-me-maybe" as their emergency contact.
Consider adding a validator to ensure proper phone number format:
from django.core.validators import RegexValidator phone_regex = RegexValidator( regex=r'^\+?1?\d{9,15}$', message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed." ) class UserBaseMinimumSerializer(serializers.ModelSerializer): alt_phone_number = serializers.CharField(validators=[phone_regex], allow_blank=True)
Line range hint
408-432
: Documentation would be lovely hereSince this serializer is used for assigned users and now includes emergency contact information, it might be helpful to add a docstring explaining the purpose and usage of this field. You know, for those future developers who might wonder why we're collecting this information.
Add a docstring to clarify the purpose:
class UserAssignedSerializer(serializers.ModelSerializer): """ Serializer for assigned users, typically volunteers. Includes emergency contact information (alt_phone_number) for safety protocols when volunteers are assigned to patients. """
391-391
: Tests would make this PR perfectWhile the implementation looks good, adding some test cases would really complete this PR. You know, just to make sure everything works as expected.
Would you like me to help generate test cases for:
- Phone number validation
- Serializer field presence
- API response format with the new field?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
care/users/api/serializers/user.py
(1 hunks)
🔇 Additional comments (1)
care/users/api/serializers/user.py (1)
Line range hint 433-485
: Did we forget something?
I couldn't help but notice that alt_phone_number
isn't included in the UserListSerializer
fields. If this information is needed on the patient details page, we might want to add it here too... unless there's a specific reason not to?
Let's check if this serializer is used in patient details views:
@vigneshhari @sainak Can either of you take a look? Thanks |
Proposed Changes
UserBaseMinimumSerializer
Associated Issue
UserBaseMinimum
serializer. This change ensures that in patient details page volunteer emergency number is retrieved.Architecture changes
Merge Checklist
/docs
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
Summary by CodeRabbit
New Features
alt_phone_number
field to user data serializers, enhancing user contact information across multiple serializers.Bug Fixes
Documentation
Refactor
Style
Tests
Chores
Revert