abinazebinoy commited on
Commit
a4e1c4c
·
unverified ·
1 Parent(s): a43d54a

Revise BharatGraph phase roadmap and update phases

Browse files
Files changed (1) hide show
  1. PHASE_ROADMAP.md +361 -720
PHASE_ROADMAP.md CHANGED
@@ -1,847 +1,488 @@
1
- # BharatGraph — Phase Roadmap
2
- # GitHub Issue and Pull Request Reference for All Phases
3
- #
4
- # For each phase:
5
- # 1. Create the GitHub issue using the ISSUE section
6
- # 2. Create the branch listed under BRANCH
7
- # 3. Build the files listed under FILES
8
- # 4. Open a pull request using the PR section
9
- # 5. Merge into main
10
- #
11
  # Branch naming: feature/phase-N-name or fix/issue-N-name
12
- # No develop branch. All branches merge directly into main.
13
 
14
 
15
- # ============================================================
16
- # PHASE 4FastAPI Backend
17
- # ============================================================
18
-
19
- ISSUE_TITLE:
20
- "feat(api): FastAPI backend with entity search, dossier, and graph endpoints"
21
-
22
- ISSUE_LABELS:
23
- ["enhancement"]
24
 
 
 
25
  ISSUE_DESCRIPTION: |
26
- Build the REST API that exposes the graph database and risk engine to the
27
- frontend and external tools.
28
 
29
  Files to create:
30
- api/main.py FastAPI application, CORS, lifespan, router registration
31
- api/models.py Pydantic request and response models with source citations
32
- api/dependencies.py Shared Neo4j driver via dependency injection
33
- api/routes/search.py GET /search?q=name&type=politician|company|contract
34
- api/routes/profile.py GET /profile/{entity_id} — full dossier assembly
35
- api/routes/risk.py GET /risk/{entity_id} — risk score with factor breakdown
36
- api/routes/graph.py GET /graph/connections/{entity_id}?depth=2
37
- api/routes/feed.py WebSocket /ws/feed — live update stream
38
-
39
- Additional endpoints:
40
- GET /health
41
- GET /stats
42
- GET /graph/pattern/politician-contracts
43
-
44
- Response format for all endpoints must include:
45
- data: the result payload
46
- sources: list of source documents with url, date, institution
47
- generated_at: ISO timestamp
48
-
49
- Acceptance criteria:
50
- uvicorn api.main:app starts without errors
51
- GET /health returns 200 with Neo4j connection status
52
- GET /search?q=sample returns structured results from Neo4j
53
- All endpoints return typed JSON validated by Pydantic
54
-
55
- BRANCH: "feature/phase-4-api"
56
-
57
- PR_TITLE:
58
- "feat(api): FastAPI backend with entity search, dossier, and graph endpoints"
59
-
60
- PR_DESCRIPTION: |
61
- Adds the complete REST API layer.
62
-
63
- api/main.py: FastAPI app with CORS middleware, lifespan context managing
64
- Neo4j driver, and router registration for all route modules.
65
-
66
- api/models.py: Typed Pydantic models for SearchResult, EntityProfile,
67
- RiskScore, GraphNode, GraphEdge, and FeedItem. All response models include
68
- a sources field.
69
 
70
- api/dependencies.py: get_db() dependency returning a live Neo4j session.
71
- Handles connection errors with a structured HTTP 503 response.
 
 
72
 
73
- api/routes/: Four route modules covering search, profile, risk, and graph
74
- traversal. Feed route uses WebSocket for live push.
 
75
 
76
- Start the server:
77
- uvicorn api.main:app --reload
78
 
 
 
 
 
 
 
79
  Closes #ISSUE_NUMBER
80
 
81
 
82
- # ============================================================
83
- # PHASE 5Risk Scoring Engine
84
- # ============================================================
85
-
86
- ISSUE_TITLE:
87
- "feat(ai): composite risk scoring engine with explainable factor breakdown"
88
-
89
- ISSUE_LABELS:
90
- ["enhancement"]
91
 
 
 
92
  ISSUE_DESCRIPTION: |
93
- Build the risk scoring system that assigns a 0-100 structural risk indicator
94
- to each entity based on graph pattern analysis. Every score must be fully
95
- explainable with source citations per factor.
96
 
97
  Files to create:
98
- ai/risk_scorer.py RiskScorer class assembling composite score from factors
99
- ai/indicators.py Five individual indicator functions with weights
100
- ai/explainer.py Converts factor scores to neutral analytical language
101
-
102
- Risk factors and weights:
103
- contract_concentration 0.25 Single company winning repeated contracts
104
- politician_company_overlap 0.35 Politician is director of contract-winning firm
105
- audit_mention_frequency 0.20 Entity mentioned in multiple CAG audit reports
106
- asset_growth_anomaly 0.15 Declared assets grew more than 300 percent
107
- between consecutive election affidavits
108
- criminal_case_presence 0.05 Declared criminal cases in ECI affidavit
109
-
110
- Output structure per entity:
111
- entity_id
112
- entity_name
113
- risk_score integer 0-100
114
- risk_level LOW, MODERATE, HIGH, or VERY_HIGH
115
- factors list of factor name, score, weight, evidence list
116
- explanation neutral analytical text generated by explainer.py
117
- sources all source documents referenced
118
-
119
- Language rules enforced by explainer.py:
120
- Use: structural indicator, governance anomaly, pattern, concentration
121
- Never use: corrupt, suspect, criminal, fraud, guilty
122
-
123
- Acceptance criteria:
124
- python -m ai.risk_scorer runs on the sample graph data
125
- Every factor in the output includes at least one source document reference
126
- Risk level boundaries: 0-30 LOW, 31-60 MODERATE, 61-80 HIGH, 81-100 VERY_HIGH
127
-
128
- BRANCH: "feature/phase-5-risk-scoring"
129
-
130
- PR_TITLE:
131
- "feat(ai): composite risk scoring engine with explainable factors"
132
 
133
- PR_DESCRIPTION: |
134
- Adds the risk scoring layer.
135
-
136
- ai/indicators.py: Five indicator functions each querying Neo4j for their
137
- specific pattern. Returns a score between 0 and their maximum weight.
138
-
139
- ai/risk_scorer.py: RiskScorer class calling all indicators, summing weighted
140
- scores, and assembling the full output structure including evidence references.
141
 
142
- ai/explainer.py: Converts the factor breakdown into neutral analytical prose.
143
- Enforces legally safe language. Cites source documents inline.
144
-
145
- Score interpretation:
146
- 0-30 Low structural indicators
147
- 31-60 Moderate structural indicators
148
- 61-80 High structural indicators
149
- 81-100 Very high structural indicators
150
 
 
 
 
 
 
151
  Closes #ISSUE_NUMBER
152
 
153
 
154
- # ============================================================
155
- # PHASE 6Expanded Data Sources
156
- # ============================================================
157
-
158
- ISSUE_TITLE:
159
- "feat(scrapers): Lok Sabha, SEBI, eCourts, OpenSanctions, ICIJ, Wikidata"
160
-
161
- ISSUE_LABELS:
162
- ["enhancement"]
163
 
 
 
164
  ISSUE_DESCRIPTION: |
165
- Add new scrapers covering parliamentary data, financial regulation, court
166
- records, and international investigative databases. All sources are free.
167
 
168
  Files to create:
169
- scrapers/loksabha_scraper.py Parliamentary questions and answers
170
- scrapers/prs_scraper.py Bill text and legislative status
171
- scrapers/sebi_scraper.py Enforcement orders and insider trading
172
- scrapers/ecourts_scraper.py Judgment search results
173
- scrapers/electoral_bond_scraper.py Supreme Court disclosed bond data
174
- scrapers/opensanctions_scraper.py Global PEP and sanctions list (free API)
175
- scrapers/icij_scraper.py Offshore Leaks entity search (free API)
176
- scrapers/wikidata_scraper.py Entity enrichment via Wikidata SPARQL
177
-
178
- New graph nodes enabled by this phase:
179
- ParliamentaryQuestion with ASKED_BY -> Politician and ABOUT -> Ministry
180
- Bill with SPONSORED_BY -> Politician
181
- SanctionedEntity with IS_SANCTIONED
182
- OffshoreEntity with LINKED_TO -> Person or Company
183
- CourtJudgment with INVOLVES -> Person or Company
184
-
185
- New data in .env.example:
186
- OPENSANCTIONS_API_KEY free at opensanctions.org
187
- No key needed for ICIJ, Wikidata, Lok Sabha, or PRS
188
-
189
- Acceptance criteria:
190
- All 8 scrapers pass syntax check
191
- loksabha_scraper fetches at least one question from public record
192
- opensanctions_scraper returns results for a test entity name
193
- icij_scraper queries Offshore Leaks API and returns structured results
194
-
195
- BRANCH: "feature/phase-6-data-sources"
196
-
197
- PR_TITLE:
198
- "feat(scrapers): Lok Sabha, SEBI, eCourts, OpenSanctions, ICIJ, Wikidata sources"
199
-
200
  PR_DESCRIPTION: |
201
- Adds 8 new scrapers covering parliamentary, financial, judicial, and
202
- international data sources.
203
-
204
- loksabha_scraper.py: Scrapes parliamentary question database from
205
- loksabha.nic.in. Parses question number, date, subject, asking MP, and
206
- ministry response.
207
-
208
- prs_scraper.py: Fetches bill summaries and status from prsindia.org.
209
-
210
- sebi_scraper.py: Scrapes enforcement action orders from sebi.gov.in.
211
-
212
- ecourts_scraper.py: Queries judgment search API at judgments.ecourts.gov.in.
213
-
214
- electoral_bond_scraper.py: Parses the Supreme Court ordered electoral bond
215
- disclosure data from ECI portal.
216
-
217
- opensanctions_scraper.py: Queries OpenSanctions free API for PEP and
218
- sanctions screening of entities in the graph.
219
-
220
- icij_scraper.py: Queries ICIJ Offshore Leaks API to find whether any graph
221
- entities appear in Panama, Pandora, or Paradise Papers.
222
-
223
- wikidata_scraper.py: SPARQL queries to Wikidata for education history,
224
- career timeline, and nationality data for politicians in the graph.
225
-
226
  Closes #ISSUE_NUMBER
227
 
228
 
229
- # ============================================================
230
- # PHASE 7NLP and Document Intelligence
231
- # ============================================================
232
-
233
- ISSUE_TITLE:
234
- "feat(ai): NLP pipeline for entity extraction, shadow drafting, and Hindi NER"
235
-
236
- ISSUE_LABELS:
237
- ["enhancement"]
238
 
 
 
239
  ISSUE_DESCRIPTION: |
240
- Add natural language processing capabilities using only free and open source
241
- models. Extract structured entities from unstructured government documents.
 
242
 
243
  Files to create:
244
- ai/nlp_extractor.py NER on CAG reports and PIB releases
245
- ai/shadow_draft_detector.py Semantic similarity between bills and lobby text
246
- ai/benfords_analyzer.py Statistical anomaly detection on asset figures
247
- ai/multilingual_ner.py Hindi NER using AI4Bharat IndicNER (HuggingFace)
248
-
249
- Models used (all free):
250
- spacy en_core_web_sm English NER, runs locally
251
- ai4bharat/IndicNER Hindi NER, free HuggingFace inference
252
- sentence-transformers Semantic similarity, free local inference
253
- No OpenAI or paid API calls
254
-
255
- nlp_extractor.py behaviour:
256
- Input: text from a CAG report or PIB press release
257
- Output: list of extracted entities with type (PERSON, ORG, LOCATION, MONEY)
258
- Each extracted entity resolved against existing graph nodes using
259
- EntityResolver from processing/entity_resolver.py
260
-
261
- shadow_draft_detector.py behaviour:
262
- Input: bill text and a set of corporate consultation submissions
263
- Output: alignment score 0-100 for each submission, with matched sentence pairs
264
- Threshold 65 or above is flagged as high semantic alignment
265
-
266
- benfords_analyzer.py behaviour:
267
- Input: list of declared asset figures from election affidavits
268
- Output: chi-squared test result and list of anomalous entries where first
269
- digit distribution deviates significantly from Benford's Law expectation
270
-
271
- Acceptance criteria:
272
- nlp_extractor extracts at least 3 entities from a sample CAG report
273
- shadow_draft_detector produces an alignment score for test inputs
274
- benfords_analyzer produces a chi-squared result for a sample asset list
275
- multilingual_ner extracts person names from a sample Hindi PIB headline
276
-
277
- BRANCH: "feature/phase-7-nlp"
278
-
279
- PR_TITLE:
280
- "feat(ai): NLP pipeline — entity extraction, shadow drafting, Benford analysis, Hindi NER"
281
-
282
  PR_DESCRIPTION: |
283
- Adds four NLP modules using only free and locally executable models.
 
 
 
 
284
 
285
- ai/nlp_extractor.py: spaCy English NER pipeline extracting PERSON, ORG,
286
- GPE, and MONEY entities from document text. Extracted entities passed to
287
- EntityResolver for graph matching.
288
 
289
- ai/shadow_draft_detector.py: sentence-transformers cosine similarity
290
- comparing bill subsections against corporate consultation text. Returns
291
- alignment score and matched sentence pairs above threshold.
292
 
293
- ai/benfords_analyzer.py: Chi-squared test comparing first-digit distribution
294
- of asset declaration figures against theoretical Benford distribution.
295
- Flags entries with deviation above significance threshold.
 
296
 
297
- ai/multilingual_ner.py: AI4Bharat IndicNER via Hugging Face inference API
298
- for Hindi named entity extraction from PIB Hindi releases.
 
 
 
299
 
300
- New requirements added:
301
- spacy>=3.7.0
302
- sentence-transformers>=2.6.0
303
 
304
- Closes #ISSUE_NUMBER
 
305
 
 
306
 
307
- # ============================================================
308
- # PHASE 8Advanced Graph Analytics
309
- # ============================================================
 
 
 
 
310
 
311
- ISSUE_TITLE:
312
- "feat(ai): graph analytics — centrality, community detection, circular ownership, ghost companies"
313
 
314
- ISSUE_LABELS:
315
- ["enhancement"]
 
316
 
 
 
317
  ISSUE_DESCRIPTION: |
318
- Implement advanced graph machine learning and structural analysis using
319
- NetworkX (free, open source). No paid dependencies.
320
 
321
  Files to create:
322
- ai/graph_analytics.py Centrality metrics and community detection
323
- ai/circular_ownership.py Detect circular shareholding structures
324
- ai/shadow_director.py Identify de facto controllers via filing patterns
325
- ai/ghost_company.py Detect shell companies activated for tenders
326
-
327
- graph_analytics.py methods:
328
- compute_betweenness_centrality(entity_id)
329
- Identifies entities that serve as bridges between public and private sector.
330
- High betweenness indicates an institutional gatekeeper.
331
- compute_pagerank(graph_data)
332
- Scores entities by the weight of entities that point to them via contracts.
333
- detect_communities(graph_data)
334
- Returns clusters of entities with dense internal connections.
335
- Clusters of companies winning contracts from the same ministry flag
336
- potential procurement cartels.
337
-
338
- circular_ownership.py:
339
- Detects cycles in company ownership graphs.
340
- Pattern: Company A owns Company B owns Company C owns Company A.
341
- Uses NetworkX cycle detection algorithm.
342
- Each detected cycle is flagged as a circular ownership indicator.
343
-
344
- shadow_director.py:
345
- Identifies persons who appear in regulatory filings and address registrations
346
- for companies but are not listed as formal directors.
347
- Pattern: same address, same registered agent, same filing date across
348
- multiple companies without formal board listing.
349
-
350
- ghost_company.py:
351
- Flags companies that meet three or more of:
352
- - Registered within 90 days before winning their first contract
353
- - No prior CAG or SEBI mentions
354
- - No parliamentary question references
355
- - Single director with no other directorships
356
- - Contract value more than 10x the company's paid-up capital
357
-
358
- New requirements:
359
- networkx>=3.2.0
360
-
361
- Acceptance criteria:
362
- compute_betweenness_centrality returns a score for a test entity
363
- detect_communities identifies at least one cluster in sample data
364
- circular_ownership detects a known cycle in test graph data
365
- ghost_company flags the sample contract winner created 30 days before award
366
-
367
- BRANCH: "feature/phase-8-graph-analytics"
368
-
369
- PR_TITLE:
370
- "feat(ai): graph analytics — centrality, community detection, circular ownership, ghost companies"
371
 
372
- PR_DESCRIPTION: |
373
- Adds advanced graph analytics using NetworkX.
 
 
374
 
375
- ai/graph_analytics.py: Fetches subgraph from Neo4j, builds NetworkX graph,
376
- computes betweenness centrality, PageRank, and community partitions using
377
- the Louvain method. Results written back to Neo4j as node properties.
378
 
379
- ai/circular_ownership.py: Extracts ownership edges from Neo4j, constructs
380
- directed graph, uses simple_cycles() to detect circular structures. Each
381
- cycle reported with all members and edge evidence.
382
 
383
- ai/shadow_director.py: Cross-references MCA filing metadata against formal
384
- director listings. Flags address reuse across multiple companies by the
385
- same non-listed individual.
 
 
 
 
386
 
387
- ai/ghost_company.py: Applies five-factor ghost company scoring using
388
- registration date, prior public record mentions, director history, and
389
- contract-to-capital ratio.
390
 
391
- Closes #ISSUE_NUMBER
 
 
392
 
 
 
 
 
 
393
 
394
- # ============================================================
395
- # PHASE 9 — React Frontend
396
- # ============================================================
397
 
398
- ISSUE_TITLE:
399
- "feat(frontend): Next.js dashboard with D3.js graph browser, dossier, and live feed"
 
 
 
 
 
400
 
401
- ISSUE_LABELS:
402
- ["enhancement"]
403
 
404
- ISSUE_DESCRIPTION: |
405
- Build the complete frontend application. Deployed free on Vercel.
406
- All components use only free open source libraries.
407
-
408
- Technology:
409
- Next.js 14
410
- D3.js for force-directed knowledge graph
411
- Tailwind CSS
412
- Leaflet for geospatial view with OpenStreetMap tiles (free)
413
- D3-sankey for money flow diagrams
414
-
415
- Pages required:
416
- / Search bar, live feed preview, platform statistics
417
- /search Results with type and risk level filters
418
- /entity/[id] Full dossier: overview, timeline, graph, evidence locker
419
- /risk-dashboard Entities ranked by structural risk indicator
420
- /graph-explorer Interactive multi-hop relationship browser
421
- /live-feed Real-time stream of new intelligence headlines
422
- /watchlist User-managed entity subscriptions with alert history
423
-
424
- Graph visualisation requirements:
425
- Nodes coloured by type: Politician, Company, Contract, AuditReport
426
- Edge labels showing relationship type
427
- Click node to navigate to dossier
428
- Zoom, pan, and filter by relationship type
429
- Export subgraph as PNG or JSON
430
- Depth selector: 1-hop, 2-hop, 3-hop from any entity
431
-
432
- Evidence locker behaviour:
433
- Each claim in the dossier shows a source chip
434
- Clicking the chip opens the original source URL in a new tab
435
- Sources display: institution name, document date, credibility level
436
-
437
- Acceptance criteria:
438
- npm run build completes without errors
439
- /search returns and displays results from the API
440
- Knowledge graph renders a two-hop subgraph with labelled edges
441
- Live feed connects via WebSocket and displays real-time updates
442
-
443
- BRANCH: "feature/phase-9-frontend"
444
-
445
- PR_TITLE:
446
- "feat(frontend): Next.js dashboard with D3.js graph browser, dossier, and live feed"
447
 
 
 
448
  PR_DESCRIPTION: |
449
- Adds the complete frontend application in frontend/.
450
-
451
- frontend/pages/: Next.js pages for all seven routes.
452
- frontend/components/Graph.jsx: D3.js force-directed graph with colour coding,
453
- depth selection, zoom, pan, and export.
454
- frontend/components/Dossier.jsx: Entity profile with tabbed evidence locker
455
- and source chip components.
456
- frontend/components/RiskBadge.jsx: Colour-coded structural risk indicator.
457
- frontend/components/LiveFeed.jsx: WebSocket consumer displaying real-time
458
- intelligence headlines with click-to-expand mini reports.
459
- frontend/components/SankeyChart.jsx: D3-sankey money flow diagram for
460
- contract value flows between ministries and companies.
461
- frontend/components/GeoMap.jsx: Leaflet map showing contract and company
462
- locations plotted against constituency boundaries.
463
-
464
- Environment variable: NEXT_PUBLIC_API_URL pointing to Render backend.
465
- Deploy to Vercel by connecting the GitHub repository.
466
-
467
  Closes #ISSUE_NUMBER
468
 
469
 
470
- # ============================================================
471
- # PHASE 10 — Live Monitoring and GitHub Actions
472
- # ============================================================
473
-
474
- ISSUE_TITLE:
475
- "feat(pipeline): GitHub Actions automation, alert engine, and live feed generation"
476
-
477
- ISSUE_LABELS:
478
- ["enhancement"]
479
 
 
 
480
  ISSUE_DESCRIPTION: |
481
- Automate data collection using GitHub Actions free tier and build the
482
- alert engine that powers the live transparency feed.
483
 
484
  Files to create:
485
- .github/workflows/daily_scrape.yml Runs all scrapers at 02:00 IST daily
486
- .github/workflows/weekly_load.yml Loads new data into Neo4j weekly
487
- .github/workflows/test.yml Syntax and unit tests on every push and PR
488
- ai/alert_engine.py Diff-based alert and headline generation
489
- ai/headline_generator.py Templated NLG for intelligence headlines
490
-
491
- daily_scrape.yml behaviour:
492
- Triggers: schedule cron 0 20 * * * (02:00 IST = 20:30 UTC)
493
- Steps: checkout, setup Python, activate venv, install requirements,
494
- run pipeline with all scrapers, commit new processed JSON to a
495
- dedicated branch named data/pipeline-YYYYMMDD (not main)
496
-
497
- test.yml behaviour:
498
- Triggers: push to any branch, pull_request targeting main
499
- Steps: syntax check all Python files, run pytest tests/
500
-
501
- alert_engine.py behaviour:
502
- Loads previous pipeline output and compares against new output
503
- Detects: new CAG report mentioning an entity already in graph,
504
- new GeM contract won by a company linked to a politician,
505
- new PIB release matching a watchlisted entity
506
- Each detected event creates an alert record in Neo4j
507
-
508
- headline_generator.py behaviour:
509
- Converts alert records into neutral analytical headlines
510
- Examples:
511
- New audit report flags irregularities in a scheme linked to Ministry X
512
- Procurement order awarded to company with directorship overlap
513
- Each headline includes: text, entity links, source document, confidence level
514
-
515
- GitHub Actions secrets required (set in repository Settings > Secrets):
516
- NEO4J_URI, NEO4J_USER, NEO4J_PASSWORD, DATAGOV_API_KEY
517
-
518
- Acceptance criteria:
519
- test.yml passes on a test pull request
520
- daily_scrape.yml runs successfully in GitHub Actions environment
521
- alert_engine detects a new contract for a known entity in test data
522
- headline_generator produces a grammatically correct neutral headline
523
-
524
- BRANCH: "feature/phase-10-monitoring"
525
-
526
- PR_TITLE:
527
- "feat(pipeline): GitHub Actions automation, diff-based alerts, and headline generation"
528
-
529
  PR_DESCRIPTION: |
530
- Adds automated data collection and the live feed generation engine.
 
 
531
 
532
- .github/workflows/daily_scrape.yml: Cron job at 02:00 IST running all
533
- scrapers and committing output to a data branch.
534
 
535
- .github/workflows/weekly_load.yml: Loads latest pipeline JSON into
536
- Neo4j AuraDB production instance.
 
537
 
538
- .github/workflows/test.yml: CI check running on every push and pull
539
- request. Blocks merge if syntax check or tests fail.
 
 
 
540
 
541
- ai/alert_engine.py: Loads previous and current pipeline output, computes
542
- diff, creates Alert nodes in Neo4j for new relevant findings.
 
 
543
 
544
- ai/headline_generator.py: Template-based natural language generation
545
- converting Alert nodes into feed headlines. Enforces neutral language rules.
 
546
 
 
 
 
 
 
547
  Closes #ISSUE_NUMBER
548
 
549
 
550
- # ============================================================
551
- # PHASE 11LLM Chatbot and Dossier Export
552
- # ============================================================
553
-
554
- ISSUE_TITLE:
555
- "feat(ai): LLM chatbot interface, hypothesis testing, and PDF dossier export"
556
-
557
- ISSUE_LABELS:
558
- ["enhancement"]
559
 
 
 
560
  ISSUE_DESCRIPTION: |
561
- Add a conversational query interface and dossier export. Uses only free
562
- Hugging Face inference. No paid API calls.
563
 
564
  Files to create:
565
- ai/chatbot.py Conversational interface translating natural language
566
- queries into Neo4j Cypher and assembling responses
567
- ai/hypothesis_tester.py Evaluates whether entity A connects to entity B
568
- within a specified number of hops
569
- ai/dossier_exporter.py Generates PDF dossiers using WeasyPrint (free)
570
-
571
- chatbot.py behaviour:
572
- Input: natural language question in English or Hindi
573
- Process: intent classification, entity extraction, Cypher query generation,
574
- Neo4j execution, result assembly with citations
575
- Output: structured response with data, explanation, sources, confidence
576
- Model: use Hugging Face free inference API for intent classification
577
- Cypher generation: rule-based templates, no LLM for query construction
578
- to avoid hallucinated queries
579
-
580
- hypothesis_tester.py behaviour:
581
- Input: two entity names or IDs and a maximum hop count
582
- Process: breadth-first search in Neo4j up to specified depth
583
- Output: shortest path found (or no connection), every edge with
584
- its source document, relationship type, and confidence score
585
-
586
- dossier_exporter.py behaviour:
587
- Input: entity ID
588
- Process: assemble full dossier from graph, render to HTML template,
589
- convert to PDF using WeasyPrint
590
- Output: PDF file with cover page, risk score, timeline, relationship
591
- table, evidence locker, and source index
592
-
593
- New requirements:
594
- weasyprint>=60.0
595
- jinja2>=3.1.0
596
-
597
- Acceptance criteria:
598
- chatbot.py answers "show contracts for company X" using sample data
599
- hypothesis_tester finds a path between two connected test entities
600
- dossier_exporter generates a valid PDF for a test entity
601
-
602
- BRANCH: "feature/phase-11-chatbot"
603
-
604
- PR_TITLE:
605
- "feat(ai): LLM chatbot, hypothesis tester, and PDF dossier export"
606
-
607
- PR_DESCRIPTION: |
608
- Adds the conversational interface and document export capability.
609
 
610
- ai/chatbot.py: Intent classifier using Hugging Face zero-shot classification.
611
- Entity extractor using spaCy. Cypher generator using rule-based templates
612
- for 12 common query patterns. Response assembler citing all source documents.
613
 
614
- ai/hypothesis_tester.py: Neo4j shortest path query with configurable hop
615
- limit. Returns full path with every edge's provenance. Returns no_connection
616
- result with explanation when path exceeds limit or does not exist.
617
-
618
- ai/dossier_exporter.py: Jinja2 HTML template rendered to PDF via WeasyPrint.
619
- Dossier sections: cover, identity, risk indicator, timeline, corporate
620
- associations, contracts, audit mentions, evidence locker, source index.
621
 
 
 
 
 
 
 
622
  Closes #ISSUE_NUMBER
623
 
624
 
625
- # ============================================================
626
- # PHASE 12Geospatial Infrastructure Verification
627
- # ============================================================
628
-
629
- ISSUE_TITLE:
630
- "feat(ai): Sentinel-2 satellite verification of infrastructure project progress"
631
-
632
- ISSUE_LABELS:
633
- ["enhancement"]
634
 
 
 
635
  ISSUE_DESCRIPTION: |
636
- Use free Copernicus Sentinel-2 satellite imagery to verify whether
637
- government-funded infrastructure projects show physical progress
638
- matching their reported financial disbursement status.
639
 
640
  Files to create:
641
- ai/geospatial_verifier.py Sentinel-2 imagery retrieval and NDVI analysis
642
- scrapers/project_locator.py Extracts GPS coordinates from GeM contract data
643
-
644
- Data source:
645
- Copernicus Open Access Hub: scihub.copernicus.eu (free, registration required)
646
- Provides Sentinel-2 multispectral imagery at 10m resolution
647
- API access via sentinelsat Python library (free, open source)
648
-
649
- geospatial_verifier.py behaviour:
650
- Input: GPS coordinates and a project reference (contract ID)
651
- Process: query Sentinel-2 for two images — one before contract start date,
652
- one after final payment date
653
- Compute NDVI change detection between the two images
654
- For road projects: compute built-up area index change
655
- Output: progress_score 0-100, visual_change_detected boolean,
656
- image_urls, analysis_date, discrepancy_flag if payment complete
657
- but visual change below 30 percent
658
-
659
- project_locator.py behaviour:
660
- Input: GeM contract records
661
- Process: extract location field, geocode using Nominatim (free OSM geocoder)
662
- Output: enriched contract records with latitude, longitude fields
663
-
664
- New requirements:
665
- sentinelsat>=1.3.0
666
- rasterio>=1.3.0
667
- numpy>=1.24.0
668
-
669
- Acceptance criteria:
670
- project_locator geocodes a test address to coordinates
671
- geospatial_verifier queries Sentinel-2 API for a test location
672
- NDVI change computed for two test images
673
- discrepancy_flag triggered on test case with low visual change
674
-
675
- BRANCH: "feature/phase-12-geospatial"
676
-
677
- PR_TITLE:
678
- "feat(ai): Sentinel-2 satellite verification of infrastructure progress"
679
 
 
 
680
  PR_DESCRIPTION: |
681
- Adds geospatial verification using free Copernicus satellite data.
 
 
682
 
683
- scrapers/project_locator.py: Geocodes GeM contract location fields using
684
- the free OpenStreetMap Nominatim API. Adds lat/lon to contract nodes in
685
- the graph.
686
 
687
- ai/geospatial_verifier.py: Queries Copernicus Open Access Hub for Sentinel-2
688
- imagery before and after the contract period. Computes NDVI difference to
689
- detect vegetation and structural change. Flags discrepancy when payment is
690
- disbursed but change detection score is below threshold.
691
 
692
- New .env variable: COPERNICUS_USER and COPERNICUS_PASSWORD for the free
693
- Copernicus registration.
 
 
694
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
695
  Closes #ISSUE_NUMBER
696
 
697
 
698
- # ============================================================
699
- # PHASE 13Revolving Door and TBML Detection
700
- # ============================================================
701
-
702
- ISSUE_TITLE:
703
- "feat(ai): revolving door indicator, TBML red flags, and electoral cycle analysis"
704
-
705
- ISSUE_LABELS:
706
- ["enhancement"]
707
 
 
 
708
  ISSUE_DESCRIPTION: |
709
- Implement the Revolving Door Indicator and FATF-aligned Trade-Based Money
710
- Laundering detection using only data already in the graph.
711
 
712
  Files to create:
713
- ai/revolving_door.py Career transition analysis
714
- ai/tbml_detector.py FATF red flag indicator set
715
- ai/electoral_cycle_analyzer.py Contract timing against election calendar
716
-
717
- revolving_door.py behaviour:
718
- Detects: Person held a regulatory or ministerial role (from parliamentary
719
- records or Wikidata career data) then became a director of a company that
720
- held contracts with that same ministry during their tenure.
721
- Output per detected transition: person, previous_role, ministry,
722
- current_company, contracts_during_tenure, transition_date, indicator_score
723
-
724
- tbml_detector.py — five FATF-aligned flags:
725
- commodity_mismatch
726
- Company's registered business category does not match the contract category
727
- Example: registered as IT services, contract for road construction
728
- single_bid_contract
729
- GeM contract with only one registered bid (no competition)
730
- price_anomaly
731
- Contract value exceeds median by more than two standard deviations
732
- for the same product category and ministry
733
- rapid_director_change
734
- Company directors changed within 30 days before or after contract award
735
- subcontracting_loop
736
- Winning bidder has a known relationship with a losing bidder
737
- who subsequently received sub-contract work
738
-
739
- electoral_cycle_analyzer.py behaviour:
740
- Correlates contract award dates against Indian election calendar
741
- Flags contracts awarded in the 90-day window before a general election
742
- by a ministry whose head is a candidate in that election
743
-
744
- Acceptance criteria:
745
- revolving_door detects a transition in test data with full career timeline
746
- tbml_detector flags at least two indicators in sample GeM data
747
- electoral_cycle_analyzer flags pre-election contracts in sample data
748
- All outputs use analytical indicator language without accusations
749
-
750
- BRANCH: "feature/phase-13-revolving-door-tbml"
751
-
752
- PR_TITLE:
753
- "feat(ai): revolving door indicator, TBML detection, and electoral cycle analysis"
754
-
755
- PR_DESCRIPTION: |
756
- Adds three advanced analytical modules targeting the highest-value
757
- institutional risk patterns.
758
 
759
- ai/revolving_door.py: Queries career timeline data from Wikidata and
760
- parliamentary records against MCA director appointment dates. Identifies
761
- cases where the same person held regulatory authority over a ministry and
762
- later joined a board of a company that benefited from that ministry.
763
 
764
- ai/tbml_detector.py: Implements five FATF-aligned red flag checks using
765
- GeM contract data and MCA company records already in the graph. Each flag
766
- is scored independently and combined into a TBML risk indicator.
767
-
768
- ai/electoral_cycle_analyzer.py: Loads Indian general and state election
769
- calendar (maintained as a static JSON file updated each election cycle).
770
- Cross-references contract award dates against the 90-day pre-election window.
771
 
 
 
 
 
 
 
772
  Closes #ISSUE_NUMBER
773
 
774
 
775
- # ============================================================
776
- # PHASE 14 — Free Production Deployment
777
- # ============================================================
778
-
779
- ISSUE_TITLE:
780
- "feat(deploy): production deployment on Render, Vercel, and Neo4j AuraDB"
781
-
782
- ISSUE_LABELS:
783
- ["enhancement"]
784
 
 
 
785
  ISSUE_DESCRIPTION: |
786
- Deploy the complete platform using only free-tier services with zero
787
- monthly cost. Establish CI/CD so every pull request runs tests before
788
- merge and every merge to main redeploys automatically.
789
 
790
  Files to create:
791
- render.yaml Render.com web service configuration
792
  vercel.json Vercel deployment configuration
793
- Procfile Process specification: web: uvicorn api.main:app
794
- docs/deployment.md Step-by-step deployment guide with environment
795
- variable setup for each platform
796
-
797
- render.yaml contents:
798
- services:
799
- - type: web
800
- name: bharatgraph-api
801
- env: python
802
- buildCommand: pip install -r requirements.txt
803
- startCommand: uvicorn api.main:app --host 0.0.0.0 --port $PORT
804
- plan: free
805
- envVars: NEO4J_URI, NEO4J_USER, NEO4J_PASSWORD, DATAGOV_API_KEY
806
-
807
- GitHub Actions secrets to configure in repository settings:
808
- NEO4J_URI
809
- NEO4J_USER
810
- NEO4J_PASSWORD
811
- DATAGOV_API_KEY
812
- RENDER_DEPLOY_HOOK_URL
813
-
814
- CI/CD pipeline:
815
- Every push runs test.yml (syntax check and pytest)
816
- Every merge to main triggers automatic Render redeploy via deploy hook
817
- Every merge to main triggers automatic Vercel redeploy (automatic)
818
-
819
- Acceptance criteria:
820
- FastAPI backend accessible at Render URL with /health returning 200
821
- React frontend accessible at Vercel URL
822
- Neo4j AuraDB connected from production backend
823
- /search endpoint returns real results on production URL
824
-
825
- BRANCH: "feature/phase-14-deployment"
826
-
827
- PR_TITLE:
828
- "feat(deploy): Render backend, Vercel frontend, Neo4j AuraDB production"
829
 
830
- PR_DESCRIPTION: |
831
- Adds all deployment configuration for zero-cost production hosting.
832
 
833
- render.yaml: Web service definition with Python environment, build and
834
- start commands, and free plan selection.
835
 
836
- vercel.json: Next.js deployment with NEXT_PUBLIC_API_URL set to the
837
- Render service URL and API proxy configuration.
 
 
 
 
838
 
839
- Procfile: Web process command for Render.
840
 
841
- docs/deployment.md: Step-by-step guide covering Render account setup,
842
- Vercel project creation, Neo4j AuraDB free instance creation, GitHub
843
- Actions secrets configuration, and first deployment verification.
844
 
845
- Production URLs to be added to README after deployment.
 
 
 
 
846
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
847
  Closes #ISSUE_NUMBER
 
1
+ # BharatGraph — Complete Phase Roadmap
2
+ # GitHub Issue and Pull Request reference for phases 7 through 21
3
+ # One issue per phase. One branch per phase. All merge directly into main.
 
 
 
 
 
 
 
4
  # Branch naming: feature/phase-N-name or fix/issue-N-name
 
5
 
6
 
7
+ # ================================================================
8
+ # PHASE 7NLP Document Intelligence
9
+ # ================================================================
 
 
 
 
 
 
10
 
11
+ ISSUE_TITLE: "feat(ai): NLP pipeline — entity extraction, Benford analysis, Hindi NER"
12
+ ISSUE_LABELS: ["enhancement"]
13
  ISSUE_DESCRIPTION: |
14
+ Add NLP to extract structured intelligence from government documents.
15
+ All models are free and run locally — no paid APIs.
16
 
17
  Files to create:
18
+ ai/nlp_extractor.py spaCy English NER on CAG and PIB text
19
+ ai/benfords_analyzer.py Statistical anomaly on declared asset figures
20
+ ai/multilingual_ner.py Hindi NER via AI4Bharat IndicNER (HuggingFace)
21
+ ai/shadow_draft_detector.py Semantic similarity: bill text vs corporate submissions
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
+ benfords_analyzer.py: Chi-squared test on first-digit distribution of declared
24
+ assets in election affidavits. If figures cluster around thresholds such as
25
+ Rs 99 lakh rather than Rs 1 crore, it flags possible manipulation to stay
26
+ below disclosure triggers.
27
 
28
+ shadow_draft_detector.py: sentence-transformers cosine similarity comparing
29
+ corporate lobby submissions against bill text. Score above 65 flagged as
30
+ high semantic alignment indicating potential policy capture.
31
 
32
+ New requirements: spacy>=3.7.0, sentence-transformers>=2.6.0
 
33
 
34
+ BRANCH: "feature/phase-7-nlp"
35
+ PR_TITLE: "feat(ai): NLP pipeline — entity extraction, Benford, Hindi NER, shadow drafting"
36
+ PR_DESCRIPTION: |
37
+ Four NLP modules using only free locally-executable models.
38
+ Benford's Law catches manipulation of asset figures.
39
+ Hindi NER extends coverage to PIB Hindi releases.
40
  Closes #ISSUE_NUMBER
41
 
42
 
43
+ # ================================================================
44
+ # PHASE 8Advanced Graph Analytics
45
+ # ================================================================
 
 
 
 
 
 
46
 
47
+ ISSUE_TITLE: "feat(ai): graph analytics — centrality, community detection, circular ownership"
48
+ ISSUE_LABELS: ["enhancement"]
49
  ISSUE_DESCRIPTION: |
50
+ Structural analysis of the knowledge graph using NetworkX (free).
 
 
51
 
52
  Files to create:
53
+ ai/graph_analytics.py Betweenness centrality, PageRank, Louvain community detection
54
+ ai/circular_ownership.py Cycle detection in shareholding graph
55
+ ai/shadow_director.py De facto controllers not on formal board
56
+ ai/ghost_company.py Shell companies activated before tenders
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
+ ghost_company.py flags: registered within 90 days before first contract,
59
+ no prior CAG or SEBI mentions, single director, contract value more than
60
+ 10x paid-up capital. Results written back to Neo4j as node properties.
 
 
 
 
 
61
 
62
+ New requirement: networkx>=3.2.0
 
 
 
 
 
 
 
63
 
64
+ BRANCH: "feature/phase-8-graph-analytics"
65
+ PR_TITLE: "feat(ai): centrality, community detection, circular ownership, ghost company detector"
66
+ PR_DESCRIPTION: |
67
+ NetworkX-powered structural analysis. Results written to Neo4j.
68
+ Ghost company detector catches shell entities activated for specific tenders.
69
  Closes #ISSUE_NUMBER
70
 
71
 
72
+ # ================================================================
73
+ # PHASE 9Eight New Indian Data Sources
74
+ # ================================================================
 
 
 
 
 
 
75
 
76
+ ISSUE_TITLE: "feat(scrapers): NJDG, ED, CVC, NCRB, LGD, IBBI, NGO Darpan, CPPP"
77
+ ISSUE_LABELS: ["enhancement"]
78
  ISSUE_DESCRIPTION: |
79
+ Eight new Indian government sources. Total scrapers becomes 21.
 
80
 
81
  Files to create:
82
+ scrapers/njdg_scraper.py National Judicial Data Grid — case pendency and history
83
+ scrapers/ed_scraper.py Enforcement Directorate press releases and actions
84
+ scrapers/cvc_scraper.py Central Vigilance Commission complaint statistics
85
+ scrapers/ncrb_scraper.py NCRB Crime in India district-wise annual statistics
86
+ scrapers/lgd_scraper.py Local Government Directory 782 districts, 676,497 villages
87
+ scrapers/ibbi_scraper.py Insolvency and Bankruptcy Board corporate filings
88
+ scrapers/ngo_darpan_scraper.py NGO Darpan registered NGO and CSR recipient list
89
+ scrapers/cppp_scraper.py Central Public Procurement Portal tender awards
90
+
91
+ New graph nodes:
92
+ CourtCase, EDAction, VigilanceCase, InsolventEntity, NGO, Tender
93
+
94
+ BRANCH: "feature/phase-9-eight-sources"
95
+ PR_TITLE: "feat(scrapers): NJDG, ED, CVC, NCRB, LGD, IBBI, NGO Darpan, CPPP"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  PR_DESCRIPTION: |
97
+ 8 new scrapers: judiciary, enforcement, crime, administration,
98
+ insolvency, NGO, and procurement. Total: 21 scrapers.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  Closes #ISSUE_NUMBER
100
 
101
 
102
+ # ================================================================
103
+ # PHASE 10Multi-Investigator AI Engine
104
+ # ================================================================
 
 
 
 
 
 
105
 
106
+ ISSUE_TITLE: "feat(ai): 12-investigator parallel analysis engine with synthesis and doubt section"
107
+ ISSUE_LABELS: ["enhancement"]
108
  ISSUE_DESCRIPTION: |
109
+ The core differentiating capability. 12 specialist investigators run in
110
+ parallel, each analysing the entity from a different professional angle.
111
+ Findings are synthesised. Where 3+ investigators agree, confidence is HIGH.
112
 
113
  Files to create:
114
+ ai/investigators/financial_investigator.py Money flows, contract values, asset anomalies
115
+ ai/investigators/political_investigator.py Party funding, voting records, affiliations
116
+ ai/investigators/corporate_investigator.py Directorships, company health, compliance
117
+ ai/investigators/judicial_investigator.py Court cases, convictions, pending litigation
118
+ ai/investigators/procurement_investigator.py Contract patterns, bid behaviour
119
+ ai/investigators/network_investigator.py Graph centrality, community membership
120
+ ai/investigators/asset_investigator.py Declared vs probable assets, growth
121
+ ai/investigators/international_investigator.py Offshore entities, sanctions, ICIJ
122
+ ai/investigators/media_investigator.py PIB mentions, press release patterns
123
+ ai/investigators/historical_investigator.py Timeline reconstruction over time
124
+ ai/investigators/public_interest_investigator.py Scheme data, development indicators
125
+ ai/investigators/doubt_investigator.py Unexplained anomalies, hypotheses
126
+ ai/multi_investigator.py Parallel runner and synthesis
127
+
128
+ Output per report:
129
+ entity_biography: full public life timeline from all sources
130
+ agreed_findings: patterns confirmed by 3 or more investigators
131
+ individual_findings: all findings by source investigator
132
+ doubts: suspicious patterns that cannot be confirmed, stated as hypotheses
133
+ positive_contributions: good governance actions found (balanced view)
134
+ unique_report_hash: SHA-256 of entity_id + data snapshot timestamp
135
+ evidence_locker: all source documents across all findings
136
+
137
+ Language rules: structural indicator, governance anomaly, pattern.
138
+ Never: corrupt, guilty, criminal, fraud, suspect.
139
+
140
+ BRANCH: "feature/phase-10-multi-investigator"
141
+ PR_TITLE: "feat(ai): 12-investigator parallel engine with synthesis, doubts, and unique hash"
 
 
 
 
 
 
 
 
 
 
142
  PR_DESCRIPTION: |
143
+ The core intelligence layer. 12 specialised investigators run concurrently.
144
+ Synthesis identifies agreed patterns and raises confidence.
145
+ Doubt section surfaces unexplained anomalies as investigative hypotheses.
146
+ Every report has a unique SHA-256 hash for integrity verification.
147
+ Closes #ISSUE_NUMBER
148
 
 
 
 
149
 
150
+ # ================================================================
151
+ # PHASE 11 Multilingual Platform (22 Indian Languages)
152
+ # ================================================================
153
 
154
+ ISSUE_TITLE: "feat(ai): multilingual support for all 22 Indian scheduled languages"
155
+ ISSUE_LABELS: ["enhancement"]
156
+ ISSUE_DESCRIPTION: |
157
+ Every citizen regardless of language can query and read reports.
158
 
159
+ Files to create:
160
+ ai/translator.py Language detection and translation via IndicTrans2
161
+ ai/transliteration.py Roman to Devanagari, Tamil, Telugu scripts etc.
162
+ api/routes/multilingual.py Language-aware endpoints with ?lang= parameter
163
+ config/languages.py ISO codes for all 22 scheduled languages
164
 
165
+ Uses AI4Bharat IndicTrans2 (free HuggingFace model, runs locally).
166
+ Supports: hi, ta, te, kn, ml, mr, bn, gu, pa, or, as, ur, sd, kok,
167
+ mai, mni, sat, ks, ne, bho, doi, sa
168
 
169
+ Name transliteration ensures search works across scripts:
170
+ "Modi" = "मोदी" = "மோடி" = "మోదీ" all resolve to the same entity.
171
 
172
+ All 14 dossier sections translated. Risk explanations in native language.
173
 
174
+ BRANCH: "feature/phase-11-multilingual"
175
+ PR_TITLE: "feat(ai): multilingual support 22 Indian languages via IndicTrans2"
176
+ PR_DESCRIPTION: |
177
+ Every citizen can now use the platform in their native language.
178
+ AI4Bharat IndicTrans2 runs locally at no cost.
179
+ Transliteration ensures consistent entity matching across scripts.
180
+ Closes #ISSUE_NUMBER
181
 
 
 
182
 
183
+ # ================================================================
184
+ # PHASE 12 — PDF Dossier Generator
185
+ # ================================================================
186
 
