stats ===== .. py:module:: sidequest_common.schemas.stats .. autoapi-nested-parse:: Officer-facing server stats: ``GET /api/stats``. Aggregated from ``member_activity_hour`` (chat/voice minutes and the XP they earned), ``XPGrant`` (event/group XP), the codebase's shared attendance rule (``sidequest_api.lib.attendance.attended_condition``), and the same counted-group rule used for group XP (``peak_size >= 2`` and ``grouped_minutes``/member ``minutes >= COUNTED_GROUP_MINUTES``). Times, days, and weekday/hour buckets are America/Chicago. .. py:class:: StatsRange Bases: :py:obj:`enum.StrEnum` The window ``GET /api/stats`` reports over. .. py:attribute:: SEVEN_DAYS :value: '7d' .. py:attribute:: THIRTY_DAYS :value: '30d' .. py:attribute:: NINETY_DAYS :value: '90d' .. py:attribute:: ALL :value: 'all' .. py:class:: StatsPerson Bases: :py:obj:`pydantic.BaseModel` Someone on a stats list. ``member_id`` is set when they have a site account (links to their profile). .. py:attribute:: discord_id :type: str .. py:attribute:: display_name :type: str .. py:attribute:: avatar_url :type: str | None :value: None .. py:attribute:: member_id :type: int | None :value: None .. py:class:: StatsLeader Bases: :py:obj:`pydantic.BaseModel` One line on a top-10 leaderboard; what ``value`` counts depends on which list it's on. .. py:attribute:: person :type: StatsPerson .. py:attribute:: value :type: int .. py:class:: StatsTotals Bases: :py:obj:`pydantic.BaseModel` Guild-wide activity totals over a window. .. py:attribute:: active_members :type: int .. py:attribute:: messages :type: int .. py:attribute:: voice_minutes :type: int .. py:attribute:: events_attended :type: int .. py:attribute:: groups_joined :type: int .. py:attribute:: xp_gained :type: int .. py:class:: StatsTrendPoint Bases: :py:obj:`pydantic.BaseModel` One point on the activity trend chart: a day or a Monday-start week, per ``GuildStats.trend_bucket``. .. py:attribute:: start :type: datetime.date .. py:attribute:: messages :type: int .. py:attribute:: voice_minutes :type: int .. py:attribute:: active_members :type: int .. py:class:: StatsHourCell Bases: :py:obj:`pydantic.BaseModel` Activity in one weekday/hour slot, America/Chicago. ``weekday`` 0 is Monday. .. py:attribute:: weekday :type: int .. py:attribute:: hour :type: int .. py:attribute:: messages :type: int .. py:attribute:: voice_minutes :type: int .. py:class:: StatsQuietMember Bases: :py:obj:`pydantic.BaseModel` A roster member still in the guild with no activity in the last 30 days. .. py:attribute:: person :type: StatsPerson .. py:attribute:: last_active_at :type: datetime.datetime | None .. py:attribute:: level :type: int .. py:class:: GuildStats Bases: :py:obj:`pydantic.BaseModel` ``GET /api/stats?range=`` (officer): totals, trend, heatmap, leaderboards, and quiet members. .. py:attribute:: range :type: StatsRange .. py:attribute:: since :type: datetime.datetime | None .. py:attribute:: tracking_since :type: datetime.datetime | None .. py:attribute:: totals :type: StatsTotals .. py:attribute:: previous :type: StatsTotals | None .. py:attribute:: trend_bucket :type: Literal['day', 'week'] .. py:attribute:: trend :type: list[StatsTrendPoint] .. py:attribute:: heatmap :type: list[StatsHourCell] .. py:attribute:: top_chatters :type: list[StatsLeader] .. py:attribute:: top_voice :type: list[StatsLeader] .. py:attribute:: top_events :type: list[StatsLeader] .. py:attribute:: top_groups :type: list[StatsLeader] .. py:attribute:: top_xp :type: list[StatsLeader] .. py:attribute:: gone_quiet :type: list[StatsQuietMember]