| Metadata | Value |
|---|---|
| Status | Complete |
| Version | 1.0.0 |
| Last Updated | 2026-09-30 |
| Author | Sangeetha Grantha Team |
| Document Type | Implementation Summary |
Implement Flyway schema evolution (V66 and V67), seed migration maintenance (R__seed_07 amendment, R__seed_09 canonical cycle and kshetra metadata seeding with historical tag purge), and Python worker embedding enrichment (Context Formatter 2.0, Macro Indexer) to capture musicological, architectural, and spatial metadata for the corpus of Muttusvāmi Dīkṣitar (481 kritis across attested cycles, immediate anchor shrines, and documented gaps like Kanyakumari), eliminating sibling vector collision and establishing verified retrieval benchmarks.
V66 & V67)V66__dikshitar_musicological_enrichment.sqlmandalam_enum ('CHOLA', 'PANDYA', 'TONDAI', 'NADU', 'CHERA', 'KONGU', 'UTTARA')place_kind_enum ('LOCALITY', 'COMPLEX', 'SANNIDHI', 'MANDAPAM')cycle_member_role_enum ('CORE', 'DHYANA', 'MANGALAM', 'OPTIONAL', 'DISPUTED_CONJECTURE')vibhakti_enum ('PRATHAMA', 'DVITIYA', 'TRITIYA', 'CHATURTHI', 'PANCHAMI', 'SHASHTHI', 'SAPTAMI', 'SAMBODHANA', 'SARVA_VIBHAKTI')raga_mudra_enum ('SHUDDHA', 'CHHANDA', 'BHINNA')yati_pattern_enum ('GOPUCHHA', 'SROTAVAHA', 'DAMARU', 'MRIDANGA', 'VISHAMA')deity_posture_enum ('STHANAKA', 'ASANA', 'SHAYANA', 'NRITYA')bhuta_enum ('PRITHVI', 'APAS', 'TEJAS', 'VAYU', 'AKASHA')temples: Added parent_temple_id (FK self-reference), place_kind (default 'LOCALITY'), mandalam, bhuta, sthala_vriksha, sthala_tirtha, nadi_tirtha, deity_posture.krithis: Added vibhakti_case, vibhakti_stem, raga_mudra_kind, raga_mudra_phrase, yati_pattern, is_manipravala, occasion_note.krithi_cycle_memberships: Created dedicated table for cycle membership tracking:
id UUIDkrithi_id -> krithis(id) and tag_id -> tags(id)sequence_order INT, role cycle_member_role_enum NOT NULL, axis_value VARCHAR(100), discriminative_attributes JSONBuq_cycle_member (tag_id, krithi_id)search_documents.krithi_id from NOT NULL to nullable.temple_id (FK temples(id)) and tag_id (FK tags(id)).uq_search_doc_identity to include krithi_id, temple_id, tag_id, section_id, variant_id, document_kind, source_chunk_index (NULLS NOT DISTINCT).'CYCLE_OVERVIEW' and 'KSHETRA_OVERVIEW' to search_document_kind_enum using ALTER TYPE ... ADD VALUE IF NOT EXISTS (without constraint references to preserve PostgreSQL DDL transaction atomicity).V67__search_document_anchor_constraints.sqlchk_search_doc_anchor via strict CASE statement:
COMPOSITION_OVERVIEW, SECTION_PASSAGE, COMMENTARY_LAKSHANA, MANUSCRIPT_FACSIMILE): krithi_id IS NOT NULL AND temple_id IS NULL AND tag_id IS NULLCYCLE_OVERVIEW): tag_id IS NOT NULL AND krithi_id IS NULL AND temple_id IS NULL AND section_id IS NULL AND variant_id IS NULLKSHETRA_OVERVIEW): temple_id IS NOT NULL AND krithi_id IS NULL AND tag_id IS NULL AND section_id IS NULL AND variant_id IS NULLELSE FALSER__seed_07 & R__seed_09)R__seed_07_canonical_cycle_tags.sqlINSERT INTO krithi_tags ... WHERE lower(k.title) LIKE ... for all Dikshitar cycles.R__seed_09_dikshitar_cycle_memberships.sqlkrithi_tags where source = 'canonical_cycle'.category = 'STOTRA_STYLE':
guruguha-vibhakti (Guruguha Vibhakti Kritis)tyagaraja-vibhakti (Tyagaraja Vibhakti Kritis)tiruvarur-panchalinga (Tiruvarur Panchalinga Kritis)shodasa-ganapati (Shodasa Ganapati Kritis)nottusvara-sahitya (Nottusvara Sahitya)axis_value = NULL; 9 Core Avaranas with axis_value = Chakra name and JSONB Yoginis; Mangalam at seq 10 with axis_value = NULL).
SHASHTHI, Chakra: Sarvarakshakara, Yogini: Nigarbha)PANCHAMI, Chakra: Sarvarthasadhaka, Yogini: Kulottirna)SAPTAMI, Chakra: Sarvarogahara, Yogini: Rahasya)axis_value (e.g., 'God Save the King', 'Castalian Dew', etc.).temple_id, vibhakti_case, vibhakti_stem, and occasion_note for all 481 Dikshitar kritis in the catalogue.place_kind = 'COMPLEX', mandalam = 'PANDYA') in temples. Maintained strict single-writer separation: no placeholder row seeded in search_documents; macro indexer exclusively owns document generation.context_formatter.py)len(header.split()) <= 60).[Vibhakti: SHASHTHI (kamalAmbikAyAH)][Kshetra: Tiruvarur; Mandalam: CHOLA; Element: TEJAS; Posture: STHANAKA][Cycle: Kamalamba Navavarnam; Role: CORE; Avarana: 6; Chakra: Sarvarakshakara; Yogini: Nigarbha][Cycle: Nottusvara Sahitya; Tune: God Save the King]krithi_sections ([Structure: MADHYAMA_KALA, SAMASHTI_CHARANAM])format_cycle_overview(cycle_name, description, member_summaries)format_kshetra_overview(temple_name, place_kind, mandalam, bhuta, sthala_features, compositions_summary, has_gap_note)macro_indexer.py)index_cycle_overviews and index_kshetra_overviews routines.CYCLE_OVERVIEW and KSHETRA_OVERVIEW documents directly against search_documents.chk_search_doc_anchor.batch_embed_catalogue.py)ThreadPoolExecutor with --concurrency flag (default 8) ensuring each worker thread operates on an isolated PostgreSQL connection.ON CONFLICT target matching uq_search_doc_identity.--composer dikshitar) and macro overviews (--include-macro).Extended evals/retrieval_benchmarks.json and evaluate_retrieval.py with Track 145 discriminative battery (EVAL-24 to EVAL-31):
KSHETRA_OVERVIEW ranked #1 (Similarity 0.854) with negative-evidence macro summary retrieved.make migrate.DatabaseFactory.dbQuery { } and entity-to-DTO boundaries strictly preserved.test_embeddings.py).:modules:backend:dal:test).:modules:backend:api:test).make test-mobile).