Compare commits

..
12 changed files with 81 additions and 52 deletions
+6 -6
View File
@@ -10,7 +10,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
refs_globally_unique=False, refs_globally_unique=False,
# No sensible way to determine *which* contest, but if we set comment_names=["CONTEST"] then at least # No sensible way to determine *which* contest, but if we set comment_names=["CONTEST"] then at least
# any spots with "contest" in the comment will get allocated to this activity. # any spots with "contest" in the comment will get allocated to this activity.
comment_names=["CONTEST"], comment_names=["CONTEST", "TEST"],
icon="fa-trophy", icon="fa-trophy",
alerts_possible=True, alerts_possible=True,
), ),
@@ -92,7 +92,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
description="Summits on the Air", description="Summits on the Air",
sig_type=ActivityType.ADVENTURE, sig_type=ActivityType.ADVENTURE,
has_refs=True, has_refs=True,
refs_globally_unique=False, refs_globally_unique=True,
ref_type=ActivityRefType.SUMMIT, ref_type=ActivityRefType.SUMMIT,
ref_regex=r"[A-Z0-9]{1,3}\/[A-Z]{2}\-\d{3}", ref_regex=r"[A-Z0-9]{1,3}\/[A-Z]{2}\-\d{3}",
comment_names=["SOTA"], comment_names=["SOTA"],
@@ -150,9 +150,9 @@ ACTIVITIES: dict[ActivityName, Activity] = {
description="Islands on the Air", description="Islands on the Air",
sig_type=ActivityType.ADVENTURE, sig_type=ActivityType.ADVENTURE,
has_refs=True, has_refs=True,
refs_globally_unique=False, refs_globally_unique=True,
ref_type=ActivityRefType.ISLAND, ref_type=ActivityRefType.ISLAND,
ref_regex=r"[A-Z]{2}\-\d{3}", ref_regex=r"(?:AF|AN|AS|EU|NA|OC|SA)\-\d{3}",
comment_names=["IOTA"], comment_names=["IOTA"],
icon="fa-book-atlas", icon="fa-book-atlas",
), ),
@@ -163,7 +163,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
has_refs=True, has_refs=True,
refs_globally_unique=False, refs_globally_unique=False,
ref_type=ActivityRefType.ISLAND, ref_type=ActivityRefType.ISLAND,
ref_regex=r"(([A-Z]{2}\-\d{3})|([A-Z0-9]{1,3}\/[A-Z]{2}\-\d{3}))", ref_regex=r"(?:(?:[A-Z]{2}\-\d{3})|(?:[A-Z0-9]{1,3}\/[A-Z]{2}\-\d{3}))",
comment_names=[], comment_names=[],
icon="fa-person-hiking", icon="fa-person-hiking",
), ),
@@ -386,7 +386,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
# FEA references are technically [DE]\-\d{4}(\.\d)? but spotters always seem to miss out the D- or E- # FEA references are technically [DE]\-\d{4}(\.\d)? but spotters always seem to miss out the D- or E-
# prefix and just use FEA-1234 or FEA 1234, so allow for that. The FEA activity ref data provider adds both # prefix and just use FEA-1234 or FEA 1234, so allow for that. The FEA activity ref data provider adds both
# forms to the database. # forms to the database.
ref_regex=r"([DE]|FEA)[\- ]\d{4}(\.\d)?", ref_regex=r"(?:[DE]|FEA)[\- ]\d{4}(?:\.\d)?",
comment_names=["FEA"], comment_names=["FEA"],
icon="fa-house-flood-water", icon="fa-house-flood-water",
region_flag="🇪🇸", region_flag="🇪🇸",
+20 -9
View File
@@ -359,20 +359,20 @@ class Spot:
# These are common on cluster spots and can provide grid references in preference to e.g. QRZ lookup, as well as # These are common on cluster spots and can provide grid references in preference to e.g. QRZ lookup, as well as
# being the only source we have for propagation mode. Brace for nightmare regex from hell. # being the only source we have for propagation mode. Brace for nightmare regex from hell.
if self.comment: if self.comment:
grid_mode_grid_match = re.search( grid_match = re.search(
r"\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)(?:<([^>]*)>|\(([^)]*)\))([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b", r"\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)(?:<([^>]*)>|\(([^)]*)\))([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b",
self.comment, self.comment,
) )
if grid_mode_grid_match: if grid_match:
# regex matches, so extract grids: # regex matches, so extract grids:
if not self.de_grid: if not self.de_grid:
self.de_grid = grid_mode_grid_match.group(1).upper() self.de_grid = grid_match.group(1).upper()
if not self.dx_grid: if not self.dx_grid:
self.dx_grid = grid_mode_grid_match.group(4).upper() self.dx_grid = grid_match.group(4).upper()
self.dx_location_source = LocationSourceForSpot.GRID self.dx_location_source = LocationSourceForSpot.GRID
# And extract propagation mode (group 2 for <...>, group 3 for (...)): # And extract propagation mode (group 2 for <...>, group 3 for (...)):
mode_tag = (grid_mode_grid_match.group(2) or grid_mode_grid_match.group(3) or "").upper() mode_tag = (grid_match.group(2) or grid_match.group(3) or "").upper()
if mode_tag and not self.propagation_mode: if mode_tag and not self.propagation_mode:
if mode_tag in PROPAGATION_MODES: if mode_tag in PROPAGATION_MODES:
self.propagation_mode = PROPAGATION_MODES[mode_tag] self.propagation_mode = PROPAGATION_MODES[mode_tag]
@@ -386,6 +386,17 @@ class Spot:
if self.propagation_mode == "Earth-Moon-Earth" and not self.sig: if self.propagation_mode == "Earth-Moon-Earth" and not self.sig:
self.sig = ActivityName.EME self.sig = ActivityName.EME
# Parse 6-digit grid structures from the comment if the frequency is VHF or above, as it's common to see
# VHF+ operators spotted with their grid
if self.comment and self.freq and self.freq > 30000000:
grid_match = re.search(
r"\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b",
self.comment,
)
if grid_match and not self.dx_grid:
self.dx_grid = grid_match.group(1).upper()
self.dx_location_source = LocationSourceForSpot.GRID
# Set activities based on the DX callsign suffix # Set activities based on the DX callsign suffix
if self.dx_call and not self.sig: if self.dx_call and not self.sig:
if self.dx_call.upper().endswith(ActivityName.AERONAUTICAL_MOBILE): if self.dx_call.upper().endswith(ActivityName.AERONAUTICAL_MOBILE):
@@ -411,17 +422,17 @@ class Spot:
# Parse "de_grid -> dx_grid" structures from the comment # Parse "de_grid -> dx_grid" structures from the comment
if self.comment: if self.comment:
grid_mode_grid_match = re.search( grid_match = re.search(
r"\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\s*->\s*([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b", r"\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\s*->\s*([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b",
self.comment, self.comment,
) )
if grid_mode_grid_match: if grid_match:
# regex matches, so extract grids: # regex matches, so extract grids:
if not self.dx_grid: if not self.dx_grid:
self.dx_grid = grid_mode_grid_match.group(1).upper() self.dx_grid = grid_match.group(1).upper()
self.dx_location_source = LocationSourceForSpot.GRID self.dx_location_source = LocationSourceForSpot.GRID
if not self.de_grid: if not self.de_grid:
self.de_grid = grid_mode_grid_match.group(2).upper() self.de_grid = grid_match.group(2).upper()
# DX Grid to lat/lon and vice versa in case one is missing # DX Grid to lat/lon and vice versa in case one is missing
if self.dx_grid and (not self.dx_latitude or not self.dx_longitude): if self.dx_grid and (not self.dx_latitude or not self.dx_longitude):
+19 -16
View File
@@ -98,24 +98,27 @@ class GMA(HTTPSpotProvider):
and ref_response.text != "\n" and ref_response.text != "\n"
): ):
ref_info = ref_response.json() ref_info = ref_response.json()
# If this is POTA, SOTA or WWFF data we already have it through other means, so ignore. POTA and WWFF if spot.sig_refs and ref_info and "reftype" in ref_info:
# spots come through with reftype=POTA or reftype=WWFF. SOTA is harder to figure out because both SOTA
# and GMA summits come through with reftype=Summit, so we must check for the presence of a "sota" entry
# to determine if it's a SOTA summit.
if (
spot.sig_refs
and ref_info
and "reftype" in ref_info
and ref_info["reftype"] not in [ActivityName.POTA, ActivityName.WWFF]
and (
ref_info["reftype"] != "Summit" or "sota" not in ref_info or ref_info["sota"] == ""
)
):
match ref_info["reftype"]: match ref_info["reftype"]:
case "Summit": case "Summit":
spot.sig_refs[0].sig = ActivityName.GMA # Summits are a bit complicated, they can be SOTA or GMA depending on the
spot.sig_refs[0].ref_type = ActivityRefType.SUMMIT # separate "sota" field:
spot.sig = ActivityName.GMA if "sota" in ref_info and ref_info["sota"] != "":
spot.sig_refs[0].sig = ActivityName.SOTA
spot.sig_refs[0].ref_type = ActivityRefType.SUMMIT
spot.sig = ActivityName.SOTA
else:
spot.sig_refs[0].sig = ActivityName.GMA
spot.sig_refs[0].ref_type = ActivityRefType.SUMMIT
spot.sig = ActivityName.GMA
case "POTA":
spot.sig_refs[0].sig = ActivityName.POTA
spot.sig_refs[0].ref_type = ActivityRefType.PARK
spot.sig = ActivityName.POTA
case "WWFF":
spot.sig_refs[0].sig = ActivityName.WWFF
spot.sig_refs[0].ref_type = ActivityRefType.PARK
spot.sig = ActivityName.WWFF
case "IOTA Island": case "IOTA Island":
spot.sig_refs[0].sig = ActivityName.IOTA spot.sig_refs[0].sig = ActivityName.IOTA
spot.sig_refs[0].ref_type = ActivityRefType.ISLAND spot.sig_refs[0].ref_type = ActivityRefType.ISLAND
+21 -6
View File
@@ -68,21 +68,33 @@ class ParksNPeaks(HTTPSpotProvider):
# Record activity information # Record activity information
activity = source_spot["actClass"].upper() activity = source_spot["actClass"].upper()
ref_id = source_spot["actSiteID"] ref_id = source_spot["actSiteID"]
if activity: if activity:
spot.sig = activity spot.sig = activity
activity_refs = []
if ref_id: if ref_id:
activity_refs = [ activity_refs = [
ActivityRef( ActivityRef(
id=source_spot["actSiteID"], id=ref_id,
sig=activity, sig=activity,
# Free text location is not present in all spots, so only add it if it's set
name=source_spot["actLocation"]
if "actLocation" in source_spot and source_spot["actLocation"] != ""
else None,
) )
] ]
spot.sig_refs = activity_refs spot.sig_refs = activity_refs
# Free text location is not present in all spots, so only add it if it's set else:
if "actLocation" in source_spot and source_spot["actLocation"] != "": # If no actSiteID is set, e.g. because actClass is "QRP", sometimes we still have an actLocation
activity_refs[0].name = source_spot["actLocation"] # which is free text like "SOTA G/SC-001". If we have that, and not a normal comment field, use
# that location as the comment field so the information doesn't get lost.
if (
"actLocation" in source_spot
and source_spot["actLocation"] != ""
and ("actComments" not in source_spot or source_spot["actComments"] == "")
):
spot.comment = source_spot["actLocation"]
# Log a warning for the developer if PnP gives us an unknown programme we've never seen before # Log a warning for the developer if PnP gives us an unknown programme we've never seen before
if activity not in [ if activity not in [
@@ -95,8 +107,11 @@ class ParksNPeaks(HTTPSpotProvider):
ActivityName.KRMNPA, ActivityName.KRMNPA,
ActivityName.SANPCPA, ActivityName.SANPCPA,
ActivityName.LLOTA, ActivityName.LLOTA,
ActivityName.QRP,
]: ]:
logger.warning(f"PNP spot found with activity {activity}, developer needs to add support for this!") logger.warning(
f"PNP spot found with activity {activity}, developer needs to add support for this!"
)
# Add new spot to the list # Add new spot to the list
new_spots.append(spot) new_spots.append(spot)
+1 -1
View File
@@ -77,7 +77,7 @@
</div> </div>
<script src="/static/js/add-spot.js?v=1789894090"></script> <script src="/static/js/add-spot.js?v=1789896773"></script>
<script>$(document).ready(function () { <script>$(document).ready(function () {
$("#nav-link-add-spot").addClass("active"); $("#nav-link-add-spot").addClass("active");
}); <!-- highlight active page in nav --></script> }); <!-- highlight active page in nav --></script>
+1 -1
View File
@@ -85,7 +85,7 @@
</div> </div>
<script src="/static/js/alerts.js?v=1789894090"></script> <script src="/static/js/alerts.js?v=1789896773"></script>
<script>$(document).ready(function () { <script>$(document).ready(function () {
$("#nav-link-alerts").addClass("active"); $("#nav-link-alerts").addClass("active");
}); <!-- highlight active page in nav --></script> }); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -76,8 +76,8 @@
</div> </div>
<script src="/static/js/spotsbandsandmap.js?v=1789894090"></script> <script src="/static/js/spotsbandsandmap.js?v=1789896773"></script>
<script src="/static/js/bands.js?v=1789894090"></script> <script src="/static/js/bands.js?v=1789896773"></script>
<script>$(document).ready(function () { <script>$(document).ready(function () {
$("#nav-link-bands").addClass("active"); $("#nav-link-bands").addClass("active");
}); <!-- highlight active page in nav --></script> }); <!-- highlight active page in nav --></script>
+5 -5
View File
@@ -1,6 +1,6 @@
{% extends "skeleton.html" %} {% extends "skeleton.html" %}
{% block head_extra %} {% block head_extra %}
<link rel="stylesheet" href="/static/css/style.css?v=1789894090" type="text/css"> <link rel="stylesheet" href="/static/css/style.css?v=1789896773" type="text/css">
<link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet"> <link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
<link href="/static/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet"> <link href="/static/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet">
<link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet"> <link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
@@ -16,10 +16,10 @@
window.fetchEventSource = fetchEventSource; window.fetchEventSource = fetchEventSource;
</script> </script>
<script src="/static/js/utils.js?v=1789894090"></script> <script src="/static/js/utils.js?v=1789896773"></script>
<script src="/static/js/ui-ham.js?v=1789894090"></script> <script src="/static/js/ui-ham.js?v=1789896773"></script>
<script src="/static/js/geo.js?v=1789894090"></script> <script src="/static/js/geo.js?v=1789896773"></script>
<script src="/static/js/common.js?v=1789894090"></script> <script src="/static/js/common.js?v=1789896773"></script>
{% end %} {% end %}
{% block body %} {% block body %}
<div class="container"> <div class="container">
+1 -1
View File
@@ -284,7 +284,7 @@
</div> </div>
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script> <script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
<script src="/static/js/conditions.js?v=1789894090"></script> <script src="/static/js/conditions.js?v=1789896773"></script>
<script>$(document).ready(function () { <script>$(document).ready(function () {
$("#nav-link-conditions").addClass("active"); $("#nav-link-conditions").addClass("active");
}); <!-- highlight active page in nav --></script> }); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -113,8 +113,8 @@
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}"; const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
</script> </script>
<script src="/static/js/spotsbandsandmap.js?v=1789894090"></script> <script src="/static/js/spotsbandsandmap.js?v=1789896773"></script>
<script src="/static/js/map.js?v=1789894090"></script> <script src="/static/js/map.js?v=1789896773"></script>
<script>$(document).ready(function () { <script>$(document).ready(function () {
$("#nav-link-map").addClass("active"); $("#nav-link-map").addClass("active");
}); <!-- highlight active page in nav --></script> }); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -125,8 +125,8 @@
</div> </div>
<script src="/static/js/spotsbandsandmap.js?v=1789894090"></script> <script src="/static/js/spotsbandsandmap.js?v=1789896773"></script>
<script src="/static/js/spots.js?v=1789894090"></script> <script src="/static/js/spots.js?v=1789896773"></script>
<script>$(document).ready(function () { <script>$(document).ready(function () {
$("#nav-link-spots").addClass("active"); $("#nav-link-spots").addClass("active");
}); <!-- highlight active page in nav --></script> }); <!-- highlight active page in nav --></script>
+1 -1
View File
@@ -96,7 +96,7 @@
</div> </div>
</div> </div>
<script src="/static/js/status.js?v=1789894090"></script> <script src="/static/js/status.js?v=1789896773"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$("#nav-link-status").addClass("active"); $("#nav-link-status").addClass("active");