primus.reports.blocks.feedback_alignment_timeline module

class primus.reports.blocks.feedback_alignment_timeline.FeedbackAlignmentTimeline(config: Dict[str, Any], params: Dict[str, Any] | None, api_client: PrimusDashboardClient)

Bases: BaseReportBlock

Report block for visualizing feedback alignment change over time.

Supports: - scorecard only: all scores on the scorecard - scorecard + score/score_id: single-score mode

Bucket policy supports: - complete historical buckets (default when no explicit window is provided) - exact-window buckets (when days or start_date/end_date is provided)

CALENDAR_BUCKET_TYPES = {'calendar_biweek', 'calendar_day', 'calendar_month', 'calendar_week'}
DEFAULT_DAYS = 30
DEFAULT_DESCRIPTION: str | None = 'Alignment metrics over time'
DEFAULT_NAME: str | None = 'Feedback Alignment Timeline'
DEFAULT_ROLLING_MIN_ITEMS = 100
ROLLING_LOOKBACK_START_UTC = datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)
TRAILING_BUCKET_DAYS: Dict[str, int] = {'trailing_14d': 14, 'trailing_1d': 1, 'trailing_30d': 30, 'trailing_7d': 7}
WEEK_START_INDEX = {'monday': 0, 'sunday': 6}
async generate() → Tuple[Dict[str, Any] | None, str | None]

Generates the data for this report block asynchronously.

Access block configuration via self.config and report parameters via self.params. Use self.api_client for data fetching. Use self._log(“message”) to record log information.

Returns:
A tuple containing:
  • A dictionary containing the generated data (JSON-serializable), or None on failure.

  • A string containing concatenated log messages, or None if no logs.