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: object

Aggregate 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]
is_password_valid(provided: str) bool[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:

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

__init__(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]
update_medical_info(emergency_contact_name: str, emergency_contact_phone: str, insurance_info: str, preferred_language: str, medical_history_summary: str)[source]
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: object

Aggregate 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]
is_password_valid(provided: str) bool[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: