Skip to content

Commit 818ff77

Browse files
committed
document claim-based review serving and mandatory languages
Root AGENTS.md: review_queue/scheduling descriptions, drop stale sources/[id] frontend reference, correct CLI command summary, update data-pipeline step to claims + floor-of-1, list CLAIM_TTL_MINUTES. .env.example gains CLAIM_TTL_MINUTES; README enrichment section matches the demand-driven model.
1 parent 06337f0 commit 818ff77

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

AGENTS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ pnpm test # Run tests
4242

4343
## Key Backend Files
4444

45-
- `poliloom/poliloom/cli.py` - CLI commands (import, enrich, embed)
45+
- `poliloom/poliloom/cli.py` - CLI commands (dump download/extract, import, cleanup, Meilisearch indexing)
4646
- `poliloom/poliloom/api/` - FastAPI endpoints (politicians, sources, events, stats, auth)
4747
- `poliloom/poliloom/models/` - SQLAlchemy models (Politician, Source, Property, etc.)
4848
- `poliloom/poliloom/importer/` - Wikidata dump processing
4949
- `poliloom/poliloom/enrichment.py` - AI-powered data extraction from web sources
50-
- `poliloom/poliloom/scheduling.py` - On-demand enrichment orchestration
51-
- `poliloom/poliloom/review_queue.py` - Per-user unevaluated review-pool selection
50+
- `poliloom/poliloom/scheduling.py` - On-demand enrichment orchestration (floor-of-1 top-up)
51+
- `poliloom/poliloom/review_queue.py` - Claim-based review serving: per-property claims (TTL) handed out under per-politician row locks
5252
- `poliloom/poliloom/archiving.py` - Web page fetching and MHTML archiving via Playwright
5353
- `poliloom/poliloom/sse.py` - Server-sent events bus for real-time updates
5454

5555
## Key Frontend Files
5656

5757
- `poliloom-gui/src/app/(app)/politician/[qid]/` - Single politician evaluation view
58-
- `poliloom-gui/src/app/(app)/sources/[id]/` - Source evaluation view
5958
- `poliloom-gui/src/app/(app)/session/` - Session flow (enriching, unlocked, complete)
6059
- `poliloom-gui/src/components/evaluation/` - Evaluation UI (property display, source viewer, forms)
60+
- `poliloom-gui/src/components/entity/` - Entity components (MultiSelect filter picker, etc.)
6161
- `poliloom-gui/src/components/ui/` - Generic UI components (entity search, date picker, etc.)
6262
- `poliloom-gui/src/contexts/` - React contexts (EvaluationSession, EventStream, NextPolitician, etc.)
6363
- `poliloom-gui/src/types/` - TypeScript definitions
@@ -68,12 +68,12 @@ pnpm test # Run tests
6868
2. Import positions, locations, countries → Index entities to Meilisearch
6969
3. Import politicians with entity links
7070
4. Archive web sources (Wikipedia, government portals) as MHTML via Playwright
71-
5. When a user's per-language review pool is empty, enrich an eligible politician from sources in that user's selected languages (two-stage: free-form extraction → Meilisearch entity mapping); (politician, Wikipedia project) snapshots are re-enriched after `ENRICHMENT_COOLDOWN_DAYS` (default 365); prefetch one politician ahead during review
71+
5. Users always review in at least one language. `/next` claims the unevaluated properties it serves (per-property claims with `CLAIM_TTL_MINUTES` TTL, default 30), so users never see each other's property; users with disjoint languages review the same politician in parallel. When nothing serveable remains, background enrichment (two-stage: free-form extraction → Meilisearch entity mapping) tops up to a floor of 1 serveable politician per filter combo; (politician, Wikipedia project) snapshots are re-enriched after `ENRICHMENT_COOLDOWN_DAYS` (default 365)
7272
6. Community evaluation → Wikidata submission
7373

7474
## Environment Variables
7575

76-
Backend (`.env`): DB_*, OPENAI_API_KEY, OPENAI_MODEL, OPENAI_REASONING_EFFORT, MEDIAWIKI_CONSUMER_*, GOOGLE_APPLICATION_CREDENTIALS, MEILI_URL, MEILI_MASTER_KEY, POLILOOM_ARCHIVE_ROOT, WIKIDATA_API_ROOT
76+
Backend (`.env`): DB_*, OPENAI_API_KEY, OPENAI_MODEL, OPENAI_REASONING_EFFORT, MEDIAWIKI_CONSUMER_*, GOOGLE_APPLICATION_CREDENTIALS, MEILI_URL, MEILI_MASTER_KEY, POLILOOM_ARCHIVE_ROOT, WIKIDATA_API_ROOT, ENRICHMENT_COOLDOWN_DAYS, CLAIM_TTL_MINUTES
7777
Frontend (`.env.local`): AUTH_SECRET, MEDIAWIKI_OAUTH_*, API_BASE_URL
7878

7979
## Code Style

poliloom/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ DB_POOL_TIMEOUT=30
4141
# Per-source re-enrichment age and stats coverage window in days (default: 365)
4242
# ENRICHMENT_COOLDOWN_DAYS=365
4343

44+
# Minutes a user's claim on review properties stays live (default: 30)
45+
# CLAIM_TTL_MINUTES=30
46+
4447
# API server configuration
4548
# Number of uvicorn worker processes (default: 8)
4649
# WORKERS=8

poliloom/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ uv run poliloom import-politicians # Import politicians
4646

4747
### Extract politician data
4848

49-
Enrichment runs on demand when a user's per-language review pool is empty,
50-
using only sources in the user's selected languages; the review UI prefetches
51-
one politician ahead. Each (politician, Wikipedia project) gets a fresh snapshot after
49+
Enrichment is demand-driven: `/politicians/next` claims and serves unevaluated
50+
properties in the user's selected languages, and background enrichment tops up
51+
to one serveable politician per filter combo when the pool runs dry. Each
52+
(politician, Wikipedia project) gets a fresh snapshot after
5253
`ENRICHMENT_COOLDOWN_DAYS` (default 365).
5354

5455
### Run the API server

0 commit comments

Comments
 (0)