case study
SignalMine
Unstructured forum and issue threads hide product and market signals; manual synthesis is not reproducible.
problem
Market and product signals are buried in unstructured GitHub and Reddit threads. Manual synthesis does not scale and is not reproducible.
solution
SignalMine (PainMiningEngine repo) runs collector → deterministic normalizer → schema-constrained LLM extraction → JSON Schema validation, with golden-dataset evaluation and optional Postgres persistence via FastAPI.
requirements
Source-agnostic RawDiscussion contract; GitHub collector first; Reddit behind configuration; no embeddings or clustering in current scope (per README).
Python package boundaries under backend/app: collectors, normalizer, extractor, validator, pipeline, storage, API. Contracts in schemas/; product constraints in docs/.
event & data flow
URL → routed collector → RawDiscussion → NormalizedDocument → Instructor extraction → Complaint JSON → validator. CLI supports stage-by-stage JSON workflows; API persists when DATABASE_URL is configured.
reliability
Insert-only SQLAlchemy persistence per stage; duplicate detection migrations; structured errors from collectors with retries on GitHub API.
security
No auth on current API scope (explicitly out of scope in README). Secrets via environment only — no keys in repo.
testing
125 pytest tests collected (verified 2026-11-07 via pytest --collect-only). Prefer adding docs/project-metrics.md in-repo as the long-term SSoT.
performance
Synchronous pipeline for CLI validation; API adds persistence and metrics endpoints.
what i built
- Collectors. GitHub REST, file, optional Reddit via PRAW
- Contracts. 4 JSON schemas in schemas/
- Extraction. Versioned prompts, Instructor, validation retries
- Evaluation. Golden dataset harness and Markdown reports
- API. FastAPI process/complaints/health/metrics
key decisions
- Deterministic normalization before LLM. Removes formatting variance so extraction diffs are meaningful.
- Schema-first outputs. Complaint contract is authoritative — extraction must validate or retry.
trade-offs
- Synchronous orchestration first — simpler correctness proofs before background workers.
- JSON Schema + Pydantic — reliability over free-form LLM output.
lessons
- Golden datasets catch extraction drift field-by-field, not just with a single accuracy score.
verified results
- 125 pytest tests collected
- 4 canonical JSON schemas in schemas/
- Golden-dataset extraction evaluation
- OpenTelemetry + Prometheus on FastAPI