Skip to content

Ingest predictions as a views_frames.PredictionFrame #28

Closed

Description

@Polichinel

Part of #27 (adopt views-frames v1.0.0). Foundation — #CONF builds on this. Cross-repo dependency: views-platform/views-pipeline-core#188 (the upstream PredictionFrame re-export shim). Solution-open.

Context

unfao/managers/unfao.py ingests point-estimate predictions (datafactory loader for historical; Appwrite prod_forecasts parquet for forecasts) and wraps them in pipeline-core's PGMDataset:

# views_postprocessing/unfao/managers/unfao.py:7
from views_pipeline_core.data.handlers import PGMDataset
# :58-60   self._historical_dataset = PGMDataset(source=self._historical_dataframe, ...)
# :100     self._forecast_dataset   = PGMDataset(self._forecast_dataframe)

Adopt the published views_frames.PredictionFrame for the (time, unit) prediction values instead of the pipeline-core container. Because the current pipeline is point estimates (no posterior axis), each prediction becomes a (N, 1) frame (sample axis size 1), SpatialLevel.PGM, identifiers {time=month_id, unit=priogrid_gid}.

What stays unchanged (domain): the GAUL enrichment (unfao/enrichment.py, the 9-column METADATA_COLS) and the FAO parquet delivery. The frame is the transport for the prediction values; the GAUL string-metadata columns and the delivery format remain postprocessing's own DataFrame layer. (A float32 PredictionFrame cannot carry the string metadata — that's by design; enrichment lives outside the frame.)

Sequencing / approaches (open)

  • Depends on pipeline-core S7 — One declared way to find views-datafactory; no machine-specific paths (C-46) #188 (pipeline-core re-exports views_frames.PredictionFrame). Interim: postprocessing can construct the frame directly from its loaded (month_id, priogrid_gid) index + values + SpatialLevel.PGM, so it isn't hard-blocked.
  • A re-point ingestion to yield a PredictionFrame; B a thin adapter at the read boundary that wraps the loaded values in a frame. Your call — you know the read path.

Suggested DoD (refine)

  • views-frames dependency resolvable (see the distribution-channel note in Epic: Adopt views-frames v1.0.0 (consumer; first live conformance proof) #27)
  • prediction values carried as a views_frames.PredictionFrame (SpatialLevel.PGM, (N, 1))
  • the private PGMDataset dependency on the prediction path dropped
  • GAUL enrichment (9-column merge) + FAO parquet delivery unchanged
  • poetry run pytest tests/ green

References: see #27; pipeline-core upstream views-platform/views-pipeline-core#188.

🤖 Filed by the views-frames maintainer agent (issues only; no postprocessing code touched).

Activity

  1. added
    views-frames-adoption
    on Jun 21, 2026
  2. Polichinel commented on Jun 24, 2026

    @Polichinel
    CollaboratorAuthor

    Done — satisfied by to_prediction_frame/to_target_frame (views_postprocessing/unfao/frames.py), shipped in the phase-1 conformance-proof PR (commit ed5169a, merged to development). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    views-frames-adoption

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions