feat: add input validation for patient registration and updates#43
Open
uditv120 wants to merge 1 commit intobos-com:mainfrom
Open
feat: add input validation for patient registration and updates#43uditv120 wants to merge 1 commit intobos-com:mainfrom
uditv120 wants to merge 1 commit intobos-com:mainfrom
Conversation
- Validate first_name / last_name are not empty or whitespace-only - Validate date_of_birth is not in the future and age is plausible (0-150) - Validate phone_number matches E.164-like format (+ followed by 9-15 digits) - Validate email format when provided - Validate emergency_contact_phone format - Add cross-field validation: emergency_contact_name required when phone given - Return clear, translatable error messages via gettext_lazy Closes bos-com#34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements input validation for patient registration and updates in
PatientCreateSerializer(Issue #34).Changes
File:
apps/patients/serializers.pyField-level validation
first_name/last_name: reject empty or whitespace-only stringsdate_of_birth: reject future dates and implausible ages (>150 years)phone_number: enforce E.164-like format (+followed by 9–15 digits), strip spaces/dashesemail: validate format when provided (field is optional)emergency_contact_phone: same phone format validationCross-field validation
emergency_contact_nameis required whenemergency_contact_phoneis providedError messages
gettext_lazyfor i18n supportCloses #34