Spaces:
Build error
Build error
Commit History
-
feat(phase-33): add 4 graph analytics endpoints to api/routes/graph.py
GET /graph/analytics/{entity_id} -- betweenness + pagerank + communities for an entity local sub-graph GET /graph/centrality/betweenness -- top 20 brokers in full graph GET /graph/centrality/pagerank -- top 20 influential entities in full graph GET /graph/communities -- detect institutional clusters All 4 endpoints use the pre-built GraphAnalytics class (ai/graph_analytics.py) which uses NetworkX under the hood. Graceful ImportError if networkx not installed -- returns {status: error} instead of 500.5ac9ba3
-
fix(BUG-1): use str(depth_safe) literal in Cypher path pattern -- Neo4j rejects parameters in *min..max
391b602
-
fix(api+graph+pipeline): M-04+M-05+M-08+M-09 -- misc medium fixes
M-04: /debug/env endpoint was publicly accessible with no auth gate. It revealed NEO4J_URI prefix and credential configuration status. Fix: added same DEBUG_MODE env-var gate as /debug/neo4j. M-05: Wikidata enrichment used exact name match (=) -- any difference in spacing, middle name, honorific, or transliteration caused a silent miss. With Indian names this is extremely common. Fix: changed to CONTAINS match in both directions for fuzzy matching. M-08: --parallel flag had action='store_true', default=True making it always True whether passed or not. The flag had zero effect. Confusing for operators who expected --parallel to mean something. Fix: removed --parallel; --sequential now inverts the default. M-09: startNode(rel).id and endNode(rel).id in Cypher can return null if a node has no 'id' property. This created edges with null source/target silently corrupting graph output. Fix: added isinstance str check to filter null src/tgt before appending.5d9b8a9 -
fix(api+ai): M-01+M-02+M-03 -- version consistency and duplicate assignments
M-01: Three different version strings for the same release: FastAPI app = 0.31.0, root() endpoint = 0.30.0, settings.py = 0.30.0 Fix: settings.py VERSION -> 0.31.0, main.py root() -> 0.31.0. M-02: entity_label = 'Unknown' was written on two consecutive lines in deep_investigator.py (copy-paste residue from the BUG-1+7 fix). Fix: kept one assignment with a clean comment. M-03: _edge_seen = set() was declared twice on consecutive lines in graph.py (same copy-paste residue). Fix: kept one declaration. Also fixed graph.py GraphResponse(depth=depth) -> depth=depth_safe so the response reflects the actual queried depth, not the raw user input.01cf12a
-
fix(encoding): strip non-ASCII chars from all modified files
All files contained UTF-8 punctuation (em dashes U+2014, arrows U+2192, curly quotes) in comments which cause UnicodeDecodeError on GitHub Actions runners that read files without explicit encoding= argument. Replaced all non-ASCII punctuation with ASCII equivalents: U+2014 em dash -> -- U+2192 arrow -> -> curly quotes -> straight quotes747e613 -
fix(api): BUG-10 -- deduplicate graph edges before sending to frontend
With depth=2, Neo4j returns many paths sharing intermediate edges. Each shared edge appeared in multiple row[rels] arrays and was appended to a plain list unconditionally. D3 force simulation received duplicate links creating visual double/triple edges and distorting the force calculation (artificially stronger pull). Fix: track seen (src, tgt, type) tuples in _edge_seen set and skip duplicates.719142b -
fix(api): BUG-10 -- deduplicate graph edges before sending to frontend
With depth=2, Neo4j returns many paths sharing intermediate edges. Each shared edge appeared in multiple row[rels] arrays and was appended to a plain list unconditionally. D3 force simulation received duplicate links creating visual double/triple edges and distorting the force calculation (artificially stronger pull). Fix: track seen (src, tgt, type) tuples in _edge_seen set and skip duplicates.7beb5e9
-
fix(BUG-09): depth via Cypher param not f-string; use explicit node/rel RETURN
d85d91e
-
fix(search+graph+frontend): 6 issues resolved
- search.py: expanded from 3 to 8 searchable labels (Politician, Company, AuditReport, Contract, Ministry, Party, Scheme, PressRelease) accepts both ?type= and ?entity_type= query params searches aliases, CIN, buyer_org, item_desc — not just name field passes lang param through to multilingual route - graph.py: always loads anchor node first graph page never empty even with zero relationships - index.html: BHARATGRAPH_API_URL auto-detected localhost:8000 when developing, HF Space when deployed - api.js: search() accepts lang param, passes to backend - app.js: language selector now wires into search non-English queries call Api.multilingualSearch() filter type correctly lowercased before sending584f813
-
feat(api): FastAPI backend with entity search, dossier, graph, and risk endpoints
- api/main.py: FastAPI app, CORS, lifespan managing Neo4j driver, health and stats endpoints, WebSocket feed skeleton - api/models.py: typed Pydantic models with source citations on all responses - api/dependencies.py: shared Neo4j driver with clean error handling - api/routes/search.py: entity search across Politician, Company, AuditReport nodes - api/routes/profile.py: full dossier assembly with contracts and audit sections - api/routes/graph.py: multi-hop traversal and politician-contracts pattern query - api/routes/risk.py: composite structural risk indicator with four factors, neutral analytical language enforced throughout5949a90