Implement has_sig spot filter. Closes #49

This commit is contained in:
Ian Renton
2025-10-19 14:36:22 +01:00
parent 38222b98c8
commit e11483e230
2 changed files with 14 additions and 1 deletions

View File

@@ -165,8 +165,14 @@ class WebServer:
sources = query.get(k).split(",") sources = query.get(k).split(",")
spots = [s for s in spots if s.source and s.source in sources] spots = [s for s in spots if s.source and s.source in sources]
case "sig": case "sig":
# If a list of sigs is provided, the spot must have a sig and it must match one of them
sigs = query.get(k).split(",") sigs = query.get(k).split(",")
spots = [s for s in spots if s.sig and s.sig in sigs] spots = [s for s in spots if s.sig and s.sig in sigs]
case "needs_sig":
# If true, a sig is required, regardless of what it is, it just can't be missing.
needs_sig = query.get(k).upper() == "TRUE"
if needs_sig:
spots = [s for s in spots if s.sig]
case "band": case "band":
bands = query.get(k).split(",") bands = query.get(k).split(",")
spots = [s for s in spots if s.band and s.band in bands] spots = [s for s in spots if s.band and s.band in bands]

View File

@@ -65,7 +65,7 @@ paths:
- APRS-IS - APRS-IS
- name: sig - name: sig
in: query in: query
description: "Limit the spots to only ones from one or more Special Interest Groups. To select more than one SIG, supply a comma-separated list." description: "Limit the spots to only ones from one or more Special Interest Groups provided as an argument. To select more than one SIG, supply a comma-separated list."
required: false required: false
schema: schema:
type: string type: string
@@ -83,6 +83,13 @@ paths:
- ILLW - ILLW
- ZLOTA - ZLOTA
- IOTA - IOTA
- name: needs_sig
in: query
description: "Limit the spots to only ones from a Special Interest Grous such as POTA. Because supplying all known SIGs as a `sigs` parameter is unwieldy, and leaving `sigs` blank will also return spots with *no* SIG, this parameter can be set true to return only spots with a SIG, regardless of what it is, so long as it's not blank. This is what Field Spotter uses to exclude generic cluster spots and only retrieve xOTA things."
required: false
schema:
type: boolean
default: false
- name: band - name: band
in: query in: query
description: "Limit the spots to only ones from one or more bands. To select more than one band, supply a comma-separated list." description: "Limit the spots to only ones from one or more bands. To select more than one band, supply a comma-separated list."