scorecard: NavScorecard reader (from_dict/from_json) — Track 4 Phase 0 - #97
Merged
Merged
Conversation
…ase 0 The scorecard layer could WRITE (to_dict/to_json) but not READ. Add the inverse so a recorded corpus-fitness row loads back into Python — the plumbing a selection/loss stage will read from (nothing consumes it yet; Track 4 Phase 1+ wires it into training). Because to_dict's keys are field-for-field the C++ cvc::nav::scorecard_json keys, the same reader loads a `dbg_arrival_check3 --episodes` / scorecard_json row directly. - NavScorecard.from_dict(d): exact inverse of to_dict across all Track-1 field families (base + formation + coverage + drive + material_time_share + the nested mean_coverage). Tolerant of a partial producer (missing keys keep dataclass defaults) and ignores an embedded "rf" sub-object (the DBG scorecard_json shape) — the base reader is RF-free; the DBG side reads the RF scorecard separately. - NavScorecard.from_json(s): json.loads + from_dict. Tests: a full round-trip (to_dict->from_dict and to_json->from_json reproduce the row exactly, all field families populated) + partial/rf-tolerance. The existing C++<->Python parity gate already pins every aggregate field, so this only adds the reader's own coverage. 13/13 pass; ruff clean.
transfix
force-pushed
the
feat/nav-stats-scorecard-reader
branch
from
September 26, 2026 05:17
4700627 to
1815936
Compare
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.
Track 4 Phase 0 (scorecard plumbing): the scorecard layer could WRITE (
to_dict/to_json) but not READ. Add the inverse so a recorded corpus-fitness row loads back into Python — the plumbing a selection/loss stage reads from (nothing consumes it yet; Phase 1+ wires it into training).Because
to_dict's keys are field-for-field the C++cvc::nav::scorecard_jsonkeys, the same reader loads adbg_arrival_check3 --episodes/scorecard_jsonrow directly.NavScorecard.from_dict(d): exact inverse ofto_dictacross all Track-1 field families (base + formation + coverage + drive +material_time_share+ nestedmean_coverage). Tolerant of a partial producer (missing keys keep dataclass defaults); ignores an embedded"rf"sub-object (the DBGscorecard_jsonshape) — the base reader is RF-free, the DBG side reads the RF scorecard separately.NavScorecard.from_json(s):json.loads+from_dict.Tests: full round-trip (
to_dict→from_dictandto_json→from_jsonreproduce the row exactly, all field families populated) + partial/rf-tolerance. The existing C++↔Python parity gate already pins every aggregate field, so this only adds the reader's own coverage. 13/13 pass; ruff clean.Next (Phase 1, SELECTION): consume a recorded scorecard's
composite_scoreinCommTrainer+ formation/belief/grip asnav_scorecardselection fields.