Files
ulsu-stat/CONTEXT_EXPORT.md
kozhilya c11c9e8aa8 feat: Add stages for processing university schedule and authentication logs
- Implemented `stage_parse_schedule.py` to normalize and prepare university schedule data.
- Created `stage_process_logs.py` for processing authentication logs and generating session records.
- Added necessary classes and methods for log entry parsing, session extraction, and CSV output.
- Updated `settings.yaml` with new schedule and processing configurations.
- Introduced new templates and styles for report generation, including HTML and CSS files.
- Added main entry point `run.py` to execute the attendance processing pipeline.
- Included `.gitkeep` files in `output` and `result` directories to maintain structure.
2026-05-08 11:20:13 +04:00

3.5 KiB
Raw Permalink Blame History

Context export for continuation

Project goal

Process computer class attendance logs in several sequential stages with a single entry point.

Current structure

Stage 1 behavior

Loads:

  • settings.yaml
  • data/classes.csv

Current settings.yaml keys:

  • year.first_week
  • year.week
  • year.schedule
  • sections
  • classes
  • class_ips
  • processing

processing currently contains:

  • m1_ip_to_name_switch_date: 2026-04-08
  • amt_group_id: amt
  • amt_class_id: АМТ-33

Stage 2 behavior

Reads logs from:

  • input/stat_m1
  • input/stat_okk1

Log format:

  • one file per day
  • example: input/stat_m1/m1_202601/13.txt

Parsed session output format:

  • station,user,start,end

Grouping rules currently implemented

okk1

  • Computer names are of the form {prefix}{station}
  • Files are grouped by class id from classes.csv

m1 before 2026-04-08

  • Source uses IP addresses
  • Files are grouped by ip_group from classes.csv
  • The file name is the ip_group value, for example:
    • pu.csv
    • mk.csv
    • lv.csv
    • kl.csv
    • fe.csv
    • km.csv
    • mu.csv
    • amt.csv

m1 from 2026-04-08 onward

  • Source uses computer names like pu-402-1
  • Files are grouped by class id from classes.csv
  • Examples:
    • 4а-402.csv
    • 4а-407.csv
    • 4а-806.csv
    • ИЭиБ-10.csv
    • МФ-207.csv
    • ЮФ-309.csv
    • МК-26.csv
    • МК-28.csv
    • МУ-21.csv
    • ЭГФ-11.csv

AMT exception

  • amt is always kept as one group in result/logs/amt.csv
  • This applies across the whole period, including after 2026-04-08
  • AMT does not split into separate class/computer files

Important data facts

classes.csv

Columns now are:

  • id
  • class
  • description
  • part
  • computers
  • section
  • prefix
  • ip_group

Notes:

  • part was added for future use
  • ip_group is used only for m1 pre-2026-04-08 grouping
  • amt rows have ip_group=amt

Current pipeline output

Last verified run produced:

  • 25 output files
  • 16417 sessions total

Output file map

Class files

  • 1-301.csv
  • 1-303.csv
  • 1-503.csv
  • 1-505.csv
  • 3-111.csv
  • 3-115.csv
  • 3-118.csv
  • 3-127.csv
  • 3-522.csv
  • 4а-402.csv
  • 4а-407.csv
  • 4а-806.csv
  • ИЭиБ-10.csv
  • МК-26.csv
  • МК-28.csv
  • МФ-207.csv
  • МУ-21.csv
  • ЭГФ-11.csv

IP-group files

  • amt.csv
  • fe.csv
  • kl.csv
  • km.csv
  • lv.csv
  • mk.csv
  • mu.csv
  • pu.csv

Known implementation details

  • The processor loads settings.yaml through SettingsLoader in stage 2.
  • YAML date values may already be parsed as date objects, so stage 2 handles both strings and date-like values.
  • The project runs successfully with:
    • ./venv/bin/python run.py

Validation status

  • Stage 1: OK
  • Stage 2: OK
  • AMT special case: OK
  • m1 switch date from settings: OK

If continuing development

Likely next steps are:

  • clean up duplicated or brittle matching logic in lib/stage_process_logs.py
  • add a third stage for statistics or reporting
  • write tests for:
    • okk1 class matching
    • m1 pre-switch ip_group grouping
    • m1 post-switch class-name grouping
    • AMT exception behavior