Skip to content

Track and display aggregated sample counts in passive RX log entries#166

Merged
MrAlders0n merged 3 commits into
devfrom
copilot/update-rx-log-sample-count
Dec 31, 2025
Merged

Track and display aggregated sample counts in passive RX log entries#166
MrAlders0n merged 3 commits into
devfrom
copilot/update-rx-log-sample-count

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 31, 2025

The batch aggregation system was calculating sample_count when flushing repeater observations but not persisting it in RX log entries. CSV exports always showed SampleCount: 1 even for aggregated batches.

Changes

  • addRxLogEntry(): Added sampleCount parameter (default: 1) to persist aggregated sample counts in log entries
  • queueApiPost(): Propagates entry.sample_count from batch flush to RX log entry
  • createRxLogEntryElement(): Displays "x2", "x3", etc. badge beside repeater chip when sampleCount > 1
// Before: batch aggregation calculated sample_count but didn't store it
flushBatch()  queueApiPost(entry)  addRxLogEntry(...) // missing sample_count

// After: sample_count flows through to storage and display
flushBatch()  queueApiPost(entry)  addRxLogEntry(..., entry.sample_count)

CSV export: Already handled sampleCount field with fallback to 1 for backward compatibility.

UI: Badge appears as <span class="text-xs text-slate-400 ml-1">x{count}</span> beside repeater chips for aggregated entries.

Original prompt

Problem

The passive RX CSV export always shows SampleCount as 1 for every entry, even though the batch aggregation system tracks the actual sample count when multiple observations of the same repeater are aggregated.

Current Behavior

  • rxLogState.entries stores individual raw observations without sample count
  • flushBatch() calculates sample_count for API posting but doesn't store it in the RX log
  • rxLogToCSV() exports from rxLogState.entries without any sample count data

Expected Behavior

Store the aggregated sample_count in each RX log entry when batches are flushed, and display this in both the UI and CSV export.

Implementation Requirements

1. Update addRxLogEntry() function (around line 2884)

Add a sampleCount parameter to the function signature and store it in the entry object:

function addRxLogEntry(repeaterId, snr, rssi, pathLength, header, lat, lon, timestamp, sampleCount = 1) {
  const entry = {
    repeaterId,
    snr,
    rssi,
    pathLength,
    header,
    lat,
    lon,
    timestamp,
    sampleCount  // Add this field
  };
  // ... rest of function
}

2. Update flushBatch() function (around line 2303)

After aggregating the batch data, call addRxLogEntry() with the sample count instead of just queuing for API:

  • Pass sampleCount (the number of samples in the batch) to addRxLogEntry()
  • Use the aggregated SNR values (snr_avg) and first location from the batch

3. Update createRxLogEntryElement() function (around line 2695)

Add a badge beside the repeater chip when sampleCount > 1:

  • After creating the chip element, if entry.sampleCount > 1, add a small badge showing "x2", "x3", etc.
  • The badge should appear beside the chip in the heardChips row
  • Style the badge to be visually distinct (smaller text, different color like slate/gray)

Example badge HTML:

if (entry.sampleCount && entry.sampleCount > 1) {
  const badge = document.createElement('span');
  badge.className = 'text-xs text-slate-400 ml-1';
  badge.textContent = `x${entry.sampleCount}`;
  chipsRow.appendChild(badge);
}

4. Update rxLogToCSV() function (around line 3161)

Update the CSV export to include the SampleCount column:

  • Change header to: Timestamp,RepeaterID,Lat,Lon,SNR,SampleCount,PathLength,Header
  • Include entry.sampleCount || 1 in each row to handle legacy entries without sample count

5. Update handlePassiveRxLogging() function (around line 2129)

For individual observations (not batched), ensure sampleCount is passed as 1 to addRxLogEntry().

Files to Modify

  • content/wardrive.js

Testing

After implementation:

  1. Connect to a device and let passive RX observations accumulate
  2. Verify the RX log UI shows "x2", "x3", etc. badges beside repeater chips when samples are aggregated
  3. Export CSV and verify SampleCount column shows correct aggregated counts
  4. Verify individual (non-batched) observations show SampleCount: 1 in CSV

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 31, 2025 00:57
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Copilot AI changed the title [WIP] Store aggregated sample count in RX log entries Track and display aggregated sample counts in passive RX log entries Dec 31, 2025
Copilot AI requested a review from MrAlders0n December 31, 2025 01:02
@MrAlders0n MrAlders0n marked this pull request as ready for review December 31, 2025 01:10
Copilot AI review requested due to automatic review settings December 31, 2025 01:10
@MrAlders0n MrAlders0n merged commit 90282df into dev Dec 31, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements tracking and display of aggregated sample counts in passive RX log entries. Previously, the batch aggregation system calculated sample_count when flushing repeater observations but did not persist it in RX log entries, resulting in CSV exports always showing SampleCount: 1 even for aggregated batches.

Key Changes

  • Modified addRxLogEntry() to accept and store a sampleCount parameter (defaults to 1 for backward compatibility)
  • Updated queueApiPost() to pass the aggregated sample_count from batch entries to RX log storage
  • Enhanced createRxLogEntryElement() to display a visual badge (e.g., "x2", "x3") beside repeater chips when entries represent multiple aggregated samples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MrAlders0n MrAlders0n deleted the copilot/update-rx-log-sample-count branch December 31, 2025 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants