ЧТМ:Центр управления модулями: различия между версиями

Материал из ЧТМ
Перейти к навигации Перейти к поиску
Нет описания правки
Нет описания правки
Строка 76: Строка 76:
* [[ЧТМ:Тест_модуля/Streaks|Streaks]]
* [[ЧТМ:Тест_модуля/Streaks|Streaks]]
* [[ЧТМ:Тест_модуля/Отчёт о матче|Отчёт о матче]]
* [[ЧТМ:Тест_модуля/Отчёт о матче|Отчёт о матче]]
* [[ЧТМ:Тест_модуля/MatchTable|MatchTable]]


== Дополнительно ==
== Дополнительно ==

Версия от 10:49, 22 апреля 2026

Чтобы выполнение главной текущей задачи — автоматизации ЧТМ Вики с помощью Lua — не расползлось и не растерялось, собираем все главные направления на одной странице.

Базы данных

Модуль:Data (завершена — 2006, 2010, 2014, 2018, 2022, 2026, 2030, 2034, 2038, 2042, 2046)

Модуль:Data/Teams — словарь команд, надо ещё вычитать и проверить (фрагмент для быстрого копирования)

Модуль:Data/Rating — выступления команд на различных турнирах, необходимо сильно пройтись

Модуль:Data/Tournaments (в процессе, пользуйтесь скриптом (или этим скриптом) на python для быстрого заполнения БД в корректном формате, а также скриптом для замены полных названий на трёхбуквенные коды, их можно выполнить, например, в Colab)

Главные технические модули

Модули вывода вики-текста

Категория

Экспериментальные модули

Узкоспециализированные модули-образцы:

Выполняются стандартно:

{{#invoke:Название модуля|main}}

Тесты модулей

Для быстрой проверки.

Дополнительно

{{Doc/begin|{{FULLPAGENAME}}}}{{Docpage}}<includeonly>{{Docpage/для модулей}}</includeonly>

----
<includeonly>''Пожалуйста, добавляйте категории на страницу [[/doc|документации]]''.</includeonly>{{Doc/end}}

Шпаргалка для ИИ

[SYSTEM CONTEXT: MEDIAWIKI STATENGINE ARCHITECTURE]

Stack: Lua 5.1 (Scribunto), MediaWiki API. Paradigm: Data-Driven Design, Functional-Procedural, Stateless ETL (Extract, Transform, Load).

1. Data Layer (Module:Data/*)

  • Structure: Static key-value nested tables. Key = match_id (String: "YYYY-NN"), Value = Match Data Object.
  • Role: Raw data storage. No computational logic.
  • Properties: Arrays of events (goals, cards, subs, shootout), scalar metadata (stage, score1, aet, matchday).

2. Configuration Layer (Module:Config)

  • Role: Global Registry, Dependency Injection context, and Utility library.
  • Key Components:
    • eras: Temporal bounds mapping (Integer keys -> Feature flags). Blocks evaluation of metrics for legacy data where tracking didn't exist.
    • metrics: Dictionary of Metric Definitions. Uses First-Class Functions (get_val) for dynamic object traversal. Defines sort directions (anti_prize) and schema for hardcoded runtime mutations (adjustments).
    • playoff_stages: O(1) hash map for conditional filtering.
    • utils: Pure functions for math, string parsing, and array lookups.
    • builder: Abstraction layer for MW HTML node generation (mw.html.create).

3. Core Processing Engine (Module:StatEngine)

  • Role: The ETL Harvester. Single-pass data aggregator.
  • Performance: $O(M \times E)$ where $M$ is matches and $E$ is events per match.
  • Architecture:
    • Extractor functions (extract_goals, extract_pm, etc.) isolate domain logic per entity type. They yield intermediate maps.
    • merge_stats() acts as a global Reducer. Deep-merges intermediate maps into the master Data Transfer Objects (DTOs).
    • Outputs 3 scoped hash maps: Stats.Players, Stats.Teams, Stats.PlayerTeam (composite key Player_TeamCode).
    • Handles temporal patching (injecting Config.metrics.*.adjustments post-processing).

4. Adapter Layer (Module:StatEngine/Legacy)

  • Role: Facade / Adapter Pattern.
  • Purpose: Exposes modern Harvester extractors to legacy MediaWiki templates via deprecated API signatures (getAllPlayersMatchStats, getCategoryStats).
  • Mechanics: Wraps specific extractors, bypasses global aggregation, transforms output schemas to match legacy template AST expectations.

5. Specialized Aggregator (Module:StatEngine/Matchday)

  • Role: Context-aware data builder scoped to match.matchday == target.
  • Key Features:
    • Calculates relational/graph data (e.g., Goalies track faced_opponents to compute opponent strength opp_avg_goals).
    • H2H Engine (comparePair): Time-series calculation. Chronologically sorts matches via num_hist, calculates running differentials (points, GD), tracks state changes to determine temporal dominance (adv_pts_count, last_pts_start).

6. Rules & Sorting Engine (Module:StatEngine/TournamentAwards)

  • Role: Comparator chaining, Dense/Standard Ranking assignment, Medaling.
  • Components:
    • evaluateMatchdayPrizes: Takes Matchday aggregates. Passes DTOs through distinct chained comparators (for MVP, Scorer, Assist, etc.). Assigns CSS color codes based on Rank.
    • getTournamentAwards: High-complexity rules engine. Uses a 12-tier comparator sequence (Non-penalty goals -> playoff stages weighted -> match cluster density -> chronological tiebreaker via num_hist). Incorporates manual mutations from Config.award_adjustments.
    • getGenericMetricByTeams: Dynamic sorter mapping to Config.metrics. Handles conditional logic for inverted metrics (anti_prize / worst flag).