187
+ ISSUE_TITLE: "feat(ai): PDF dossier generator with SHA-256 integrity hash per report"
188
+ ISSUE_LABELS: ["enhancement"]
189
  ISSUE_DESCRIPTION: |
190
+ Professional PDF investigation dossiers submittable to courts and journalists.
 
191
 
192
  Files to create:
193
+ ai/dossier_generator.py 14-section PDF assembly
194
+ ai/report_hasher.py SHA-256 hash per report
195
+ templates/dossier_en.html English Jinja2 template
196
+ templates/dossier_hi.html Hindi template
197
+ api/routes/export.py GET /export/pdf/{entity_id}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
 
199
+ 14 sections: Cover, Identity, Career Timeline, Corporate Associations,
200
+ Government Contracts, Audit Mentions, Court Records, International
201
+ Connections, Asset Declarations, Risk Summary, Analytical Findings,
202
+ Doubts and Unexplained Patterns, Positive Contributions, Evidence Locker.
203
 
204
+ Hash printed on cover page. Stored in Neo4j for future verification.
205
+ GET /verify/{hash} confirms a report has not been tampered with.
 
206
 
207
+ New requirements: weasyprint>=60.0, jinja2>=3.1.0
 
 
208
 
209
+ BRANCH: "feature/phase-12-pdf-dossier"
210
+ PR_TITLE: "feat(ai): PDF dossier generator 14 sections, SHA-256 hash, multilingual templates"
211
+ PR_DESCRIPTION: |
212
+ Court-grade PDF dossiers with unique integrity hash.
213
+ 14-section structure covering every analytical dimension.
214
+ Verify endpoint allows anyone to confirm report authenticity.
215
+ Closes #ISSUE_NUMBER
216
 
 
 
 
217
 
218
+ # ================================================================
219
+ # PHASE 13 — React Frontend with Patriotic Design
220
+ # ================================================================
221
 
222
+ ISSUE_TITLE: "feat(frontend): patriotic React dashboard with dark/light theme and D3.js graph"
223
+ ISSUE_LABELS: ["enhancement"]
224
+ ISSUE_DESCRIPTION: |
225
+ Complete frontend. Patriotic Indian design. Dark and light themes.
226
+ Deployed free on Vercel.
227
 
228
+ Technology: Next.js 14, TypeScript, Tailwind CSS, D3.js, Leaflet, Recharts.
 
 
229
 
