coe pair filter

This commit is contained in:
2026-05-27 11:29:02 -04:00
parent 8da5957024
commit 5996443f38
8 changed files with 221 additions and 7 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
+14
View File
@@ -65,6 +65,7 @@ def _init_db():
"ul_rssi_dbm REAL",
"tput_results TEXT",
"throttled TEXT",
"coe_pair TEXT",
]:
try:
_conn.execute(f"ALTER TABLE tests ADD COLUMN {col_def}")
@@ -138,6 +139,19 @@ def mark_completed(test_id, device, completed_at, duration_seconds, tput_results
)
def set_coe_pair(test_row_id, coe_pair):
json_value = json.dumps(coe_pair or [])
with _tx():
_conn.execute(
"""
UPDATE tests
SET coe_pair = ?
WHERE id = ?
""",
(json_value, test_row_id),
)
def get_station_for_test(test_id, device):
with _lock:
row = _conn.execute(
+43 -1
View File
@@ -1,7 +1,7 @@
import os
import re
from db_py import clear_tests, mark_completed, upsert_test
from db_py import clear_tests, get_all_tests, mark_completed, set_coe_pair, upsert_test
from parser import (
parse_elapsed_time,
parse_result_filename,
@@ -21,6 +21,48 @@ def full_scan(target_dir, results_dir):
scan_targets(target_dir)
scan_results(results_dir)
update_p2p_coe_pairs()
def update_p2p_coe_pairs():
pair_fields = [
"device",
"rotation",
"test_point",
"rssi",
"station",
"band",
"channel",
"bandwidth",
"direction",
]
tests = get_all_tests()
coe_by_key = {}
for test in tests:
if test.get("interference") != "COE":
continue
key = tuple(test.get(field) for field in pair_fields)
device = test.get("device")
test_id = test.get("test_id")
if not device or not test_id:
continue
coe_by_key.setdefault(key, []).append(f"{device}_{test_id}")
updated = 0
for test in tests:
if test.get("interference") != "P2P":
continue
key = tuple(test.get(field) for field in pair_fields)
pairs = sorted(set(coe_by_key.get(key, [])))
set_coe_pair(test.get("id"), pairs)
updated += 1
print(f"[scanner] coe_pair updated for {updated} P2P test(s)")
def scan_targets(target_dir):