Skip to content

Human Resources

Staff, roles, and contracts.

Entity Relationship Diagram

Human Resources ERD

Entities

iris.domain.human_resources.entities

Human resources domain entities: Branch and Employee.

Branch

Bases: NamedEntity

A physical or logical branch of the organization.

Serves as the geographical or administrative unit referenced by SaleOrder, PurchaseOrder, and Employee records. contact_info is optional for virtual or headquarters branches that do not have a dedicated address.

Employee

Bases: NamedEntity

An employee of the organization with optional personal and contact details.

Used as the responsible party in Opportunity and other operational aggregates. Personal fields (dob, first_name, last_name) and organizational fields (department, position) are all optional to support incremental data entry.

Objects

iris.domain.human_resources.objects

Human resources domain value objects (currently empty).

Repositories

iris.domain.human_resources.repositories

Repository interfaces for the human resources domain.

EmployeeRepository

Bases: CrudRepository[Employee]

CRUD repository for Employee entities.

find_by_department abstractmethod

find_by_department(department)

Return all employees belonging to the given department.

Source code in src/iris/domain/human_resources/repositories.py
@abstractmethod
def find_by_department(self, department: str) -> Sequence[Employee]:
    """Return all employees belonging to the given department."""

find_by_branch abstractmethod

find_by_branch(branch_id)

Return all employees assigned to a given branch.

Source code in src/iris/domain/human_resources/repositories.py
@abstractmethod
def find_by_branch(self, branch_id: str) -> Sequence[Employee]:
    """Return all employees assigned to a given branch."""

get abstractmethod

get(identifier)

Return the entity matching identifier, or None if not found.

Source code in src/iris/domain/generic/repositories.py
@abstractmethod
def get(self, identifier: str) -> T | None:
    """Return the entity matching `identifier`, or None if not found."""

save abstractmethod

save(entity)

Persist entity and return the saved version.

Source code in src/iris/domain/generic/repositories.py
@abstractmethod
def save(self, entity: T) -> T:
    """Persist `entity` and return the saved version."""

delete abstractmethod

delete(identifier)

Remove the entity identified by identifier.

Source code in src/iris/domain/generic/repositories.py
@abstractmethod
def delete(self, identifier: str) -> None:
    """Remove the entity identified by `identifier`."""

find_all abstractmethod

find_all()

Return all entities in the repository.

Source code in src/iris/domain/generic/repositories.py
@abstractmethod
def find_all(self) -> Sequence[T]:
    """Return all entities in the repository."""

BranchRepository

Bases: CrudRepository[Branch]

CRUD repository for Branch entities.

get abstractmethod

get(identifier)

Return the entity matching identifier, or None if not found.

Source code in src/iris/domain/generic/repositories.py
@abstractmethod
def get(self, identifier: str) -> T | None:
    """Return the entity matching `identifier`, or None if not found."""

save abstractmethod

save(entity)

Persist entity and return the saved version.

Source code in src/iris/domain/generic/repositories.py
@abstractmethod
def save(self, entity: T) -> T:
    """Persist `entity` and return the saved version."""

delete abstractmethod

delete(identifier)

Remove the entity identified by identifier.

Source code in src/iris/domain/generic/repositories.py
@abstractmethod
def delete(self, identifier: str) -> None:
    """Remove the entity identified by `identifier`."""

find_all abstractmethod

find_all()

Return all entities in the repository.

Source code in src/iris/domain/generic/repositories.py
@abstractmethod
def find_all(self) -> Sequence[T]:
    """Return all entities in the repository."""

Events

iris.domain.human_resources.events

Domain events for the human resources bounded context.

EmployeeHired

Emitted when a new employee is hired.

EmployeeUpdated

Emitted when an employee's details are updated.

EmployeeTerminated

Emitted when an employee's employment is terminated.

BranchOpened

Emitted when a new branch is opened.

BranchClosed

Emitted when a branch is closed.

Exceptions

iris.domain.human_resources.exceptions

Exceptions for the human resources domain.

HumanResourcesError

Bases: Exception

Base exception for the human resources domain.

EmployeeNotFoundError

Bases: HumanResourcesError

Raised when an employee cannot be found by the given identifier.

BranchNotFoundError

Bases: HumanResourcesError

Raised when a branch cannot be found by the given identifier.

EmployeeAlreadyTerminatedError

Bases: HumanResourcesError

Raised when attempting to terminate an employee who is already terminated.

DuplicateEmployeeRecordError

Bases: HumanResourcesError

Raised when registering an employee that already exists in the system.