Disambiguation between Towers and Toilets on the Air

This commit is contained in:
Ian Renton
2026-06-25 19:25:05 +01:00
parent 215b61593b
commit d1df772649
17 changed files with 90 additions and 60 deletions

View File

@@ -1,13 +1,21 @@
from dataclasses import dataclass
from dataclasses import dataclass, field
@dataclass
class SIG:
"""Data class that defines a Special Interest Group."""
"""Data class that defines a Special Interest Group. Each contains a name and a longer form description.
They also contain comment_names which attempts to separate out the way people might refer to it in
cluster comments from how it is referred to in the UI & API. (For example, "TOTA" in cluster spot comments
almost always means Towers on the Air, but no single programme is referred to in the UI as "TOTA" as
it's ambiguous between Towers, Toilets and Tiles. And while Beaches got the name "BOTA" first, "BOTA" spots
are much more likely to be bunkers.) Finally, there is a ref_regex which provides a regular expression to
match what references (such as parks and summits) look like for that programme."""
# SIG name, e.g. "POTA"
# SIG name as used in the UI and API, e.g. "Towers"
name: str
# Description, e.g. "Parks on the Air"
# Description, e.g. "Towers on the Air"
description: str
# SIG names as they might appear in cluster spot comments, e.g. ["TOTA"]
comment_names: list[str] = field(default_factory=list)
# Regex matcher for references, e.g. for POTA r"[A-Z]{2}\-\d+".
ref_regex: str = None
ref_regex: str | None = None

View File

@@ -14,7 +14,7 @@ from core.constants import MODE_ALIASES, PROPAGATION_MODES
from core.geo_utils import lat_lon_to_cq_zone, lat_lon_to_itu_zone
from core.lookup_helper import lookup_helper, infer_band_from_freq, infer_mode_from_comment, \
infer_mode_from_frequency, infer_mode_type_from_mode
from core.sig_utils import populate_sig_ref_info, ANY_SIG_REGEX, get_ref_regex_for_sig
from core.sig_utils import populate_sig_ref_info, ANY_SIG_REGEX, get_ref_regex_for_sig, get_sig_name_from_comment_name
from data.sig_ref import SIGRef
@@ -255,7 +255,7 @@ class Spot:
for sig_match in sig_matches:
# First of all, if we haven't got a SIG for this spot set yet, now we have. This covers things like cluster
# spots where the comment is just "POTA".
found_sig = sig_match.group(2).upper()
found_sig = get_sig_name_from_comment_name(sig_match.group(2))
if not self.sig:
self.sig = found_sig