From b132fe8a39b6fb5998ad3f19642fe3395c1d3497 Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Mon, 17 Nov 2025 17:19:43 +0000 Subject: [PATCH] Fix a bug where SIG API spots could be re-tagged as another SIG e.g. WAB if that was named in the comment. --- data/spot.py | 8 ++++++-- spotproviders/gma.py | 7 +++++++ spotproviders/hema.py | 1 + spotproviders/parksnpeaks.py | 1 + spotproviders/pota.py | 1 + spotproviders/sota.py | 1 + spotproviders/wota.py | 1 + spotproviders/wwbota.py | 1 + spotproviders/wwff.py | 1 + spotproviders/zlota.py | 1 + 10 files changed, 21 insertions(+), 2 deletions(-) diff --git a/data/spot.py b/data/spot.py index de5a22e..a53c758 100644 --- a/data/spot.py +++ b/data/spot.py @@ -239,11 +239,15 @@ class Spot: if self.dx_latitude: self.dx_location_source = "SPOT" - # See if we already have a SIG reference, but the comment looks like it contains more for the same SIG. This + # Set the top-level "SIG" if it is missing but we have at least one SIG ref. + if not self.sig and self.sig_refs and len(self.sig_refs) > 0: + self.sig = self.sig_refs[0].sig.upper() + + # See if we already have a SIG reference, but the comment looks like it contains more for the same SIG. This # should catch e.g. POTA comments like "2-fer: GB-0001 GB-0002". if self.comment and self.sig_refs and len(self.sig_refs) > 0: sig = self.sig_refs[0].sig.upper() - all_comment_ref_matches = re.finditer(r"(^|\W)" + get_ref_regex_for_sig(sig) + r"(^|\W)", self.comment, re.IGNORECASE) + all_comment_ref_matches = re.finditer(r"(^|\W)(" + get_ref_regex_for_sig(sig) + r")(^|\W)", self.comment, re.IGNORECASE) for ref_match in all_comment_ref_matches: self.append_sig_ref_if_missing(SIGRef(id=ref_match.group(2).upper(), sig=sig)) diff --git a/spotproviders/gma.py b/spotproviders/gma.py index 7fb9c76..85b752e 100644 --- a/spotproviders/gma.py +++ b/spotproviders/gma.py @@ -54,20 +54,27 @@ class GMA(HTTPSpotProvider): match ref_info["reftype"]: case "Summit": spot.sig_refs[0].sig = "GMA" + spot.sig = "GMA" case "IOTA Island": spot.sig_refs[0].sig = "IOTA" + spot.sig = "IOTA" case "Lighthouse (ILLW)": spot.sig_refs[0].sig = "ILLW" + spot.sig = "ILLW" case "Lighthouse (ARLHS)": spot.sig_refs[0].sig = "ARLHS" + spot.sig = "ARLHS" case "Castle": spot.sig_refs[0].sig = "WCA" + spot.sig = "WCA" case "Mill": spot.sig_refs[0].sig = "MOTA" + spot.sig = "MOTA" case _: logging.warn("GMA spot found with ref type " + ref_info[ "reftype"] + ", developer needs to add support for this!") spot.sig_refs[0].sig = ref_info["reftype"] + spot.sig = ref_info["reftype"] # Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do # that for us. diff --git a/spotproviders/hema.py b/spotproviders/hema.py index c579eab..684c51f 100644 --- a/spotproviders/hema.py +++ b/spotproviders/hema.py @@ -53,6 +53,7 @@ class HEMA(HTTPSpotProvider): freq=float(freq_mode_match.group(1)) * 1000000, mode=freq_mode_match.group(2).upper(), comment=spotter_comment_match.group(2), + sig="HEMA", sig_refs=[SIGRef(id=spot_items[3].upper(), sig="HEMA", name=spot_items[4])], time=datetime.strptime(spot_items[0], "%d/%m/%Y %H:%M").replace(tzinfo=pytz.UTC).timestamp(), dx_latitude=float(spot_items[7]), diff --git a/spotproviders/parksnpeaks.py b/spotproviders/parksnpeaks.py index 1ed3fb1..afbb80a 100644 --- a/spotproviders/parksnpeaks.py +++ b/spotproviders/parksnpeaks.py @@ -33,6 +33,7 @@ class ParksNPeaks(HTTPSpotProvider): # Seen PNP spots with empty frequency, and with comma-separated thousands digits mode=source_spot["actMode"].upper(), comment=source_spot["actComments"], + sig=source_spot["actClass"].upper(), sig_refs=[SIGRef(id=source_spot["actSiteID"], sig=source_spot["actClass"].upper())], time=datetime.strptime(source_spot["actTime"], "%Y-%m-%d %H:%M:%S").replace( tzinfo=pytz.UTC).timestamp()) diff --git a/spotproviders/pota.py b/spotproviders/pota.py index 03eb47d..56d23dc 100644 --- a/spotproviders/pota.py +++ b/spotproviders/pota.py @@ -31,6 +31,7 @@ class POTA(HTTPSpotProvider): freq=float(source_spot["frequency"]) * 1000, mode=source_spot["mode"].upper(), comment=source_spot["comments"], + sig="POTA", sig_refs=[SIGRef(id=source_spot["reference"], sig="POTA", name=source_spot["name"])], time=datetime.strptime(source_spot["spotTime"], "%Y-%m-%dT%H:%M:%S").replace( tzinfo=pytz.UTC).timestamp(), diff --git a/spotproviders/sota.py b/spotproviders/sota.py index 4686841..024c087 100644 --- a/spotproviders/sota.py +++ b/spotproviders/sota.py @@ -45,6 +45,7 @@ class SOTA(HTTPSpotProvider): freq=(float(source_spot["frequency"]) * 1000000) if (source_spot["frequency"] is not None) else None, # Seen SOTA spots with no frequency! mode=source_spot["mode"].upper(), comment=source_spot["comments"], + sig="SOTA", sig_refs=[SIGRef(id=source_spot["summitCode"], sig="SOTA", name=source_spot["summitName"])], time=datetime.fromisoformat(source_spot["timeStamp"]).timestamp(), activation_score=source_spot["points"]) diff --git a/spotproviders/wota.py b/spotproviders/wota.py index c894ebe..9dbdd27 100644 --- a/spotproviders/wota.py +++ b/spotproviders/wota.py @@ -66,6 +66,7 @@ class WOTA(HTTPSpotProvider): freq=freq_hz, mode=mode, comment=comment, + sig="WOTA", sig_refs=[SIGRef(id=ref, sig="WOTA", name=ref_name)] if ref else [], time=time.timestamp()) diff --git a/spotproviders/wwbota.py b/spotproviders/wwbota.py index e9b5a77..2b8272e 100644 --- a/spotproviders/wwbota.py +++ b/spotproviders/wwbota.py @@ -29,6 +29,7 @@ class WWBOTA(SSESpotProvider): freq=float(source_spot["freq"]) * 1000000, mode=source_spot["mode"].upper(), comment=source_spot["comment"], + sig="WWBOTA", sig_refs=refs, time=datetime.fromisoformat(source_spot["time"]).timestamp(), # WWBOTA spots can contain multiple references for bunkers being activated simultaneously. For diff --git a/spotproviders/wwff.py b/spotproviders/wwff.py index 85ee774..9e32fd6 100644 --- a/spotproviders/wwff.py +++ b/spotproviders/wwff.py @@ -28,6 +28,7 @@ class WWFF(HTTPSpotProvider): freq=float(source_spot["frequency_khz"]) * 1000, mode=source_spot["mode"].upper(), comment=source_spot["remarks"], + sig="WWFF", sig_refs=[SIGRef(id=source_spot["reference"], sig="WWFF", name=source_spot["reference_name"])], time=datetime.fromtimestamp(source_spot["spot_time"], tz=pytz.UTC).timestamp(), dx_latitude=source_spot["latitude"], diff --git a/spotproviders/zlota.py b/spotproviders/zlota.py index b60c145..7e0ee1b 100644 --- a/spotproviders/zlota.py +++ b/spotproviders/zlota.py @@ -34,6 +34,7 @@ class ZLOTA(HTTPSpotProvider): freq=freq_hz, mode=source_spot["mode"].upper().strip(), comment=source_spot["comments"], + sig="ZLOTA", sig_refs=[SIGRef(id=source_spot["reference"], sig="ZLOTA", name=source_spot["name"])], time=datetime.fromisoformat(source_spot["referenced_time"]).astimezone(pytz.UTC).timestamp())