feat(vessels): AISStream (US) + VesselAPI (Hormuz) as two active providers #19

Merged
sirius merged 3 commits from feat/vesselapi-ais-poller into master 2026-08-29 07:23:37 -04:00
Owner

Summary

Two independent vessel providers, both first-class. Not a fallback pair.

Key Provider Geography Transport
AISSTREAM_API_KEY AISStream (open/shared) US coasts live WebSocket
VESSELAPI_API_KEY VesselAPI (commercial) Strait of Hormuz REST, 5×/day cache

Both upsert into the same vessel_last_known store (GET /api/vessels). Missing one key never disables the other. Paste both on the dashboard Keys page.

What changed

  • app/vesselapi.py: Hormuz bbox 25.5,55.4,27.3,57.2 (span 3.6 ≤ 4°). 5 successful 2xx/UTC day, no pagination, no satellite, no map-pan fetches.
  • keystore registry copy splits the two keys so the Keys UI cannot be read as one AIS backup.
  • Both workers start independently (AISSTREAM_IN_APP / VESSELAPI_IN_APP).
  • Layer-panel note: two feeds, two keys — not “Needs AISSTREAM_API_KEY” only.
  • extra.src is aisstream vs vesselapi.

Quota

VesselAPI stays at 5 calls/day (150/mo). AISStream is unchanged.

Tests

tests/test_vesselapi.py — idle/poll independent of the AISStream key; span validator; daily cap; markers with extra.src=vesselapi.

## Summary Two **independent** vessel providers, both first-class. Not a fallback pair. | Key | Provider | Geography | Transport | |---|---|---|---| | `AISSTREAM_API_KEY` | AISStream (open/shared) | US coasts | live WebSocket | | `VESSELAPI_API_KEY` | VesselAPI (commercial) | Strait of Hormuz | REST, 5×/day cache | Both upsert into the same `vessel_last_known` store (`GET /api/vessels`). Missing one key never disables the other. Paste both on the dashboard Keys page. ## What changed - `app/vesselapi.py`: Hormuz bbox `25.5,55.4,27.3,57.2` (span 3.6 ≤ 4°). 5 successful 2xx/UTC day, no pagination, no satellite, no map-pan fetches. - `keystore` registry copy splits the two keys so the Keys UI cannot be read as one AIS backup. - Both workers start independently (`AISSTREAM_IN_APP` / `VESSELAPI_IN_APP`). - Layer-panel note: two feeds, two keys — not “Needs AISSTREAM_API_KEY” only. - `extra.src` is `aisstream` vs `vesselapi`. ## Quota VesselAPI stays at 5 calls/day (150/mo). AISStream is unchanged. ## Tests `tests/test_vesselapi.py` — idle/poll independent of the AISStream key; span validator; daily cap; markers with `extra.src=vesselapi`.
sirius added 1 commit 2026-08-29 00:18:08 -04:00
Add a server-side REST poller for VesselAPI (free tier 150 calls/mo) that
upserts last-known positions into the shared vessel_last_known store when
AISStream is unset. Default box is the Strait of Hormuz (span 3.6 <= 4 deg),
never CONUS/NC (AISStream owns US coasts).

- app/vesselapi.py: worker loop, 4deg span validator, position->marker
  transform (skip suspected_glitch), durable Postgres daily-quota table.
- Local hard cap 5 successful 2xx/UTC day (VESSELAPI_MAX_CALLS_PER_DAY),
  monthly floor from X-RateLimit-Remaining, single request limit=50, no
  nextToken, no filter.sat, no retry-storm.
- keystore VESSELAPI_API_KEY registry entry; config + compose env passthrough
  (app + ingest); wired next to AISStream in main.py lifespan + run_ingester.
- GET /api/vessels docstring notes AISStream and/or VesselAPI cache.
- tests/test_vesselapi.py: 20 unit tests (no network/DB).
sirius added 1 commit 2026-08-29 00:38:43 -04:00
- keystore KEY_REGISTRY copy splits the two keys (open/shared US-coast WS vs
  commercial Hormuz 5x/day REST); VesselAPI no longer reads as an AIS backup.
- vesselapi.py docstring drops 'fallback'; states both are first-class.
- /api/vessels docstring: last-known is the union (extra.src aisstream vs
  vesselapi).
- tests: VesselAPI idles/polls independently of the AISStream key.
sirius added 1 commit 2026-08-29 00:56:59 -04:00
Layer-panel note and .env.example now match the two-key model:
AISStream (US live) and VesselAPI (Hormuz) run independently.
sirius changed title from feat(vessels): VesselAPI quota-capped AIS poller (Strait of Hormuz) to feat(vessels): AISStream (US) + VesselAPI (Hormuz) as two active providers 2026-08-29 00:57:09 -04:00
sirius merged commit 7b48caa793 into master 2026-08-29 07:23:37 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: sirius/osint-dashboard#19
No description provided.