230
+ Design system:
231
+ Colour palette: saffron (#FF9933), white (#FFFFFF), India green (#138808),
232
+ Ashoka blue (#000080) as accent.
233
+ Dark theme: deep navy background (#0A0F2E), saffron and white typography.
234
+ Light theme: white background, deep green accents, saffron highlights.
235
+ No gradients, no decorative clutter, every element is functional.
236
+ WCAG AA contrast ratios throughout.
237
 
238
+ Pages: /, /search, /entity/[id], /risk-dashboard, /graph-explorer,
239
+ /live-feed, /watchlist, /report/[id], /about, /verify/[hash]
240
 
241
+ Graph nodes coloured by type:
242
+ Politician: saffron | Company: India green | Contract: Ashoka blue
243
+ AuditReport: red | Ministry: navy | PressRelease: grey
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
 
245
+ BRANCH: "feature/phase-13-frontend"
246
+ PR_TITLE: "feat(frontend): patriotic React dashboard — Indian tricolour design system"
247
  PR_DESCRIPTION: |
248
+ Professional patriotic design using Indian tricolour palette.
249
+ Dark navy and saffron dark mode. Clean white light mode.
250
+ D3.js graph, Leaflet map, Sankey diagrams, full PDF download.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  Closes #ISSUE_NUMBER
252
 
253
 
254
+ # ================================================================
255
+ # PHASE 14 — Live Monitoring and GitHub Actions
256
+ # ================================================================
 
 
 
 
 
 
257
 
258
+ ISSUE_TITLE: "feat(pipeline): GitHub Actions automation, alert engine, live feed generation"
259
+ ISSUE_LABELS: ["enhancement"]
260
  ISSUE_DESCRIPTION: |
261
+ Automate all data collection using GitHub Actions free 2,000 min/month.
 
262
 
263
  Files to create:
264
+ .github/workflows/daily_scrape.yml 02:00 IST daily
265
+ .github/workflows/weekly_load.yml Neo4j refresh
266
+ .github/workflows/test.yml CI on every push and PR
267
+ ai/alert_engine.py Diff-based alerts
268
+ ai/headline_generator.py Neutral NLG for live feed
269
+
270
+ alert_engine.py detects: new CAG report mentioning known entity,
271
+ new contract for company linked to politician, new ED action,
272
+ new court filing. Each alert generates a live feed headline.
273
+
274
+ BRANCH: "feature/phase-14-monitoring"
275
+ PR_TITLE: "feat(pipeline): GitHub Actions automation, diff alerts, live feed headlines"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  PR_DESCRIPTION: |
277
+ Automated daily scraping, weekly Neo4j refresh, CI tests on every PR.
278
+ Alert engine generates neutral analytical headlines for the live feed.
279
+ Closes #ISSUE_NUMBER
280
 
 
 
281
 
282
+ # ================================================================
283
+ # PHASE 15 — LLM Chatbot and Hypothesis Testing
284
+ # ================================================================
285
 
286
+ ISSUE_TITLE: "feat(ai): multilingual chatbot with multi-hop hypothesis testing"
287
+ ISSUE_LABELS: ["enhancement"]
288
+ ISSUE_DESCRIPTION: |
289
+ Conversational interface to the knowledge graph. Free Hugging Face only.
290
+ Supports all 22 Indian languages via Phase 11 translator.
291
 
292
+ Files to create:
293
+ ai/chatbot.py Intent classification and Cypher template generation
294
+ ai/hypothesis_tester.py Multi-hop connection tester between two entities
295
+ api/routes/chat.py POST /chat endpoint
296
 
297
+ hypothesis_tester.py: finds shortest path between any two entities in the
298
+ graph up to 5 hops. Returns full path with every edge's source document.
299
+ Useful for journalists testing specific investigative theories.
300
 
301
+ BRANCH: "feature/phase-15-chatbot"
302
+ PR_TITLE: "feat(ai): multilingual chatbot with Cypher generation and hypothesis testing"
303
+ PR_DESCRIPTION: |
304
+ Conversational interface in all 22 Indian languages.
305
+ Rule-based Cypher generation prevents hallucinated graph queries.
306
  Closes #ISSUE_NUMBER
307
 
308
 
309
+ # ================================================================
310
+ # PHASE 16Geospatial Infrastructure Verification
311
+ # ================================================================
 
 
 
 
 
 
312
 
313
+ ISSUE_TITLE: "feat(ai): Sentinel-2 satellite verification of infrastructure progress"
314
+ ISSUE_LABELS: ["enhancement"]
315
  ISSUE_DESCRIPTION: |
316
+ Verify physical construction progress using free Copernicus satellite data.
 
317
 
318
  Files to create:
319
+ ai/geospatial_verifier.py NDVI change detection on Sentinel-2
320
+ scrapers/project_locator.py GPS geocoding of GeM contract locations
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
 
322
+ Flags discrepancy when final payment is disbursed but satellite imagery
323
+ shows less than 30 percent visual change at the contract location.
 
324
 
325
+ New .env variables: COPERNICUS_USER, COPERNICUS_PASSWORD
326
+ New requirements: sentinelsat>=1.3.0, rasterio>=1.3.0, numpy>=1.24.0
 
 
 
 
 
327
 
328
+ BRANCH: "feature/phase-16-geospatial"
329
+ PR_TITLE: "feat(ai): Sentinel-2 satellite verification of infrastructure progress"
330
+ PR_DESCRIPTION: |
331
+ Free Copernicus satellite data objectively verifies project progress.
332
+ Progress discrepancy flag triggers when payment is complete but
333
+ satellite evidence shows limited physical change.
334
  Closes #ISSUE_NUMBER
335
 
336
 
337
+ # ================================================================
338
+ # PHASE 17Revolving Door and TBML Detection
339
+ # ================================================================
 
 
 
 
 
 
340
 
341
+ ISSUE_TITLE: "feat(ai): revolving door indicator, TBML red flags, electoral cycle analysis"
342
+ ISSUE_LABELS: ["enhancement"]
343
  ISSUE_DESCRIPTION: |
344
+ Three advanced institutional risk pattern detectors using existing graph data.
 
 
345
 
346
  Files to create:
347
+ ai/revolving_door.py Career regulatory-to-private transition analysis
348
+ ai/tbml_detector.py Five FATF Trade-Based Money Laundering flags
349
+ ai/electoral_cycle_analyzer.py Contract timing vs election calendar
350
+
351
+ TBML flags: commodity_mismatch, single_bid_contract, price_anomaly,
352
+ rapid_director_change, subcontracting_loop.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
 
354
+ BRANCH: "feature/phase-17-revolving-door"
355
+ PR_TITLE: "feat(ai): revolving door, TBML detection, electoral cycle analysis"
356
  PR_DESCRIPTION: |
357
+ Three advanced corruption pattern detectors using data already in graph.
358
+ FATF-aligned TBML flags cover five distinct laundering patterns.
359
+ Closes #ISSUE_NUMBER
360
 
 
 
 
361
 
362
+ # ================================================================
363
+ # PHASE 18 Security Hardening
364
+ # ================================================================
 
365
 
366
+ ISSUE_TITLE: "feat(security): rate limiting, DDoS protection, input validation, audit chain"
367
+ ISSUE_LABELS: ["enhancement", "security"]
368
+ ISSUE_DESCRIPTION: |
369
+ Industry-grade security for a long-running public transparency platform.
370
 
371
+ Files to create:
372
+ api/middleware/rate_limiter.py Sliding window per IP
373
+ api/middleware/input_validator.py Strict sanitisation, no Cypher injection
374
+ api/middleware/security_headers.py CSP, HSTS, X-Frame-Options
375
+ api/middleware/audit_logger.py Immutable append-only request log
376
+ blockchain/audit_chain.py SHA-256 hash chain on audit log
377
+ docs/security_architecture.md Threat model and incident response
378
+
379
+ rate_limiter.py: 100 req/min for search, 10 req/min for PDF export.
380
+ audit_chain.py: each log entry includes hash of previous entry.
381
+ Daily root hash stored in Neo4j. Optional public anchor available.
382
+
383
+ BRANCH: "feature/phase-18-security"
384
+ PR_TITLE: "feat(security): rate limiting, input validation, security headers, tamper-evident audit log"
385
+ PR_DESCRIPTION: |
386
+ Production-grade security hardening. Rate limiting prevents DDoS.
387
+ Parameterised queries prevent injection. Hash-chained audit log
388
+ provides tamper evidence for all platform activity.
389
  Closes #ISSUE_NUMBER
390
 
391
 
392
+ # ================================================================
393
+ # PHASE 19Self-Learning System
394
+ # ================================================================
 
 
 
 
 
 
395
 
396
+ ISSUE_TITLE: "feat(ai): self-learning system — schema adaptation, pattern discovery, health monitoring"
397
+ ISSUE_LABELS: ["enhancement"]
398
  ISSUE_DESCRIPTION: |
399
+ Platform improves itself as data grows and new fraud patterns emerge.
400
+ All automatic changes require human review before taking effect.
401
 
402
  Files to create:
403
+ ai/schema_learner.py Detects new entity types in incoming data
404
+ ai/pattern_learner.py Identifies candidate structural patterns weekly
405
+ ai/source_discoverer.py Monitors data.gov.in for new published datasets
406
+ ai/weight_optimizer.py Adjusts indicator weights based on confirmed outcomes
407
+ ai/self_audit.py Weekly health check of all 21 scrapers
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
 
409
+ source_discoverer.py checks weekly for new government datasets and
410
+ creates draft scraper templates for human review and approval.
 
 
411
 
412
+ weight_optimizer.py: when court conviction or ED chargesheet confirms
413
+ a pattern, back-traces which indicators predicted it and adjusts weights.
 
 
 
 
 
414
 
415
+ BRANCH: "feature/phase-19-self-learning"
416
+ PR_TITLE: "feat(ai): self-learning system — schema adaptation, pattern discovery, weight optimisation"
417
+ PR_DESCRIPTION: |
418
+ Platform adapts to new data sources and confirmed outcomes.
419
+ All automatic changes gated by human review.
420
+ Weekly self-audit ensures all scrapers remain operational.
421
  Closes #ISSUE_NUMBER
422
 
423
 
424
+ # ================================================================
425
+ # PHASE 20 — Free Production Deployment
426
+ # ================================================================
 
 
 
 
 
 
427
 
428
+ ISSUE_TITLE: "feat(deploy): zero-cost production deployment — Render, Vercel, Neo4j AuraDB"
429
+ ISSUE_LABELS: ["enhancement"]
430
  ISSUE_DESCRIPTION: |
431
+ Full production deployment at zero monthly cost.
 
 
432
 
433
  Files to create:
434
+ render.yaml Render.com web service definition
435
  vercel.json Vercel deployment configuration
436
+ Procfile uvicorn process definition
437
+ docs/deployment.md Step-by-step deployment guide
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
 
439
+ UptimeRobot free tier monitors /health every 5 minutes and keeps
440
+ the Render free tier awake with periodic pings.
441
 
442
+ GitHub Actions deploy hook triggers Render redeploy on every
443
+ merge to main.
444
 
445
+ BRANCH: "feature/phase-20-deployment"
446
+ PR_TITLE: "feat(deploy): Render backend, Vercel frontend, Neo4j AuraDB, UptimeRobot monitoring"
447
+ PR_DESCRIPTION: |
448
+ Zero-cost production deployment. All environment variables in
449
+ Render and Vercel dashboards. UptimeRobot keeps free tier awake.
450
+ Closes #ISSUE_NUMBER
451
 
 
452
 
453
+ # ================================================================
454
+ # PHASE 21 Court and Law Enforcement Intelligence Pack
455
+ # ================================================================
456
 
457
+ ISSUE_TITLE: "feat(ai): court-grade intelligence pack for law enforcement and judicial use"
458
+ ISSUE_LABELS: ["enhancement"]
459
+ ISSUE_DESCRIPTION: |
460
+ Professional-grade investigation outputs suitable for courts, police,
461
+ CBI, ED, CVC, and parliamentary committees.
462
 
463
+ Files to create:
464
+ ai/case_builder.py Structured case file assembly
465
+ ai/evidence_chain.py Formal evidence chain with legal citations
466
+ ai/crime_classifier.py Maps findings to IPC, PCA, PMLA sections
467
+ ai/timeline_reconstructor.py Forensic chronological event mapping
468
+ api/routes/legal_export.py GET /legal/case-file/{entity_id}
469
+
470
+ crime_classifier.py maps structural patterns to potentially relevant
471
+ legal sections using neutral language: "pattern may be relevant to
472
+ section X" — never asserts guilt. Sections: IPC 420/409, PCA 13,
473
+ PMLA 3/4, FEMA, Companies Act 2013.
474
+
475
+ timeline_reconstructor.py builds forensic timeline combining all
476
+ data sources: registrations, contracts, asset declarations, audit
477
+ filings, court cases, ED actions, electoral bonds.
478
+
479
+ legal_export.py produces: PDF case file + JSON + evidence index.
480
+ Unique case file hash. Methodology note for court admissibility.
481
+
482
+ BRANCH: "feature/phase-21-court-intelligence"
483
+ PR_TITLE: "feat(ai): court and law enforcement intelligence pack with formal evidence chain"
484
+ PR_DESCRIPTION: |
485
+ Professional investigation outputs for courts, police, CBI, ED, CVC.
486
+ Formal evidence chain, crime section mapping, forensic timeline.
487
+ Never asserts guilt — provides structured analytical framework only.
488
  Closes #ISSUE_NUMBER