Skip to content

Export the all-six NEO consensus as a flat-CSV snapshot#1

Open
rlseaman wants to merge 1 commit into
mainfrom
feature/neo-consensus-export
Open

Export the all-six NEO consensus as a flat-CSV snapshot#1
rlseaman wants to merge 1 commit into
mainfrom
feature/neo-consensus-export

Conversation

@rlseaman

@rlseaman rlseaman commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Why

Some consumers need the NEO consensus but cannot reach this database or the upstream sources. The motivating case is the CSS reprocessing V&V on sikhote: JPL CNEOS and NEOfixer are firewalled there, and Gizmo (this Postgres host) is not routable — so a live query and a local six-source rebuild are both impossible. Those consumers need the consensus as a published snapshot.

That V&V already classifies each reprocessed night's tracklets against MPC NEA.txt (the one reachable source, ~99.6% of the consensus) and reports total / new / recovered NEOs. This PR lets it swap that backbone for the true all-six consensus with no code change on its side — only the source file changes.

What

  • scripts/export_neo_consensus.py — read-only (lib.db, claude_ro), dumps css_neo_consensus to CSV.
    • --mode aliases (default): one row per known designation alias (primary / secondary provisional / permid) from v_member_designations, each carrying the per-source flags from v_membership_wide. Maximizes match coverage — an observation reported under any alias resolves.
    • --mode wide: one row per object (primary_desig).
    • --min-sources N: consensus strength (1 = union … 6 = unanimous), default 1.
    • Publish via the existing scripts/upload_release.sh to the latest release; consumer pulls with gh release download.
  • docs/neo_consensus.md — new "Export bridge" section (publish/consume flow) + a scoped follow-on note.

Follow-on (noted, not included)

The downstream V&V can report total/new NEOs but not "missing" NEOs — NEOs the original night reported that the reprocessing dropped — because the archived CSS .mpcd.mrpt carries temporary IDs, not designations. Closing that needs MPC's obs-DB record of which NEO designations a station reported on a given night (an obs_sbn query keyed on (stn, obs date) joined to v_member_designations). A second exporter, export_station_night_neos.py, is the natural home; happy to follow up if useful.

Verification status

Authored against the documented v_membership_wide / v_member_designations schema (column names + the n_sources predicate verified against sql/consensus/install.sql and sql/consensus_audit.sql). Not yet executed against the live DB — no Gizmo access from the authoring host. Please run on Gizmo to confirm columns/timing before relying on it:

python scripts/export_neo_consensus.py --out neo_consensus.csv

🤖 Generated with Claude Code

Publish the css_neo_consensus membership as a portable CSV so consumers
that cannot reach this database or the upstream sources can classify
designations as NEOs offline.

Motivating consumer: the CSS reprocessing V&V on sikhote, where JPL
CNEOS and NEOfixer are firewalled and Gizmo is unroutable — a live query
and a local six-source rebuild are both impossible, so the consensus
must arrive as a published snapshot.

  - scripts/export_neo_consensus.py: read-only (lib.db, claude_ro).
    --mode aliases (default, every designation alias from
    v_member_designations + per-source flags) | wide (one row/object);
    --min-sources N for consensus strength (1=union .. 6=unanimous).
    Publish via the existing scripts/upload_release.sh to the 'latest'
    GitHub release; consumer pulls with gh release download.
  - docs/neo_consensus.md: "Export bridge" section documenting the
    publish/consume flow, plus a follow-on note scoping a per-night
    station NEO obs export (obs_sbn) to unlock "missing NEOs"
    downstream.

NOTE: authored against the documented v_membership_wide /
v_member_designations schema; not yet executed against the live DB
(no Gizmo access from the authoring host). Run on Gizmo to verify
column/timing before relying on it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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