How madhavendrapandey/friction-intel works
1. What this repo is
Friction-Intel is a Python pipeline for collecting discussion data, extracting structured evidence, normalizing and grouping it, then producing human-readable reports and a small web UI over the results.
2. Ingestion boundary
The first subsystem is modules/friction/collectors/, which adapts multiple source types into a common intake flow: GitHub Discussions, Hacker News, Reddit, RSS feeds, and local seed data. The data/seed/*.json files are an offline/bootstrap source for development or repeatable runs.
3. Shared domain layer
modules/friction/domain.py appears to define the core entities used across the pipeline, while modules/friction/paths.py centralizes filesystem locations. These act as the shared contract between collectors, services, repositories, and reporting.
4. Extraction and normalization pipeline
modules/friction/extractors/ turns raw collected content into structured evidence using rule-based and pattern-based logic. That output is then refined by services such as normalization, vocabulary handling, and quality filtering so downstream analysis works on consistent concepts rather than source-specific text.
5. Repository/data-access boundary
modules/friction/repositories/ is the persistence layer over a SQLite database in data/friction.db. The repository set is fairly broad: posts, sources, snapshots, evidence, normalized evidence, candidate issues, evidence groups, contradictions, relationships, profiles, validation, traceability, and pipeline runs. This suggests the app persists both raw intake and multiple derived views of the same underlying information.
6. Analytical services
The main business logic lives in modules/friction/services/. Key stages include collection orchestration, extraction, normalization, grouping, candidates generation, contradiction detection, relationships, profile construction, evolution tracking, and validation. These services likely form the core pipeline that transforms raw source material into analysis-ready outputs.
7. Traceability and provenance
The presence of traceability, validation, snapshots, and pipeline_runs repositories indicates the system is designed to explain where derived facts came from and how they changed over time. This is important for any architecture diagram: provenance is not incidental, it is a first-class part of the model.
8. Reporting outputs
modules/friction/services/reporting.py writes reports into modules/friction/reports/ as both .json and .md artifacts, organized by daily, weekly, and monthly time windows. These generated files are part of the product surface, not just internal logs.
9. Web presentation layer
The web/ directory is a read-only UI layer backed by Jinja templates. The templates focus on landing, reports listing/detail, friction overview, evidence source views, profile detail, and profile evidence. That implies the web app is mainly a presentation and navigation layer over precomputed pipeline data rather than a primary write path.
10. Orchestration and runtime shape
modules/friction/runner.py is the likely top-level coordinator that wires collectors, services, repositories, and reporting together. requirements.txt indicates a Python runtime with SQLite-backed persistence, and the tests cover the major analytical/reporting behaviors, which reinforces that the repo is organized around a batch-style data pipeline plus a lightweight UI.
Main entry points: runner.py Runner · friction.db SQLite DB · normalization.py Normalization · main.py Web UI
Components 23
Ingestion
Collectors adapt external discussion sources and local seed data into the intake flow.
- Sources · GitHub Discussions, Hacker News, Reddit, RSS, and seed intake.
modules/friction/collectors - Seed data · Bootstrap JSON data for repeatable or offline runs.
data/seed - Collector base · Common collector interface.
modules/friction/collectors/base.py
Core pipeline
Domain model, extraction, normalization, grouping, and analysis services.
- Runner · Top-level pipeline coordinator.
modules/friction/runner.py - Domain · Shared core data model.
modules/friction/domain.py - Paths · Centralized repository and artifact locations.
modules/friction/paths.py - Collecting · Coordinates source intake across collectors.
modules/friction/services/collection.py - Extraction · Turns raw content into structured evidence.
modules/friction/services/extraction.py - Normalization · Refines evidence into consistent concepts.
modules/friction/services/normalization.py - Grouping · Clusters related evidence and concepts.
modules/friction/services/grouping.py - Analysis · Candidates, contradictions, relationships, profiles, evolution, validation.
- Quality filter · Suppresses low-signal or unreliable evidence.
modules/friction/services/quality_filter.py - Vocabulary · Handles canonical terms and concept alignment.
modules/friction/services/vocabulary.py - Traceability · Tracks provenance for derived facts and transformations.
modules/friction/services/traceability.py
Persistence
SQLite-backed repositories for raw, derived, and provenance data.
- Evidence · Stores extracted evidence records.
modules/friction/repositories/evidence_repository.py - Normalized · Stores normalized evidence records.
modules/friction/repositories/normalized_evidence_repository.py - Provenance · Snapshots, traceability, validation, and pipeline run history.
- Derived state · Candidates, groups, contradictions, relationships, profiles, posts, sources.
- SQLite DB · Persistent backing store for the pipeline.
data/friction.db
Outputs
Generated reports and the read-only web presentation layer.
- Reporting · Writes daily, weekly, and monthly JSON/Markdown reports.
modules/friction/services/reporting.py - Reports · Published report files under daily, weekly, and monthly windows.
modules/friction/reports - Web UI · Read-only Jinja-based interface over precomputed results.
web/main.py - Templates · Landing, reports, evidence source, and profile pages.
web/templates
Connections 30
- Runner → Collecting: orchestrates · Coordinates ingestion as the pipeline entrypoint.
- Runner → Extraction: runs · Executes the structured evidence pipeline.
- Runner → Normalization: runs · Applies normalization before downstream analysis.
- Runner → Grouping: runs · Clusters evidence into analysis units.
- Runner → Analysis: drives · Triggers later-stage analytical services.
- Runner → Reporting: publishes · Emits human-readable outputs after analysis.
- Collecting → Sources: ingests · Pulls from external sources and local seeds.
- Sources → Collector base: implements · Source-specific adapters share a common intake contract.
- Sources → Seed data: includes · Offline/bootstrap inputs for repeatable runs.
- Collecting → Domain: uses · Produces domain entities for downstream stages.
- Extraction → Evidence: writes · Persists extracted evidence.
- Extraction → Domain: maps to · Converts raw inputs into shared entities.
- Normalization → Normalized: writes · Stores canonicalized evidence.
- Normalization → Vocabulary: uses · Aligns terms to canonical vocabulary.
- Normalization → Quality filter: applies · Filters low-quality or noisy items.
- Grouping → Derived state: updates · Persists grouped and derived analysis state.
- Analysis → Derived state: reads/writes · Candidate, contradiction, relationship, profile, and source state.
- Analysis → Traceability: records · Preserves provenance and transformation history.
- Analysis → Provenance: stores · Captures snapshots, validation, and run metadata.
- Traceability → Provenance: persists · Writes trace and provenance records.
- Reporting → Reports: generates · Produces JSON and Markdown report artifacts.
- Reporting → Paths: uses · Resolves report output locations.
- Web UI → Templates: renders · Serves read-only pages from templates.
- Web UI → Reports: reads · Displays precomputed report outputs.
- Web UI → Derived state: reads · Shows evidence, profiles, and related derived data.
- SQLite DB → Evidence: backing store · SQLite persistence for repository data.
- SQLite DB → Normalized: backing store · SQLite persistence for repository data.
- SQLite DB → Derived state: backing store · SQLite persistence for repository data.
- SQLite DB → Provenance: backing store · SQLite persistence for repository data.
- Paths → Reports: locates · Defines report artifact directories.