Files
notarius/docs/roadmap/5-seriatim-input-module.md

117 lines
3.0 KiB
Markdown

# Checkpoint 5: Seriatim Input Module
## Status
This document describes planned work, not implemented behavior.
## Goal
Add the first real input source while keeping transcript-specific behavior
isolated inside an input-stage module.
This checkpoint should allow Seriatim minimal transcript JSON to become a
generic `SourceDocument`.
## Scope
In scope:
- `internal/modules/input/seriatim`;
- parser for Seriatim minimal output JSON;
- mapping into `SourceDocument` and `SourceUnit`;
- source-document validation;
- input adapter registry wiring;
- fixtures and tests;
- CLI/config path to select the input module if the CLI shell exists.
Out of scope:
- D&D extraction;
- LLM extraction calls;
- transcript-specific behavior in runner/core packages;
- support for every possible Seriatim schema variant.
## Proposed Stages
### Seriatim Source Model
Define module-local structs for the Seriatim minimal output schema.
Expected external shape:
- top-level `metadata`;
- top-level `segments`;
- segment `id`;
- segment `start`;
- segment `end`;
- segment `speaker`;
- segment `text`.
Keep these structs in the Seriatim input module package.
### Parse And Validate
Implement parser and validation behavior.
Validation should cover:
- valid JSON;
- required metadata fields;
- required segment fields;
- unique segment IDs;
- non-empty segment text;
- valid start/end values as appropriate.
Prefer clear module-specific errors.
### Map To SourceDocument
Map Seriatim data into the generic source model:
- segment `id` becomes `SourceUnit.ID`;
- segment `text` becomes `SourceUnit.Text`;
- unit kind should identify transcript-like units without requiring core
packages to know transcript semantics;
- `speaker`, `start`, and `end` become unit metadata;
- Seriatim metadata becomes document metadata.
The resulting `SourceDocument` should pass core source validation.
### Registry And CLI Wiring
Register the module under a stable input adapter key, likely `seriatim`.
If CLI support exists, add provisional selection:
```sh
notarius extract ./transcript.json --input seriatim
```
The command may still use fake extractors until checkpoint 6.
### Fixtures And Tests
Add fixtures and tests for:
- valid Seriatim minimal transcript;
- malformed JSON;
- missing metadata;
- missing or duplicate segment IDs;
- empty segment text;
- source-reference compatibility with generated unit IDs.
## Done Criteria
- `go test ./...` passes.
- Seriatim minimal transcript JSON maps into `SourceDocument`.
- Transcript fields do not appear in core runner contracts.
- The input module is selectable through the registry.
- Tests prove transcript-specific assumptions are isolated to the input module.
## Review Questions
- Are segment, speaker, and timestamp assumptions contained inside the input module?
- Are unit IDs stable and suitable for source references?
- Does the input module preserve enough metadata for transcript-oriented output later?
- Should the input module accept only Seriatim minimal output for now?