-
Notifications
You must be signed in to change notification settings - Fork 336
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 alt phone number, and doctor specific fields #2766
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,10 @@ class UserBaseSpec(EMRResource): | |
first_name: str | ||
last_name: str | ||
phone_number: str = Field(max_length=14) | ||
alt_phone_number: str = Field(max_length=14) | ||
qualification: str | ||
doctor_experience_commenced_on: str | ||
doctor_medical_council_registration: str | ||
Comment on lines
+39
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider moving doctor-specific fields to a separate model or adding optional markers. I couldn't help but notice that we're adding doctor-specific fields ( Consider either:
class UserBaseSpec(EMRResource):
phone_number: str = Field(max_length=14)
- alt_phone_number: str = Field(max_length=14)
- qualification: str
- doctor_experience_commenced_on: str
- doctor_medical_council_registration: str
+ alt_phone_number: str | None = Field(max_length=14, default=None)
+ qualification: str | None = Field(default=None)
+ doctor_experience_commenced_on: str | None = Field(default=None)
+ doctor_medical_council_registration: str | None = Field(default=None) Or better yet: class DoctorSpec(UserBaseSpec):
qualification: str
experience_commenced_on: str = Field(alias="doctor_experience_commenced_on")
medical_council_registration: str = Field(alias="doctor_medical_council_registration") |
||
|
||
|
||
class UserUpdateSpec(UserBaseSpec): | ||
|
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.
🛠️ Refactor suggestion
Add date validation for experience field.
The
doctor_experience_commenced_on
field is defined as a string without any date format validation. This could lead to... interesting data consistency issues.You might also want to add a validator to ensure the date is not in the future and not unreasonably old: