How gowtham2036/ai_intelligence_pipeline_starter works
Purpose and Entry Points
This is a Python batch data pipeline that builds a verified AI-research-paper dataset: ingest arXiv papers, associate GitHub repositories, normalize and persist records, generate grounded LLM enrichments, and export audited JSON/CSV artifacts. Primary orchestration is src/main.py; production enrichment runners are src/run_production_enrichment.py and src/run_fast_production_enrichment.py. Final operational commands are src/final_validate.py, src/final_submission_audit.py, and src/export_final_dataset.py.
Source Ingestion Boundary
arXiv and GitHub are external, independently failure-prone source systems. Source adapters retrieve papers/metadata from arXiv Atom and repository data from GitHub REST:
• src/sources/arxiv.py
• src/sources/github.py
• src/crawler/http.py
The HTTP layer is asynchronous and owns retry, exponential backoff/jitter, concurrency, and rate-limit handling. GitHub operation can use a token and must tolerate authenticated versus unauthenticated quotas.
Extraction, Identity, and Canonicalization
Raw source data is transformed into stable domain entities before persistence. Deterministic paper IDs, UTC timestamps, and canonical GitHub URLs establish deduplication and join boundaries:
• src/normalization.py
• src/models/entities.py
• src/extractor/webpage.py
Canonicalization removes GitHub URL variants such as tracking parameters, subpaths, and .git; this makes repository matching and later audits reproducible.
Authoritative Persistence
SQLite is the system of record, not the exported files. DatabaseManager provides schema creation and idempotent upserts, with foreign keys, WAL mode, and indexes supporting paper, enrichment, date, repository, and domain access:
• src/database.py
• data/ai_intelligence.db
The key relational boundary is papers to enrichments: accepted enrichment rows must reference a persisted paper, preventing orphan intelligence records.
LLM Enrichment Stage
The enrichment pipeline turns paper source text into seven structured intelligence fields: summary, problem, methodology, contributions, domain, topics, and keywords:
• src/enrichment.py
• src/llm/provider.py
• src/llm/schemas.py
Prompts and provider configuration are separated from pipeline control in src/llm/prompts.py. The runtime uses configurable LLM providers/models, with documented Groq multi-key worker behavior; credentials and provider settings enter through .env derived from .env.example.
Grounding, Provenance, and Rejection Boundary
LLM output is schema-validated and then subjected to deterministic grounding checks against authoritative paper text, especially numeric, statistical, and benchmark claims. Accepted data receives source type, URL, and SHA-256 content hash provenance. Rejected enrichment attempts must not enter production tables:
• src/enrichment.py
• data/rejected_enrichments/quarantine_log.json
• src/final_validate.py
This quarantine boundary isolates hallucinated or unsupported content while retaining an audit trail.
Publishing and Assurance
The database is flattened or nested into deterministic deliverables, with separate quality and final-submission audit stages:
• src/export_final_dataset.py
• src/generate_quality_report.py
• src/final_submission_audit.py
Published artifacts are data/final_research_papers.json, data/final_research_papers.csv, and data/final_quality_report.json. Supplemental GitHub cleanup/review scripts—such as src/cleanup_github_dataset.py and src/audit_github_matches.py—support correctness of repository associations outside the main ingestion-to-export path.
Main entry points: enrichment.py Grounded Enrichment Pipeline · ai_intelligence.db Authoritative SQLite Store · arxiv.py arXiv Adapter · github.py GitHub Adapter
Components 21
External Sources
- arXiv Atom
- GitHub REST · Uses authenticated or unauthenticated quotas.
Core Pipeline
- Batch Orchestrator · Coordinates ingestion, persistence, and enrichment runs.
src/main.py - Async HTTP Client · Owns retries, backoff, concurrency, and rate-limit handling.
src/crawler/http.py - arXiv Adapter
src/sources/arxiv.py - GitHub Adapter
src/sources/github.py - Identity & Canonicalization · Creates stable paper IDs, UTC timestamps, and canonical GitHub URLs.
src/normalization.py - Domain Entities
src/models/entities.py - Paper Text Extractor
src/extractor/webpage.py - Authoritative SQLite Store · Idempotent upserts enforce persisted-paper references for enrichments.
data/ai_intelligence.db - Database Manager · Creates schema and manages WAL, foreign keys, and indexes.
src/database.py
Enrichment & Verification
- Production Enrichment Runners · Standard and fast production execution paths.
src/run_production_enrichment.py - Grounded Enrichment Pipeline · Produces seven intelligence fields and rejects unsupported claims.
src/enrichment.py - Configurable LLM Provider · Supports provider/model configuration and multi-key workers.
src/llm/provider.py - Enrichment Schemas
src/llm/schemas.py - Rejected Enrichment Log · Unsupported enrichment attempts remain outside production tables.
data/rejected_enrichments/quarantine_log.json
Publishing & Assurance
- Final Validation
src/final_validate.py - Dataset Exporter · Generates deterministic JSON and CSV deliverables from SQLite.
src/export_final_dataset.py - Published Dataset
data/final_research_papers.json - Quality Report
data/final_quality_report.json - Submission Audit
src/final_submission_audit.py
Connections 26
- arXiv Atom → arXiv Adapter: paper metadata
- GitHub REST → GitHub Adapter: repository data
- arXiv Adapter → Async HTTP Client: requests
- GitHub Adapter → Async HTTP Client: requests
- Batch Orchestrator → arXiv Adapter: ingests
- Batch Orchestrator → GitHub Adapter: associates repos
- arXiv Adapter → Identity & Canonicalization: raw papers
- GitHub Adapter → Identity & Canonicalization: raw repositories
- Identity & Canonicalization → Domain Entities: stable records
- Domain Entities → Database Manager: upserts
- Database Manager → Authoritative SQLite Store: persists
- Batch Orchestrator → Paper Text Extractor: extracts source text
- Production Enrichment Runners → Grounded Enrichment Pipeline: runs
- Authoritative SQLite Store → Grounded Enrichment Pipeline: persisted papers
- Paper Text Extractor → Grounded Enrichment Pipeline: authoritative text
- Grounded Enrichment Pipeline → Configurable LLM Provider: structured requests
- Configurable LLM Provider → Enrichment Schemas: validated fields
- Enrichment Schemas → Grounded Enrichment Pipeline: schema result
- Grounded Enrichment Pipeline → Authoritative SQLite Store: accepted grounded enrichments
- Grounded Enrichment Pipeline → Rejected Enrichment Log: rejected attempts
- Authoritative SQLite Store → Final Validation: validates
- Authoritative SQLite Store → Dataset Exporter: export source
- Dataset Exporter → Published Dataset: JSON and CSV
- Authoritative SQLite Store → Quality Report: quality metrics
- Published Dataset → Submission Audit: audits deliverables
- Quality Report → Submission Audit: audit evidence