Skip to content

feat: Tier-1 records.json emitter (#615) - #32

Merged
neuromechanist merged 1 commit into
mainfrom
feat/records-json-emitter
Jun 5, 2026
Merged

neuromechanist merged 1 commit into
mainfrom
feat/records-json-emitter

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

First piece of nemarOrg/nemar-cli#615. The Tier-1 git-walk emitter that produces records.json (a JSON array of neuroschema v0.3.0 record docs, one per primary signal file).

What

  • scripts/emit_records.py — stdlib-only, mirrors emit_manifest.py (pure git plumbing, no annex download, no MNE/biosigIO; nemar-cli stays Python-free). Per primary file: modality (BIDS suffix), entities/datatype/suffix/extension (relpath), signal_summary nchans + channel_type_counts (from channels.tsv, authoritative), recording_duration/sampling_frequency (sidecar resolved by BIDS inheritance via git cat-file). Validates against the released neuroschema v0.3.0 (FK fix lets nm*/on* pass).
  • scripts/test_emit_records.py — real git fixtures, no mocks; 24 tests.
  • .github/workflows/generate-records.yml — mirrors generate-manifest.yml; emit + validate (neuroschema from the git tag, not PyPI) are real; S3 upload to version/v<X.Y.Z>-records.json + .nemar/records.json commit-back are a marked skeleton pending the route contract.

Tier-1 scope (follow-ups)

  • recording_duration/ntimes are null when the sidecar omits RecordingDuration (esp. MEG). Tier-2 backfills those from the already-converted Zarr stores / biosigIO (marked TODO).
  • The data.ts GET /<id>/<version>/records.json route + S3 wiring + committed .nemar/records.json land in a follow-up.

Review addressed

neuroschema-from-git-tag (PyPI 404), nirs->NIRS (no more silent .snirf skip), exclude sourcedata/, header-only channels.tsv -> null nchans, dropped unused annex helpers.

Tested: 24 tests pass; ruff clean; real-fixture emit validates with 0 errors.

emit_records.py: stdlib-only, git-walk emitter producing a JSON array of neuroschema v0.3.0 `record` docs (one per primary signal file). Mirrors emit_manifest.py: pure git plumbing, no annex download, no MNE/biosig. Derives modality (from BIDS suffix), entities/datatype/suffix/extension (from the relpath), signal_summary nchans + channel_type_counts (from channels.tsv, authoritative), recording_duration/sampling_frequency (from the sidecar resolved by BIDS inheritance via git cat-file). recording_duration/ntimes are null when the sidecar lacks RecordingDuration; Tier-2 (biosigIO/zarr backfill) is a marked follow-up. Validates against the released neuroschema v0.3.0.

Includes test_emit_records.py (real git fixtures, no mocks; 24 tests) + generate-records.yml (mirrors generate-manifest.yml; emit + neuroschema-from-git-tag validate are real, the S3 upload/.nemar commit-back are a marked skeleton) + test-emit-records.yml.

Addresses review: install neuroschema from the git tag (not PyPI), map nirs->NIRS so .snirf isn't silently skipped, exclude sourcedata/, header-only channels.tsv -> null nchans (so the *ChannelCount fallback fires), drop unused annex helpers.
@neuromechanist
neuromechanist merged commit 6496af4 into main Jun 5, 2026
2 checks passed
@neuromechanist
neuromechanist deleted the feat/records-json-emitter branch June 5, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant