coe pair filter
This commit is contained in:
+43
-1
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user