Skip to content

mostlyright.core.schemas

Canonical schemas shipped with mostlyright v0.1.

The schemas are the shape contracts every domain adapter normalises to. Each schema module documents its column-level specification.

Each schema is eagerly registered with the Validator at import time so validate_dataframe(df, schema_id) works against the canonical IDs without any explicit register-call boilerplate.

AttributeDescription
SCHEMA_REGISTRYPublic alias for the validator’s registry dict, so callers and tests can look up schemas by id without reaching into core.validator’s underscored internal.

class mostlyright.core.schemas.EarningsFactSchema

Section titled “class mostlyright.core.schemas.EarningsFactSchema”

Bases: Schema

schema.finance.fact.v1 — one row per counted mention occurrence.

Carries the six taxonomy dimensions (term match rule, counting mode, speaker scope, window scope, time, tie-break/resolution) plus the role_source provenance and the derived kalshi_counted flag, so the same fact rows resolve correctly under each venue’s wording.

mention_count is the primary integer tally; the boolean (“said at least once”) is derived as mention_count >= 1. Storing only a bool cannot settle Polymarket “say X 5+ times” threshold brackets.

class mostlyright.core.schemas.EarningsTranscriptSchema

Section titled “class mostlyright.core.schemas.EarningsTranscriptSchema”

Bases: Schema

schema.finance.transcript.v1 — one row per transcript segment.

class mostlyright.core.schemas.MergedObservationSchema

Section titled “class mostlyright.core.schemas.MergedObservationSchema”

Bases: Schema

schema.observation.merged.v1 — merged per-report observation rows.

Accepts the merge-policy frame identity merged.live_v1 while allowing the per-row source column to carry any of the bare parser tags {awc, iem, ghcnh} (membership, not equality — checked by the validator via _registered_row_sources).

class mostlyright.core.schemas.NwpForecastSchema

Section titled “class mostlyright.core.schemas.NwpForecastSchema”

Bases: Schema

schema.forecast.nwp.v1 — gridded NWP forecast rows.

One row per (station, model, cycle, fxx, variable_column) — the variable column itself is encoded as separate float columns rather than long-form rows so quants can do model arithmetic without a pivot.

The mirror column lets a downstream auditor link a row back to the bytes that produced it (NOAA BDP mirror chain).

class mostlyright.core.schemas.ObservationQCSchema

Section titled “class mostlyright.core.schemas.ObservationQCSchema”

Bases: Schema

schema.observation.qc.v1 — QC sidecar (forward-compat).

class mostlyright.core.schemas.ObservationSchema

Section titled “class mostlyright.core.schemas.ObservationSchema”

Bases: Schema

schema.observation.v1 — canonical METAR/SPECI rows.

In imperial mode the rename map projects the metric columns onto the 9-column METAR-parser set: station, utc_datetime, temp_f, dewpoint_f, sea_level_pressure_hpa, wind_speed_kt, wind_direction_degrees, wind_gust_kt, visibility_miles. sea_level_pressure_hpa is in canonical aviation units and unchanged across modes; wind_direction_degrees is dimensionless degrees.

Metric → imperial column-name map. station, observation_type, wind_direction_degrees, sea_level_pressure_hpa, sky_cover_N and raw_metar are unchanged across modes.

Public alias for the validator’s registry dict, so callers and tests can look up schemas by id without reaching into core.validator’s underscored internal.

class mostlyright.core.schemas.SatellitePatchSchema

Section titled “class mostlyright.core.schemas.SatellitePatchSchema”

Bases: Schema

schema.satellite.patch.v1 — wide packed native-dtype crop rows.

One row per (site_id, satellite, product, scan_start_utc). Each row carries the crop window for that product’s variables: one list column per payload-registry variable at the source’s native storage width, its five per-row decode companions, the resolved window geometry, and — for a 3-D profile product — the level count and the pressure axis.

A row populates only the payload columns of its own product; every other payload column is null. That wide layout measures 27 to 36 percent smaller than a long one, and an all-null parquet column is nearly free.

This schema is deliberately separate from schema.satellite.v1: the settlement-feeding weather/satellite/ partitions stay byte-identical, and nothing here can reach the label path.

class mostlyright.core.schemas.SatelliteSchema

Section titled “class mostlyright.core.schemas.SatelliteSchema”

Bases: Schema

schema.satellite.v1 — single-pixel satellite scan rows, native grid.

One row per (station, satellite, product, variable, pressure_level_hpa, scan_start_utc), which is also the dedup key and does not include the mirror. Carries 18 storage fields plus the overlay columns source / delivery / qc_status / as_of_time.

The schema covers GOES East/West, Himawari, VIIRS, and EUMETSAT through a set of distinct source identities (_registered_sources) and a correspondingly broad satellite enum, so a polar VIIRS swath row validates alongside a geostationary GOES/Himawari/SEVIRI row: subsatellite_longitude_degrees is nullable (geostationary only) and pixel_row/pixel_col mean either a native grid index or a swath line/sample index.

class mostlyright.core.schemas.SettlementSchema

Section titled “class mostlyright.core.schemas.SettlementSchema”

Bases: Schema

schema.settlement.cli.v1 — NWS CLI daily settlement rows.

No imperial rename map: CLI settlement is reported in Fahrenheit, which is the canonical unit for both Kalshi contract labels and the NWS CLI product itself. Adapters must not convert it.

Settlement values are already in canonical Fahrenheit / inches; no imperial-mode rename map applies. Schema.column_names("imperial") returns the same names as column_names("metric").

class mostlyright.core.schemas.StationForecastSchema

Section titled “class mostlyright.core.schemas.StationForecastSchema”

Bases: Schema

schema.forecast.station.v1 — unified per-station forecast schema.

Covers IEM MOS shared core + Open-Meteo extras. Source identity via the source column (iem.archive for IEM MOS rows). The canonical schema.forecast.station.v1 schema_id is the single id for both.

Imperial-mode renames apply to temperature, wind speed, and wind gusts. valid_at / issued_at / retrieved_at are model-internal timestamps and keep their canonical names.

ModuleDescription
earnings_factEarnings-fact schema (schema.finance.fact.v1).
earnings_transcriptEarnings-transcript schema (schema.finance.transcript.v1).
forecastUnified per-station forecast schema.
forecast_nwpNWP forecast schema (schema.forecast.nwp.v1).
observationCanonical METAR/SPECI observation schema (schema.observation.v1).
observation_mergedMerged observation-grain schema (schema.observation.merged.v1).
observation_qcschema.observation.qc.v1 — QC sidecar schema (forward-compat).
satelliteSatellite schema (schema.satellite.v1).
satellite_patchSatellite crop-tier schema (schema.satellite.patch.v1).
settlementNWS CLI settlement schema (schema.settlement.cli.v1).