Skip to content

feat(batch): batch v3 package - journal model + layout (#698) - #727

Merged
jepegit merged 2 commits into
masterfrom
698-batch-v3-journal
Jul 26, 2026
Merged

feat(batch): batch v3 package - journal model + layout (#698)#727
jepegit merged 2 commits into
masterfrom
698-batch-v3-journal

Conversation

@jepegit

@jepegit jepegit commented Jul 26, 2026

Copy link
Copy Markdown
Owner

A2 — batch v3 package foundation: journal + layout

Second arc of Epic A (batch v3, #696). Starts the redesign as a new cellpy/batch/ package built alongside the old utils/batch_tools (nothing removed here — that's E4). Guarded by the A1 characterization net (#697).

cellpy/batch/layout.py

  • BatchPaths — frozen, pure path computation (project_dir/batch_dir/raw_dir/journal_file), layout identical to the modern paginate default (<project_dir>/dump/...).
  • ensure_dirs() — the only mkdir, splitting the concern the legacy paginate() conflated (dumpers created folders as a side effect of exporting).

cellpy/batch/journal.py

  • Journal model — polars pages with keys-in-columns (cell label is a filename column, never an index); session/meta separated from serialization.
  • read_journal/write_journal — round-trip the compatible info_df/metadata/session JSON; raw_file_names normalized to List[str] (kills the legacy str-or-list ambiguity).
  • read_custom_json/journal_from_custom_json — read arbitrary JSON into pages via a source→journal column map (folds batch - read custom json #345; requires a filename mapping).
  • Excel read-onlyread_journal reads .xlsx (pages sheet); write_journal rejects .xlsx with a clear error (metadata plan Step 4).
  • journal_from_frame (polars/pandas).

Tests — tests/test_batch_v3.py (10, all green)

JSON read + round-trip value-parity, from_frame, non-journal rejection, custom-JSON (+ filename-required), Excel read + write-guard, BatchPaths purity, ensure_dirs idempotence.

Follow-ups in later Epic A arcs: policy.py (#699), runner/store (#700), aggregation/QC/outputs (#701), facade (#702).

Part of #696. Folds #345.

🤖 Generated with Claude Code

jepegit and others added 2 commits July 26, 2026 21:05
Start the batch v3 redesign (Epic A, #696) as a new cellpy/batch/ package
built alongside the old utils/batch_tools.

- layout.py: BatchPaths (pure, immutable path computation) + ensure_dirs()
  as the ONLY mkdir - splits the concern the legacy paginate() conflated
  (dumpers created folders as a side effect of exporting).
- journal.py: Journal model with polars pages (keys-in-columns: the cell
  label is a `filename` column, never an index) + read_journal/write_journal
  round-tripping the compatible info_df/metadata/session JSON format, and
  journal_from_frame. raw_file_names is normalised to List[str], removing the
  legacy str-or-list ambiguity.

Follow-ups within #698: custom-JSON reader (folds #345), Excel read-only,
legacy old-shape loader.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- read_custom_json/journal_from_custom_json: read arbitrary JSON into pages
  via a source->journal column map; requires a filename mapping (folds #345).
- read_journal now dispatches on suffix; .xlsx is read-only (reads the pages
  sheet + optional meta), and write_journal rejects .xlsx with a clear error
  (Excel journals are read-only in batch v3).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jepegit jepegit added this to the v.2.1 milestone Jul 26, 2026
@jepegit jepegit added the cellpy2-stage4 cellpy 2.1 (Stage 4): batch/collectors redesign, utils waves 3-4, F6, shim removals label Jul 26, 2026
@cursor

cursor Bot commented Jul 26, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@jepegit
jepegit enabled auto-merge (squash) July 26, 2026 19:39
@jepegit
jepegit merged commit f61f797 into master Jul 26, 2026
6 checks passed
@jepegit
jepegit deleted the 698-batch-v3-journal branch July 26, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cellpy2-stage4 cellpy 2.1 (Stage 4): batch/collectors redesign, utils waves 3-4, F6, shim removals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant