- 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.
3.5 KiB
3.5 KiB
Context export for continuation
Project goal
Process computer class attendance logs in several sequential stages with a single entry point.
Current structure
- Main entry point: run.py
- Pipeline orchestration: lib/pipeline.py
- Stage 1: lib/stage_load_settings.py
- Stage 2: lib/stage_process_logs.py
- Config: settings.yaml
- Class registry: data/classes.csv
- Output folder: result/logs
Stage 1 behavior
Loads:
settings.yamldata/classes.csv
Current settings.yaml keys:
year.first_weekyear.weekyear.schedulesectionsclassesclass_ipsprocessing
processing currently contains:
m1_ip_to_name_switch_date: 2026-04-08amt_group_id: amtamt_class_id: АМТ-33
Stage 2 behavior
Reads logs from:
input/stat_m1input/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
idfromclasses.csv
m1 before 2026-04-08
- Source uses IP addresses
- Files are grouped by
ip_groupfromclasses.csv - The file name is the
ip_groupvalue, for example:pu.csvmk.csvlv.csvkl.csvfe.csvkm.csvmu.csvamt.csv
m1 from 2026-04-08 onward
- Source uses computer names like
pu-402-1 - Files are grouped by class
idfromclasses.csv - Examples:
4а-402.csv4а-407.csv4а-806.csvИЭиБ-10.csvМФ-207.csvЮФ-309.csvМК-26.csvМК-28.csvМУ-21.csvЭГФ-11.csv
AMT exception
amtis always kept as one group inresult/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:
idclassdescriptionpartcomputerssectionprefixip_group
Notes:
partwas added for future useip_groupis used only for m1 pre-2026-04-08 groupingamtrows haveip_group=amt
Current pipeline output
Last verified run produced:
- 25 output files
- 16417 sessions total
Output file map
Class files
1-301.csv1-303.csv1-503.csv1-505.csv3-111.csv3-115.csv3-118.csv3-127.csv3-522.csv4а-402.csv4а-407.csv4а-806.csvИЭиБ-10.csvМК-26.csvМК-28.csvМФ-207.csvМУ-21.csvЭГФ-11.csv
IP-group files
amt.csvfe.csvkl.csvkm.csvlv.csvmk.csvmu.csvpu.csv
Known implementation details
- The processor loads
settings.yamlthroughSettingsLoaderin 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