Skip to content

Vessel indicators and a page cache - #22

Merged
rhinonix merged 3 commits into
chore/foundationfrom
feat/intelligence-and-cache
Sep 16, 2026
Merged

rhinonix merged 3 commits into
chore/foundationfrom
feat/intelligence-and-cache

Conversation

@rhinonix

Copy link
Copy Markdown
Owner

Fourth of five pull requests toward v3.0.0. Builds on #21.

Two improvements that make the tool more useful for research, drawing on work from the MARA vessel enrichment pipeline.

Fixes #2

Vessel indicators

A vessel profile now includes a factual summary of signals researchers commonly check. Each indicator comes straight from Equasis data; there is deliberately no composite risk score, because any weighting would be arbitrary.

  • Name, flag, and owner or manager changes in the last 12 and 36 months
  • Inspections, detentions, and deficiencies in the last 36 months; last inspection and last detention
  • Flag on a Paris or Tokyo MoU grey or black list; USCG targeted flag
  • IACS classification; class withdrawn or suspended in the last 36 months
  • P&I insurance on record
  • Whether the MMSI's Maritime Identification Digits belong to the flag state

Table output shows these as plain-language observations, JSON and JSON Lines include an indicators object, and CSV gains summary columns. Country (ISO 3166) and MID reference data ship with the package; the MID table is attributed in NOTICE (Apache-2.0 source).

Example (EVER GIVEN): Flag is targeted by the US Coast Guard. Example (KAVITA): Flag is on the grey or black list of the Paris MoU and Tokyo MoU, Not classed by an IACS member society, Class withdrawn in the last 36 months (Registro Italiano Navale (IACS)).

Page cache (#2)

  • Content pages are cached on disk for 24 hours; login, error, and not-found pages never are
  • A repeated vessel lookup drops from about 4 seconds to 0.2 seconds with no requests to Equasis, and interrupted batches can be re-run cheaply
  • The cache directory is owner-only because pages contain the account name (XDG_CACHE_HOME, LOCALAPPDATA, or EQUASIS_CACHE_DIR)
  • --no-cache, --refresh, equasis cache [info|clear]; /refresh and cache in the interactive shell
  • Results record when their pages were retrieved (shown in tables and used for retrieved_at in JSON)
  • Equasis only serves fleet page 2+ after page 1 in the same session (verified live: a direct page 2 request returns HTTP 500), so page 1 is reloaded when needed

Verification

  • 26 new tests: indicator calculations (including month arithmetic and change counting), MMSI to country mapping, cache expiry, keys, permissions, client cache hits and refresh, and the fleet page 1 reload
  • Full suite: 217 passed; ruff, ruff format --check, and strict mypy pass
  • Live: first vessel 9811000 4.3 s, repeat 0.2 s; cache info shows 3 pages in an owner-only directory; fleet 0152944 --max-pages 2 -o msc.csv wrote 200 vessels

@rhinonix
rhinonix force-pushed the feat/intelligence-and-cache branch from c176e10 to 2d48cb8 Compare September 16, 2026 15:17
@rhinonix
rhinonix added this pull request to stack #24 September 16, 2026 18:15
@rhinonix
rhinonix force-pushed the feat/intelligence-and-cache branch from 0e47856 to cc63e0d Compare September 16, 2026 18:15
Base automatically changed from fix/interactive-parity to chore/foundation September 16, 2026 18:25
Indicators summarise signals researchers look for, each taken directly
from Equasis data and reported without an arbitrary composite score:

- name, flag, and owner or manager changes in the last 12 and 36 months
- inspections, detentions, and deficiencies in the last 36 months
- flag on a Paris or Tokyo MoU grey or black list, USCG targeting
- IACS classification and recent class withdrawals or suspensions
- P&I insurance on record
- whether the MMSI's Maritime Identification Digits match the flag state

Indicators appear as a plain-language section in table output and as an
indicators object in JSON and JSON Lines; CSV gains summary columns.
Country and MID reference data ship with the package; the MID table is
attributed in NOTICE.
Repeated lookups no longer send the same requests to Equasis: regular
content pages are stored on disk for 24 hours and reused, which keeps
load on Equasis low, makes repeat lookups near-instant, and lets an
interrupted batch be re-run without fetching completed items again.

- Login, error, and not-found pages are never cached
- The cache directory is private to the user because pages contain the
  account name; its location follows XDG_CACHE_HOME or LOCALAPPDATA and
  can be set with EQUASIS_CACHE_DIR
- --no-cache and --refresh control caching on the command line, and
  /refresh does the same in the interactive shell
- equasis cache [info|clear] and the shell's cache command manage it
- Results record when their pages were retrieved; table output shows
  it and JSON uses it for retrieved_at
- Later fleet pages are only served after page 1 in the same Equasis
  session, so page 1 is reloaded when it came from the cache but the
  following pages did not

Fixes #2
File systems can record a modification time a few microseconds after
the in-memory timestamp, which made the comparison fail on Windows.
@rhinonix
rhinonix force-pushed the feat/intelligence-and-cache branch from cc63e0d to cd9db5b Compare September 16, 2026 18:25
@rhinonix
rhinonix merged commit 7bcec7b into chore/foundation Sep 16, 2026
11 checks passed
@rhinonix
rhinonix deleted the feat/intelligence-and-cache branch September 17, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant