fix: 按最大干扰值去重CGI
This commit is contained in:
@@ -863,6 +863,7 @@ def process(
|
||||
}
|
||||
)
|
||||
|
||||
duplicate_cgi_rows = deduplicate_by_cgi(summary_rows)
|
||||
populate_nearby_counts(summary_rows)
|
||||
populate_previous_values(summary_rows, previous_rows)
|
||||
summary_rows.sort(key=lambda item: (item["cgi"], item["cell_name"]))
|
||||
@@ -884,6 +885,7 @@ def process(
|
||||
"cell_data_file_count": len(cell_data_workbooks),
|
||||
"summary_rows": len(summary_rows),
|
||||
"threshold_filtered_rows": threshold_filtered_rows,
|
||||
"duplicate_cgi_rows": duplicate_cgi_rows,
|
||||
"coordinate_matched_rows": matched_coordinates,
|
||||
"coordinate_unmatched_rows": len(summary_rows) - matched_coordinates,
|
||||
"files": manifest_files,
|
||||
@@ -907,6 +909,7 @@ def process(
|
||||
print(f"cell_data_files={len(cell_data_workbooks)}")
|
||||
print(f"summary_rows={len(summary_rows)}")
|
||||
print(f"threshold_filtered_rows={threshold_filtered_rows}")
|
||||
print(f"duplicate_cgi_rows={duplicate_cgi_rows}")
|
||||
print(f"coordinate_matched_rows={matched_coordinates}")
|
||||
print(f"coordinate_unmatched_rows={len(summary_rows) - matched_coordinates}")
|
||||
if database_result["enabled"]:
|
||||
@@ -1013,6 +1016,21 @@ def populate_nearby_counts(rows: list[dict[str, str]]) -> None:
|
||||
rows[index]["nearby_count"] = str(count)
|
||||
|
||||
|
||||
def deduplicate_by_cgi(rows: list[dict[str, str]]) -> int:
|
||||
selected: dict[str, dict[str, str]] = {}
|
||||
removed = 0
|
||||
for row in rows:
|
||||
previous = selected.get(row["cgi"])
|
||||
if previous is None:
|
||||
selected[row["cgi"]] = row
|
||||
continue
|
||||
if Decimal(row["interference_dbm"]) > Decimal(previous["interference_dbm"]):
|
||||
selected[row["cgi"]] = row
|
||||
removed += 1
|
||||
rows[:] = selected.values()
|
||||
return removed
|
||||
|
||||
|
||||
def populate_previous_values(rows: list[dict[str, str]], previous_rows: list[dict[str, str]]) -> None:
|
||||
previous_by_cgi = {row["cgi"]: row for row in previous_rows}
|
||||
for row in rows:
|
||||
|
||||
Reference in New Issue
Block a user