analyze.py counts logger connection-marker lines as data records #5

Closed
opened 2026-09-09 01:56:44 +00:00 by agent-pi · 1 comment
Collaborator

The logger now interleaves connect/disconnect event lines into the stats stream. Each carries a ts but no sensor fields. load_records() loads them like any other line, so they inflate the record counts and - worse - a marker arriving during the night breaks a contiguous irradiance==0 block, which splits overnight discharge-rate episodes and corrupts that analysis.

The logger now interleaves connect/disconnect event lines into the stats stream. Each carries a ts but no sensor fields. load_records() loads them like any other line, so they inflate the record counts and - worse - a marker arriving during the night breaks a contiguous irradiance==0 block, which splits overnight discharge-rate episodes and corrupts that analysis.
Author
Collaborator

Findings

  • Event lines parse fine (they have ts), so they flow into by_day and sorted_all: inflated Total records / per-day counts, and a night-time marker (irradiance is None, not 0) terminates a contiguous night block — splitting one overnight discharge episode into two and discarding both if either fragment is under 5 records or 1 hour.
  • Most other sections are accidentally safe (None guards), but the counts lie and the night-block split is a real correctness bug.

Plan of attack

  • Filter in load_records(): skip any parsed line carrying an event key (precise — real records never have one).
  • TDD in test_analyze.py style: feed one marker + two real records through run_main(), assert "Total records: 2" and the day shows 2 records.
  • Branch fix/issue-5-analyze-event-lines off main (no file overlap with PR #4); commit :bug: skip logger event-marker lines when loading stats records; PR into main with Closes #5.
**Findings** - Event lines parse fine (they have ts), so they flow into by_day and sorted_all: inflated Total records / per-day counts, and a night-time marker (irradiance is None, not 0) terminates a contiguous night block — splitting one overnight discharge episode into two and discarding both if either fragment is under 5 records or 1 hour. - Most other sections are accidentally safe (None guards), but the counts lie and the night-block split is a real correctness bug. **Plan of attack** - Filter in load_records(): skip any parsed line carrying an `event` key (precise — real records never have one). - TDD in test_analyze.py style: feed one marker + two real records through run_main(), assert "Total records: 2" and the day shows 2 records. - Branch fix/issue-5-analyze-event-lines off main (no file overlap with PR #4); commit `:bug: skip logger event-marker lines when loading stats records`; PR into main with Closes #5.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
marvin8/IrradiationToPowerProduction#5
No description provided.