mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 06:17:41 +00:00
Fix some dodgy handling of DME references
This commit is contained in:
+2
-2
@@ -253,10 +253,10 @@ SIGS = [
|
|||||||
description="Diploma Municipios de España",
|
description="Diploma Municipios de España",
|
||||||
sig_type=SIGType.REGIONAL,
|
sig_type=SIGType.REGIONAL,
|
||||||
ref_type=SIGRefType.TOWN,
|
ref_type=SIGRefType.TOWN,
|
||||||
ref_regex=r"\d{4,5}",
|
ref_regex=r"DME[\- ]\d{3,5}",
|
||||||
icon="fa-building",
|
icon="fa-building",
|
||||||
region_flag="🇪🇸",
|
region_flag="🇪🇸",
|
||||||
refs_globally_unique=False,
|
refs_globally_unique=True,
|
||||||
),
|
),
|
||||||
SIG(
|
SIG(
|
||||||
name="FEA",
|
name="FEA",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
|
|
||||||
from pyhamtools.locator import latlong_to_locator, locator_to_latlong
|
from pyhamtools.locator import latlong_to_locator, locator_to_latlong
|
||||||
|
|
||||||
@@ -41,9 +42,12 @@ def get_sig_ref_info(sig_name, ref_id):
|
|||||||
### FUDGES ###
|
### FUDGES ###
|
||||||
#
|
#
|
||||||
# DME fudge. Our database has leading zeros padding to 5 digits which is the expected format, but not all
|
# DME fudge. Our database has leading zeros padding to 5 digits which is the expected format, but not all
|
||||||
# activators add leading zeros.
|
# activators add leading zeros. We also need to normalise "DME 01234" to "DME-01234" to match what's in our
|
||||||
|
# database.
|
||||||
if sig_name.upper() == "DME":
|
if sig_name.upper() == "DME":
|
||||||
ref_id = ref_id.zfill(5)
|
match = re.match(r"DME[\- ]\d{3,5}", ref_id, re.IGNORECASE)
|
||||||
|
number = match.group(1)
|
||||||
|
return f"DME-{number.zfill(5)}"
|
||||||
|
|
||||||
# DTMBA spotters sometimes include spaces and dashes, our regex allows them but they must be removed here so we
|
# DTMBA spotters sometimes include spaces and dashes, our regex allows them but they must be removed here so we
|
||||||
# can look up against the official list which doesn't have them
|
# can look up against the official list which doesn't have them
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ class DME(LocalFileSIGRefDataProvider):
|
|||||||
new_data = []
|
new_data = []
|
||||||
with open(path, encoding="latin-1") as _f:
|
with open(path, encoding="latin-1") as _f:
|
||||||
for row in csv.DictReader(_f, delimiter=";"):
|
for row in csv.DictReader(_f, delimiter=";"):
|
||||||
ref_id = row["COD_INE"][:5]
|
# Store reference IDs with the "DME-" prefix rather than just the number. This will prevent Spothole
|
||||||
|
# from agressively thinking every number in a spot comment is DME after it's seen "DME" once. The only
|
||||||
|
# numbers that count are straight after "DME " or "DME-". The dash versus space is normalised in
|
||||||
|
# sig_lookup_helper.py.
|
||||||
|
ref_id = "DME-" + row["COD_INE"][:5]
|
||||||
latitude = (
|
latitude = (
|
||||||
float(row["LATITUD_ETRS89_REGCAN95"].replace(",", "."))
|
float(row["LATITUD_ETRS89_REGCAN95"].replace(",", "."))
|
||||||
if row.get("LATITUD_ETRS89_REGCAN95")
|
if row.get("LATITUD_ETRS89_REGCAN95")
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/add-spot.js?v=1788598136"></script>
|
<script src="/static/js/add-spot.js?v=1788598625"></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>
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/alerts.js?v=1788598136"></script>
|
<script src="/static/js/alerts.js?v=1788598625"></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>
|
||||||
|
|||||||
@@ -76,8 +76,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1788598136"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1788598625"></script>
|
||||||
<script src="/static/js/bands.js?v=1788598136"></script>
|
<script src="/static/js/bands.js?v=1788598625"></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
@@ -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=1788598136" type="text/css">
|
<link rel="stylesheet" href="/static/css/style.css?v=1788598625" 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=1788598136"></script>
|
<script src="/static/js/utils.js?v=1788598625"></script>
|
||||||
<script src="/static/js/ui-ham.js?v=1788598136"></script>
|
<script src="/static/js/ui-ham.js?v=1788598625"></script>
|
||||||
<script src="/static/js/geo.js?v=1788598136"></script>
|
<script src="/static/js/geo.js?v=1788598625"></script>
|
||||||
<script src="/static/js/common.js?v=1788598136"></script>
|
<script src="/static/js/common.js?v=1788598625"></script>
|
||||||
{% end %}
|
{% end %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
@@ -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=1788598136"></script>
|
<script src="/static/js/conditions.js?v=1788598625"></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
@@ -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=1788598136"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1788598625"></script>
|
||||||
<script src="/static/js/map.js?v=1788598136"></script>
|
<script src="/static/js/map.js?v=1788598625"></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>
|
||||||
|
|||||||
@@ -113,8 +113,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1788598136"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1788598625"></script>
|
||||||
<script src="/static/js/spots.js?v=1788598136"></script>
|
<script src="/static/js/spots.js?v=1788598625"></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>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/status.js?v=1788598136"></script>
|
<script src="/static/js/status.js?v=1788598625"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#nav-link-status").addClass("active");
|
$("#nav-link-status").addClass("active");
|
||||||
|
|||||||
Reference in New Issue
Block a user