qfa.domain.clustering_models#
Domain models for the coding-trend table used in hierarchical analysis.
These models are free of any import from qfa.domain.models so that
models.py can safely import CodingTrendTable without creating
a circular dependency. The chunk model (Chunk),
which DOES import FeedbackRecordModel, lives in
qfa.domain.chunk_models instead.
All models are immutable (frozen) Pydantic models per ADR-001.
Module attributes
Supported granularities for the coding-trend table's period bucketing. |
Classes
|
One (code, period, count) cell of the coding-trend table. |
|
Deterministic, non-LLM count of codes over time periods. |
- qfa.domain.clustering_models.TrendPeriod#
Supported granularities for the coding-trend table’s period bucketing.
Lives in
qfa.domain.clustering_models(rather than alongside the bucketing logic inqfa.services.coding_trends) so that settings and request models — which sit outsideqfa.services— can reference the type without creating a layering loop.alias of
Literal[‘day’, ‘week’, ‘month’]
- class qfa.domain.clustering_models.CodingTrendCell(*, code: str, period: str, count: Annotated[int, Ge(ge=0)])[source]#
Bases:
BaseModelOne (code, period, count) cell of the coding-trend table.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class qfa.domain.clustering_models.CodingTrendTable(*, periods: tuple[str, ...], cells: tuple[CodingTrendCell, ...])[source]#
Bases:
BaseModelDeterministic, non-LLM count of codes over time periods.
Built from feedback-record metadata; fed into the reduce prompt as a faithfulness anchor. When metadata is absent the table is omitted (
Noneat call sites), and reduce degrades to text-only synthesis.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- cells: tuple[CodingTrendCell, ...]#