Skip to content

Role Assignment

A RoleAssignment links an Employee to a Role. It exposes two derived metrics: training_needs() computes the per-competence gap between the employee's profile and the role's requirements, while idoneity gives a single weighted suitability score.

See Domain Model — Roles and Workforce for a conceptual overview and Merging — Role assignment merging for merge semantics.

RoleAssignment

RoleAssignment

Bases: MergeableModel

The assignment of an Employee to a Role.

Attributes:

Name Type Description
employee Employee

The employee fulfilling the role.

role Role

The role being fulfilled.

idoneity property

The weighted average suitability of the employee for the role.

Computes Σ(level × relevance) / Σ(relevance) over all role competences with non-UNRELATED relevance, using integer enum values. Returns 0.0 when the denominator is zero (no relevant competences defined on the role).

Absent competences default to :attr:~fushinryu_model.competence.CompetenceLevel.NONE.

Returns:

Type Description
float

A float in [0.0, CompetenceLevel.PROFICIENT].

training_needs()

Compute the training distance of the employee against this role.

For each competence binding on the role, looks up the employee's level. If the employee has no binding for a required competence, their level is treated as :attr:~fushinryu_model.competence.CompetenceLevel.NONE.

The role's competences field is read directly; callers working with a scope hierarchy should pass a role from a collapsed scope to obtain the fully resolved effective competence requirements.

Returns:

Type Description
TrainingNeeds

A :class:TrainingNeeds summarising per-competence gaps and total distance.

TrainingNeeds

TrainingNeeds

Bases: MergeableModel

The full training distance analysis of an employee against a role.

Attributes:

Name Type Description
employee Employee

The employee being assessed.

role Role

The role being assessed against.

needs frozenset[TrainingNeed]

One :class:TrainingNeed per competence binding in the role.

total_distance property

The sum of all partial training distances.

Returns:

Type Description
float

Zero when the employee meets every threshold; positive otherwise.

TrainingNeed

TrainingNeed

Bases: MergeableModel

The training distance for a single competence binding between an employee and a role.

Attributes:

Name Type Description
competence Competence

The competence this need relates to.

relevance CompetenceRelevance

The relevance weight of this competence for the role.

proficiency_threshold CompetenceLevel

The minimum level required by the role.

employee_level CompetenceLevel

The employee's current proficiency level.

partial_distance property

The weighted gap between the required threshold and the employee's level.

Floored at zero: an employee who meets or exceeds the threshold contributes no training distance.

Returns:

Type Description
float

max(0, threshold - level) * relevance using integer enum values.