user_management.domain.entities package
Submodules
user_management.domain.entities.user module
Aggregate Root representing a user in the NextGenHealth system.
Central entity for identity management, enforcing validation, security, and auditability.
- class user_management.domain.entities.user.User(uuid: UUID, email: str, first_name: str, last_name: str, phone: str, date_of_birth: date, user_role: UserRole, user_status: UserStatus, created_at: datetime, updated_at: datetime, credentials: UserCredentials)[source]
Bases:
objectAggregate Root representing a user in the NextGenHealth system.
Central entity for identity management, enforcing validation, security, and auditability.
- __init__(uuid: UUID, email: str, first_name: str, last_name: str, phone: str, date_of_birth: date, user_role: UserRole, user_status: UserStatus, created_at: datetime, updated_at: datetime, credentials: UserCredentials)[source]
- change_password(current_password: str, new_password: str)[source]
Changes the user’s password if the current password is correct and the new password is valid and different.
- Parameters:
current_password (str) – The user’s current password
new_password (str) – The desired new password
- Raises:
InvalidPasswordError – If current password is wrong or new password is invalid
- change_user_role(new_role: UserRole)[source]
Changes the user’s role to a new valid role.
This method ensures the new role is a valid UserRole enum member. The decision of who can perform this action belongs to the Use Case layer.
- Parameters:
new_role (UserRole) – The new role to assign
- Raises:
InvalidUserRoleError – If the role is invalid
- change_user_status(new_status: UserStatus)[source]
- update_basic_profile(first_name: str, last_name: str, email: str, phone: str, date_of_birth: date)[source]
Updates the user’s basic profile information using domain specifications.
Validates inputs via Specification Pattern before applying changes. Updates updated_at timestamp on success.
- Parameters:
first_name (str) – New first name
last_name (str) – New last name
email (str) – New email address
phone (str) – New phone number in E.164 format
date_of_birth (date) – New date of birth
- Raises:
InvalidNameError – If first or last name fails specification
InvalidEmailError – If email fails specification
InvalidPhoneNumberError – If phone fails specification
InvalidDateOfBirthError – If date_of_birth fails specification
Module contents
Public API for user_management.domain.entities.
- class user_management.domain.entities.PatientProfile(user_uuid: UUID, emergency_contact_name: str, emergency_contact_phone: str, insurance_info: str, preferred_language: str, medical_history_summary: str, created_at: datetime, updated_at: datetime)[source]
Bases:
object
- class user_management.domain.entities.User(uuid: UUID, email: str, first_name: str, last_name: str, phone: str, date_of_birth: date, user_role: UserRole, user_status: UserStatus, created_at: datetime, updated_at: datetime, credentials: UserCredentials)[source]
Bases:
objectAggregate Root representing a user in the NextGenHealth system.
Central entity for identity management, enforcing validation, security, and auditability.
- __init__(uuid: UUID, email: str, first_name: str, last_name: str, phone: str, date_of_birth: date, user_role: UserRole, user_status: UserStatus, created_at: datetime, updated_at: datetime, credentials: UserCredentials)[source]
- change_password(current_password: str, new_password: str)[source]
Changes the user’s password if the current password is correct and the new password is valid and different.
- Parameters:
current_password (str) – The user’s current password
new_password (str) – The desired new password
- Raises:
InvalidPasswordError – If current password is wrong or new password is invalid
- change_user_role(new_role: UserRole)[source]
Changes the user’s role to a new valid role.
This method ensures the new role is a valid UserRole enum member. The decision of who can perform this action belongs to the Use Case layer.
- Parameters:
new_role (UserRole) – The new role to assign
- Raises:
InvalidUserRoleError – If the role is invalid
- change_user_status(new_status: UserStatus)[source]
- update_basic_profile(first_name: str, last_name: str, email: str, phone: str, date_of_birth: date)[source]
Updates the user’s basic profile information using domain specifications.
Validates inputs via Specification Pattern before applying changes. Updates updated_at timestamp on success.
- Parameters:
first_name (str) – New first name
last_name (str) – New last name
email (str) – New email address
phone (str) – New phone number in E.164 format
date_of_birth (date) – New date of birth
- Raises:
InvalidNameError – If first or last name fails specification
InvalidEmailError – If email fails specification
InvalidPhoneNumberError – If phone fails specification
InvalidDateOfBirthError – If date_of_birth fails specification