Skip to content

mostlyright.core.schemas

Canonical schemas shipped with mostlyright v0.1.

The three schemas — observation, forecast, settlement — are the shape contracts every weather-vertical adapter (IEM, AWC, NWS CLI) normalises to. See docs/design.md §A, §X, and §BB.3 for the column-by-column 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.

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 RESEARCH-MARKETS §2 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 integer PRIMARY tally; the boolean (“said ≥ 1”) is derived as mention_count >= 1 — storing only a bool cannot settle Polymarket “say X 5+ times” threshold brackets (RESEARCH-MARKETS §2.1(2)).

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 fused-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 — enforced 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.

Metric column set per docs/design.md §A; imperial-mode rename map per the same section preserves the existing mostly-light contract (the 9-column anti-duplication projection: 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 canonical aviation units and unchanged across modes; wind_direction_degrees is dimensionless degrees.

Metric → imperial column-name map (docs §A imperial-mode table). station, observation_type, wind_direction_degrees, sea_level_pressure_hpa, sky_cover_N and raw_metar are unchanged across modes.

mostlyright.core.schemas.SCHEMA_REGISTRY = {‘schema.cwop.v1’: <class ‘mostlyright.weather.cwop._schema.CwopSchema’>, ‘schema.economy.observations.v1’: <class ‘mostlyright.economy._schema.EconomyObservationsSchema’>, ‘schema.finance.fact.v1’: <class ‘mostlyright.core.schemas.earnings_fact.EarningsFactSchema’>, ‘schema.finance.transcript.v1’: <class ‘mostlyright.core.schemas.earnings_transcript.EarningsTranscriptSchema’>, ‘schema.forecast.nwp.v1’: <class ‘mostlyright.core.schemas.forecast_nwp.NwpForecastSchema’>, ‘schema.forecast.station.v1’: <class ‘mostlyright.core.schemas.forecast.StationForecastSchema’>, ‘schema.observation.merged.v1’: <class ‘mostlyright.core.schemas.observation_merged.MergedObservationSchema’>, ‘schema.observation.qc.v1’: <class ‘mostlyright.core.schemas.observation_qc.ObservationQCSchema’>, ‘schema.observation.v1’: <class ‘mostlyright.core.schemas.observation.ObservationSchema’>, ‘schema.satellite.v1’: <class ‘mostlyright.core.schemas.satellite.SatelliteSchema’>, ‘schema.settlement.cli.v1’: <class ‘mostlyright.core.schemas.settlement.SettlementSchema’>}

Section titled “mostlyright.core.schemas.SCHEMA_REGISTRY = {‘schema.cwop.v1’: <class ‘mostlyright.weather.cwop._schema.CwopSchema’>, ‘schema.economy.observations.v1’: <class ‘mostlyright.economy._schema.EconomyObservationsSchema’>, ‘schema.finance.fact.v1’: <class ‘mostlyright.core.schemas.earnings_fact.EarningsFactSchema’>, ‘schema.finance.transcript.v1’: <class ‘mostlyright.core.schemas.earnings_transcript.EarningsTranscriptSchema’>, ‘schema.forecast.nwp.v1’: <class ‘mostlyright.core.schemas.forecast_nwp.NwpForecastSchema’>, ‘schema.forecast.station.v1’: <class ‘mostlyright.core.schemas.forecast.StationForecastSchema’>, ‘schema.observation.merged.v1’: <class ‘mostlyright.core.schemas.observation_merged.MergedObservationSchema’>, ‘schema.observation.qc.v1’: <class ‘mostlyright.core.schemas.observation_qc.ObservationQCSchema’>, ‘schema.observation.v1’: <class ‘mostlyright.core.schemas.observation.ObservationSchema’>, ‘schema.satellite.v1’: <class ‘mostlyright.core.schemas.satellite.SatelliteSchema’>, ‘schema.settlement.cli.v1’: <class ‘mostlyright.core.schemas.settlement.SettlementSchema’>}”

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.SatelliteSchema

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

Bases: Schema

schema.satellite.v1 — single-pixel satellite scan rows (NATIVE ring).

One row per (station, satellite, product, variable, pressure_level_hpa, scan_start_utc) — the dedup key (mirror-invariant, D9). Ports the 18 2i storage fields and adds the SDK overlay columns source / delivery / qc_status / as_of_time.

Native-ring generalization. The initial schema was GOES-geostationary-shaped. The native ring (GOES E/W + Himawari + VIIRS + EUMETSAT) is covered by a SET of distinct source identities (_registered_sources) and a broadened satellite enum, and the row contract is generalized so a polar VIIRS SWATH row validates alongside a geostationary GOES/Himawari/SEVIRI row: subsatellite_longitude_degrees is now NULLABLE (geostationary-only) and pixel_row/ pixel_col mean “native grid index OR 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 Fahrenheit, and Fahrenheit is the canonical unit for both Kalshi contract labels and the NWS CLI product itself. Adapters must NOT convert.

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.

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).
settlementNWS CLI settlement schema (schema.settlement.cli.v1).