cadrumo.domain.deadlines.setup_answer_projection module

Registry-aware projection of persisted profile values into setup answers.

The typed answer model lives in the user-profile domain. This domain module owns the projection-specific field specification and composes registry declarations into the projection consumed by deadline profile construction. Core therefore remains independent of registry authority while the registry catalogue remains the one source of these facts.

class SetupFieldSpec(path, answer_type, default=None)[source]

Bases: object

Describe how one setup answer is projected from persisted profile data.

Parameters:
path: str

Dotted profile-record path, e.g. identity.tax_id.

answer_type: type[str] | type[bool]

The stored token’s type; only string and boolean answers are supported.

default: str | None

Token to assume when the profile record has no value for path.

None leaves the answer to the model’s own default. An empty string is a present, declared blank and remains distinct from an absent path.

setup_answer_fields()[source]

Return every setup-answer field that a persisted profile record can fill.

The declarations are resolved from the registry authority in scope on each call, so a republished generation is never answered from a stale copy.

Return type:

dict[str, SetupFieldSpec]

project_setup_answers(values)[source]

Build SetupAnswers from canonical profile-record values.

A present path wins even when its value is blank; only an absent path uses the registry declaration’s default. Blank boolean tokens stay undeclared rather than being collapsed to False.

Return type:

SetupAnswers

Parameters:

values (Mapping[str, str])