feat(frame-extraction): S2 — frame-native seam readers in their own module (#87)#95
Merged
Merged
Conversation
…odule (#87) Epic #85 / S2. Adds views_postprocessing/unfao/frame_extraction.py — the frame counterpart to extraction.py (the pandas seam). cells_of(frame) / months_of(frame) return the same primitives (set[int], int64 month array) the representation-free delivery/ invariants consume, read from a PredictionFrame's index. Own module (not appended to extraction.py): one representation per file (screaming/ SRP); when the pandas seam is retired it becomes a clean file-delete. Deliberate SIBLINGS of the pandas readers, no shared Extractor Protocol (D-11 / YAGNI-ISP). Pure addition — no caller changes; the forecast interior calls these in S3 (#88). Deferred (no speculative code): the pandas->(N,S) sample unpacker (gated on rusty_bucket #143's layout), frame-native unmapped_cell_count (metadata lives on the pandas enriched frame until S4 #89), drop_months_above (historical path, gated S7 #92). Tests: golden-equivalence parity — same data as a pandas MultiIndex frame AND a PredictionFrame yields identical cells_of/months_of. ruff clean; 132 passed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Epic: #85 · S2 (#87) · depends on #86 ✅
Adds
views_postprocessing/unfao/frame_extraction.py— the frame counterpart to the pandasextraction.pyseam.cells_of(frame)/months_of(frame)return the same primitives the representation-freedelivery/invariants consume, read from aPredictionFrame's index.ExtractorProtocol (D-11).(N,S)sample unpacker (gated on rusty_bucket #143), frame-nativeunmapped_cell_count(metadata is pandas until S4 S4 — enrichment.py: numpy/pyarrow keyed gather (drop pandas merge) #89),drop_months_above(historical, gated S7 S7 — historical inbound read_dataframe/PGMDataset retirement #92).Parity: golden-equivalence — same data as a pandas MultiIndex frame and a
PredictionFrameyields identicalcells_of/months_of. pandas-free; ruff clean; 132 passed.Closes #87