| Metadata | Value |
|---|---|
| Status | Archived |
| Version | 1.0.0 |
| Last Updated | 2026-09-10 |
| Author | Sangeetha Grantha Team |
| Document Type | Archive |
[!NOTE] Historical evidence: results, counts, commands, and observations below belong to the original work described here. The editorial update date is not a new test or corpus verification. For present behavior, use current ingestion guide.
This document presents a comprehensive analysis for implementing a Krithi Bulk Import Capability for Sangeetha Grantha. The goal is to ingest Carnatic music compositions from distributed web sources (Karnatik.com, specific Blogspot archives) and enrich them with authoritative data from TempleNet.com.
Additionally, this analysis evaluates Koog (JetBrains’ AI Agent Framework) as an orchestration engine for this pipeline.
Gemini Recommendation: Adopt a Hybrid Phased Approach.
GeminiApiClient for extraction. This delivers immediate value with minimal infrastructure overhead.We have identified 5 primary sources with distinct characteristics. The strategy must accommodate structured, semi-structured, and unstructured data.
| Source | Type | Content Focus | Extraction Difficulty | Strategic Value |
|---|---|---|---|---|
| Karnatik.com | Structured HTML | Lyrics, Raga, Tala, Composer | 🟢 Low | Primary. High volume, consistent structure. The “Gold Standard” for initial seeding. |
| Guru Guha Blog | Unstructured Blog | Dikshitar Krithis (Index & Meaning) | 🔴 High | Enrichment. List is plain text (no links). Requires “Search & Scrape” strategy. |
| Syama Krishna Vaibhavam | List/Blog | Syama Sastri Krithis | 🟡 Medium | Discovery. Good for gap analysis of missing Syama Sastri krithis. |
Krithi Name - Raga tuples but no direct path to content.site:guru-guha.blogspot.com "Krithi Name") to find the actual blog post URL.To handle data cleansing, de-duplication, and moderation, the pipeline is divided into 6 Distinct Stages.
graph TD
A[Discovery] -->|URL List| B[Scraping]
B -->|Raw HTML| C[AI Extraction]
C -->|Draft JSON| D[Entity Resolution]
D -->|Mapped JSON| E[Validation & Dedup]
E -->|Clean JSON| F[Staging & Review]
KrithiImportDto.composer_id: uuid.raga_id: uuid.lyrics and metadata against the TempleNet reference data.(title_normalized, raga_id, composer_id) tuple.DUPLICATE. If fuzzy match, mark for MANUAL_MERGE.imported_krithis table.PENDING_REVIEW.Koog is a Kotlin-first AI Agent framework.
| Feature | Relevance to Project | Verdict |
|---|---|---|
| Graph Workflows | High. The pipeline (Scrape -> Extract -> Resolve) is a DAG. | ✅ Strong Fit. Koog makes this explicit and visualizable. |
| Tool Calling | Medium. “Lookup Raga”, “Save Krithi” can be tools. | ⚠️ Overkill? Direct service calls are simpler for batch jobs. |
| Ktor Integration | High. Sangeetha Grantha uses Ktor. | ✅ Native Fit. |
| Reliability (Retries) | High. Web scraping is flaky. | ✅ Useful. But easy to implement with standard libraries too. |
| Complexity | Negative. Adds a new framework abstraction. | ❌ Risk. Learning curve for a task solvable with simple code. |
For a batch import job, a linear script or a simple coroutine pipeline is often sufficient. Koog shines when the agent needs “autonomy” (e.g., “I found a broken link, I will try searching Google instead”).
Build a ImportPipelineService in Kotlin.
kotlinx.coroutines channels or flows.GeminiApiClient.Implement the pipeline as a Koog Agent Graph.
ScrapeAgent, ExtractionAgent, ResolutionAgent.Use Python scripts for scraping (BeautifulSoup) and Airflow for scheduling.
backend module. Do not split the stack.WebScrapingService using Jsoup (for structured) and Gemini (for unstructured).ImportOrchestrator using Kotlin Flows.imported_krithis.import_batches and imported_krithis (See 04__import-pipeline.sql).KarnatikSourceHandler using Jsoup.temples table.ImportService to orchestrate: Scrape -> Extract (Gemini) -> Resolve -> Save.