API Reference¶
IO¶
multidimensional_evaluation_engine.io.load_candidates ¶
io/load_candidates.py: Load candidates from CSV.
load_candidates ¶
Load candidates from a CSV file.
Candidate factor values are typed using structural factor specifications.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
csv_path
|
Path
|
Path to the CSV file. |
required |
factor_specs
|
list[FactorSpec]
|
Structural factor definitions used to type CSV columns. |
required |
Returns:
| Type | Description |
|---|---|
list[Candidate]
|
List of Candidate objects. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the CSV file does not exist. |
ValueError
|
If required columns are missing, if unknown factor columns are present, or if a value cannot be coerced to the required type. |
Source code in src/multidimensional_evaluation_engine/io/load_candidates.py
multidimensional_evaluation_engine.io.load_policy ¶
io/load_policy.py: Load policy from TOML.
load_policy ¶
Load a policy from a TOML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to TOML policy file. |
required |
Returns:
| Type | Description |
|---|---|
Policy
|
Policy instance. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the file does not exist. |
TOMLDecodeError
|
If TOML parsing fails. |
KeyError
|
If required policy sections are missing. |
TypeError
|
If policy content has the wrong structural type. |
ValueError
|
If policy content fails model validation. |
Source code in src/multidimensional_evaluation_engine/io/load_policy.py
Evaluation¶
multidimensional_evaluation_engine.evaluation.evaluator ¶
evaluation/evaluator.py: Evaluate candidates against policy.
evaluate_candidate ¶
Evaluate a candidate under a policy.
This bridge evaluator supports the newer typed policy model while consuming candidate.factor_values.
Current behavior: - hard constraints are evaluated first - scored findings are evaluated next - weighted scores are summed into a single total - the returned CandidateResult remains compatible with the existing score-dictionary shape
Returned score keys include: - one entry per score rule, keyed by rule_id - "total" for aggregate weighted score - "admissible" as 1.0 or 0.0 - optional interpretation label as 1.0 for the highest satisfied label
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidate
|
Candidate
|
Candidate with factor values. |
required |
policy
|
Policy
|
Policy defining factor specs, constraint rules, score rules, and aggregate interpretation thresholds. |
required |
Returns:
| Type | Description |
|---|---|
CandidateResult
|
CandidateResult containing computed scores. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If a required factor is missing from the candidate. |
ValueError
|
If a factor value cannot be interpreted for its rule. |
Source code in src/multidimensional_evaluation_engine/evaluation/evaluator.py
Reporting¶
multidimensional_evaluation_engine.reporting.tables ¶
reporting/tables.py: Simple text-table reporting for scored results.
format_results ¶
Format evaluation results as a plain-text report.
Produces a deterministic, human-readable summary of scores for each candidate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
list[CandidateResult]
|
List of candidate evaluation results. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Formatted string suitable for console output or logging. |
Source code in src/multidimensional_evaluation_engine/reporting/tables.py
Domain Models¶
multidimensional_evaluation_engine.domain.candidates ¶
domain/candidates.py: Domain models for evaluation inputs.
Candidate
dataclass
¶
A generic candidate for multidimensional evaluation.
A candidate represents an entity being evaluated under a policy. Domain-specific inputs are carried as raw factor values keyed by factor_id.
Attributes:
| Name | Type | Description |
|---|---|---|
candidate_id |
str
|
Stable identifier for the candidate. |
candidate_name |
str
|
Human-readable name. |
factor_values |
dict[str, FactorValue]
|
Mapping of factor_id to raw primitive value. |
notes |
str
|
Optional free-text annotation. |
metadata |
dict[str, str]
|
Optional auxiliary key-value data not used in scoring. |
Source code in src/multidimensional_evaluation_engine/domain/candidates.py
multidimensional_evaluation_engine.domain.factors ¶
domain/factors.py: Core factor and recorded-value models.
EvidenceRef
dataclass
¶
FactorForm ¶
FactorSpec
dataclass
¶
Structural definition of a factor.
Source code in src/multidimensional_evaluation_engine/domain/factors.py
FactorValue
dataclass
¶
Neutral recorded value for one factor.
Source code in src/multidimensional_evaluation_engine/domain/factors.py
multidimensional_evaluation_engine.domain.results ¶
domain/results.py: Result models for candidate evaluation.
CandidateResult
dataclass
¶
Result of evaluating a candidate under a policy.
Contains computed scores and optional derived representations for interpretation or visualization.
Attributes:
| Name | Type | Description |
|---|---|---|
candidate |
Candidate
|
The evaluated candidate. |
scores |
dict[str, float]
|
Mapping of label to numeric score. |
levels |
dict[str, str]
|
Optional mapping of label to qualitative level (e.g., "low", "medium", "high"). |
visual_levels |
dict[str, str]
|
Optional mapping of label to presentation-oriented categories (e.g., for UI color or grouping). |
Source code in src/multidimensional_evaluation_engine/domain/results.py
Policy¶
multidimensional_evaluation_engine.policy.policy ¶
policy/policy.py: Policy models for multidimensional evaluation.
Comparator ¶
ConstraintRule
dataclass
¶
Rule for evaluating a hard constraint.
Attributes:
| Name | Type | Description |
|---|---|---|
rule_id |
str
|
Stable identifier for the rule. |
factor_id |
str
|
Factor to which this rule applies. |
comparator |
Comparator
|
Comparison operator. |
threshold |
bool | float | str | tuple[str, ...]
|
Comparison target. May be bool, number, string, or tuple. |
message |
str
|
Human-readable result text. |
rationale |
str
|
Optional explanation of why the rule exists. |
Source code in src/multidimensional_evaluation_engine/policy/policy.py
EvaluationRole ¶
NumericBand
dataclass
¶
Numeric range mapped to a score and optional qualitative band.
Attributes:
| Name | Type | Description |
|---|---|---|
min_inclusive |
float
|
Inclusive lower bound. |
max_inclusive |
float
|
Inclusive upper bound. |
score |
float
|
Numeric score assigned to values in this band. |
band |
str
|
Optional qualitative label such as 'low' or 'strong'. |
Source code in src/multidimensional_evaluation_engine/policy/policy.py
Policy
dataclass
¶
Configuration for multidimensional evaluation.
A policy defines: - which factors are recognized - which factors are hard constraints versus scored findings - how raw factor values are mapped to pass/fail findings or scores - how aggregate numeric results are interpreted
Note
factor_specs, constraint_rules, and score_rules are stored as lists for construction convenience. Callers should treat them as logically immutable; the frozen dataclass prevents field reassignment but does not prevent mutation of list contents.
Source code in src/multidimensional_evaluation_engine/policy/policy.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
__post_init__ ¶
Validate cross-references between factor specs and rules.
Source code in src/multidimensional_evaluation_engine/policy/policy.py
from_dict
classmethod
¶
Create a Policy from a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Parsed policy configuration, typically from TOML. |
required |
Returns:
| Type | Description |
|---|---|
Policy
|
Policy instance with typed factor and rule objects. |
Source code in src/multidimensional_evaluation_engine/policy/policy.py
ScoreRule
dataclass
¶
Rule for converting a factor value into a score.
Exactly one mapping style must be used for a given rule: - categorical_scores for categorical factors - numeric_bands for numeric factors - binary_scores for binary factors
Raises:
| Type | Description |
|---|---|
ValueError
|
If not exactly one mapping style is populated. |
Source code in src/multidimensional_evaluation_engine/policy/policy.py
__post_init__ ¶
Validate that exactly one mapping style is populated.