| Metadata | Value |
|---|---|
| Status | Completed |
| Version | 1.0.0 |
| Last Updated | 2026-03-20 |
| Author | Sangeetha Grantha Team |
ID: TRACK-104 Status: Not Started Owner: Sangita Grantha Architect Created: 2026-03-20 Updated: 2026-03-20 Parent: TRACK-093 (Trinity Krithi Import)
Handle the Dikshitar blog’s repeated “variations” blocks (one after each script section) as intra-variant metadata boundaries rather than document-level boundaries. Once TRACK-100 enables multi-pass parsing, these per-script “variations” blocks must be excluded from lyric content within each language block.
database/for_import/EXTRACTION-INVESTIGATION-REPORT.mdtools/krithi-extract-enrich-worker/src/structure_parser.py_find_metadata_boundaries() detects multiple VARIATIONS boundaries (e.g., at pos 368, 1135, etc.). Currently moot because TRACK-100’s truncation prevents reaching them. After TRACK-100 is fixed, these would be encountered within each language block._find_metadata_boundaries() (line 862) uses METADATA_BOUNDARY_PATTERNS which includes VARIATIONS (line 247)_build_blocks() will encounter VARIATIONS as a header_detect_language_header() (line 388) already has ("variations", "VARIATIONS") in candidates_extract_language_header_variants() (line 665) already has if block.label in METADATA_LABELS: flush(); break at line 688-689_extract_language_header_variants() flushes the current variant and stops processing that blockAfter tracing the code, the existing _extract_language_header_variants() method at lines 687-689 already breaks on METADATA_LABELS (which includes VARIATIONS). Once TRACK-100 provides full-document text to per-block parsing, the per-script variations blocks will be naturally excluded.
However, there’s a subtle issue: if _build_blocks() processes a full language block that contains a “variations” section followed by more lyric content (e.g., a “Word Division” sub-block after “variations”), the break at line 689 would prematurely stop variant collection. This needs verification against actual Dikshitar page structure.
[Language Header: Devanagari]
pallavi (lyrics)
anupallavi (lyrics)
charanam (lyrics)
variations (metadata) ← break here is correct
[Language Header: Tamil] ← next language block starts fresh
The break is correct per-block because each language section is self-contained with its own variations footer. No lyric content follows variations within the same language block.
break at line 689 fires correctly within each language blockbreak logic is insufficient (e.g., variations content leaks into lyrics), add explicit per-block metadata boundary detectionbreak to continueThe existing code may already handle this correctly once TRACK-100 provides full text. This track is primarily a verification and safety-net track. If integration testing after TRACK-100 shows no issues, this track can be marked as “Verified — No Changes Needed.”
tools/krithi-extract-enrich-worker/src/structure_parser.py — potentially _extract_language_header_variants() (only if verification reveals issues)tools/krithi-extract-enrich-worker/tests/test_structure_parser.py — add per-script variations test cases