mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-08-05 18:11:41 +00:00
48 lines
2.6 KiB
Python
48 lines
2.6 KiB
Python
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass
|
|
class Callsign:
|
|
"""Data class that defines a callsign and the data associated with it. This will have been retrieved by a callsign
|
|
lookup provider using data files or online lookup. This can be used to infer missing data for a spot, though if the
|
|
spot has a SIG (e.g. POTA) reference this data for their home location (or even just their country) will be less
|
|
accurate and should not be used in preference to that."""
|
|
|
|
# Callsign as spotted
|
|
call: str
|
|
# "Home" call, i.e. with any prefixes and suffixes stripped off
|
|
home_call: str | None = None
|
|
# Operator name
|
|
name : str | None = None
|
|
# QTH (location), free text
|
|
qth : str | None = None
|
|
# Maidenhead grid locator. Depending on the source of lookup this could be a home location from QRZ/HamQTH or just
|
|
# the centre of the country they're operating in if no other data is available.
|
|
grid : str | None = None
|
|
# Latitude. Depending on the source of lookup this could be a home location from QRZ/HamQTH or just
|
|
# the centre of the country they're operating in if no other data is available.
|
|
latitude : float | None = None
|
|
# Longitude. Depending on the source of lookup this could be a home location from QRZ/HamQTH or just
|
|
# the centre of the country they're operating in if no other data is available.
|
|
longitude : float | None = None
|
|
# Country in which the callsign indicates they are operating
|
|
country: str | None = None
|
|
# Continent in which the callsign indicates they are operating
|
|
continent: str | None = None
|
|
# DXCC ID in which the callsign indicates they are operating
|
|
dxcc_id: int | None = None
|
|
# CQ zone in which the callsign indicates they are operating
|
|
cq_zone: int | None = None
|
|
# ITU zone in which the callsign indicates they are operating
|
|
itu_zone: int | None = None
|
|
# Location source. This can be "HOME QTH" or "DXCC" depending on which provider gave us a location
|
|
location_source: str | None = None
|
|
|
|
def fully_populated(self):
|
|
"""Utility method to indicate that the callsign data is fully populated. Multiple providers can return data for
|
|
a callsign, and we try them in sequence until we have all the data we can, in which case there's no point
|
|
querying any other providers."""
|
|
return self.home_call is not None and self.name is not None and self.qth is not None and self.grid is not None\
|
|
and self.latitude is not None and self.longitude is not None and self.country is not None and self.continent\
|
|
is not None and self.dxcc_id is not None and self.cq_zone is not None and self.itu_zone is not None
|