Spaces:
Running
Running
Commit ยท
971fa6c
1
Parent(s): 06b8c70
feat: initial project structure, config, gitignore, requirements and README
Browse files- .env.example +10 -0
- .gitignore +39 -0
- README.md +58 -2
- config/settings.py +43 -0
- data/processed/.gitkeep +0 -0
- data/raw/.gitkeep +0 -0
- data/samples/.gitkeep +0 -0
- logs/.gitkeep +0 -0
.env.example
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copy this file to .env and fill in your values
|
| 2 |
+
# NEVER commit .env to GitHub
|
| 3 |
+
|
| 4 |
+
NEO4J_URI=bolt://localhost:7687
|
| 5 |
+
NEO4J_USER=neo4j
|
| 6 |
+
NEO4J_PASSWORD=your_password_here
|
| 7 |
+
|
| 8 |
+
NEWSAPI_KEY=your_newsapi_key_here
|
| 9 |
+
DATAGOV_API_KEY=579b464db66ec23d9960025070515804
|
| 10 |
+
OPENAI_API_KEY=your_openai_key_here
|
.gitignore
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*.egg-info/
|
| 5 |
+
dist/
|
| 6 |
+
build/
|
| 7 |
+
.eggs/
|
| 8 |
+
*.egg
|
| 9 |
+
|
| 10 |
+
# Virtual Environment
|
| 11 |
+
venv/
|
| 12 |
+
env/
|
| 13 |
+
.env
|
| 14 |
+
.venv/
|
| 15 |
+
|
| 16 |
+
# Secrets
|
| 17 |
+
*.env
|
| 18 |
+
config/secrets.py
|
| 19 |
+
config/.env
|
| 20 |
+
|
| 21 |
+
# Data files (large)
|
| 22 |
+
data/raw/*.csv
|
| 23 |
+
data/raw/*.json
|
| 24 |
+
data/raw/*.pdf
|
| 25 |
+
data/processed/*.csv
|
| 26 |
+
|
| 27 |
+
# Logs
|
| 28 |
+
logs/*.log
|
| 29 |
+
|
| 30 |
+
# IDE
|
| 31 |
+
.vscode/settings.json
|
| 32 |
+
.idea/
|
| 33 |
+
*.DS_Store
|
| 34 |
+
|
| 35 |
+
# Neo4j
|
| 36 |
+
neo4j/data/
|
| 37 |
+
|
| 38 |
+
# Node
|
| 39 |
+
node_modules/
|
README.md
CHANGED
|
@@ -1,2 +1,58 @@
|
|
| 1 |
-
#
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ๐ฎ๐ณ BharatGraph
|
| 2 |
+
|
| 3 |
+
**AI-powered Public Transparency & Relationship Mapping Platform for India**
|
| 4 |
+
|
| 5 |
+
> A civic-tech platform that aggregates public government data, maps relationships
|
| 6 |
+
> between politicians, companies and contracts using graph AI, and generates
|
| 7 |
+
> evidence-backed risk scores โ helping journalists and citizens hold power accountable.
|
| 8 |
+
|
| 9 |
+
## โ ๏ธ Legal Disclaimer
|
| 10 |
+
This platform uses ONLY publicly available government data (MyNeta, data.gov.in, MCA,
|
| 11 |
+
GeM, court records, official press releases). It provides statistical relationship
|
| 12 |
+
analysis and risk scores โ NOT accusations. All claims link to original source documents.
|
| 13 |
+
|
| 14 |
+
## ๐๏ธ Project Structure
|
| 15 |
+
```
|
| 16 |
+
bharatgraph/
|
| 17 |
+
โโโ scrapers/ # Data collection scripts
|
| 18 |
+
โโโ processing/ # Data cleaning & entity resolution
|
| 19 |
+
โโโ graph/ # Neo4j graph database logic
|
| 20 |
+
โโโ ai/ # Risk scoring & anomaly detection
|
| 21 |
+
โโโ api/ # FastAPI backend
|
| 22 |
+
โโโ frontend/ # React dashboard
|
| 23 |
+
โโโ blockchain/ # Audit logging
|
| 24 |
+
โโโ data/ # Raw and processed data
|
| 25 |
+
โโโ docs/ # Documentation
|
| 26 |
+
โโโ tests/ # Test files
|
| 27 |
+
โโโ config/ # Configuration
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## ๐ Data Sources
|
| 31 |
+
- Election Commission / MyNeta โ candidate affidavits
|
| 32 |
+
- data.gov.in โ government open datasets
|
| 33 |
+
- MCA21 โ company directors
|
| 34 |
+
- GeM โ procurement contracts
|
| 35 |
+
- PIB / e-Gazette โ official announcements
|
| 36 |
+
- CAG reports, court judgments, ADR, PRS
|
| 37 |
+
|
| 38 |
+
## ๐ Quick Start
|
| 39 |
+
```bash
|
| 40 |
+
git clone https://github.com/YOUR_USERNAME/bharatgraph.git
|
| 41 |
+
cd bharatgraph
|
| 42 |
+
pip install -r requirements.txt
|
| 43 |
+
cp .env.example .env
|
| 44 |
+
# edit .env with your keys
|
| 45 |
+
python scrapers/datagov_scraper.py
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
## ๐
Development Phases
|
| 49 |
+
- Phase 1 (Days 1โ30): Data collection & graph setup
|
| 50 |
+
- Phase 2 (Days 31โ60): AI risk scoring
|
| 51 |
+
- Phase 3 (Days 61โ90): Dashboard & API
|
| 52 |
+
- Phase 4 (Days 91โ120): Live monitoring & deployment
|
| 53 |
+
|
| 54 |
+
## ๐ค Contributing
|
| 55 |
+
Open source. PRs welcome. See docs/CONTRIBUTING.md
|
| 56 |
+
|
| 57 |
+
## ๐ License
|
| 58 |
+
MIT License
|
config/settings.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from dotenv import load_dotenv
|
| 3 |
+
|
| 4 |
+
load_dotenv()
|
| 5 |
+
|
| 6 |
+
# Project Info
|
| 7 |
+
PROJECT_NAME = "BharatGraph"
|
| 8 |
+
VERSION = "0.1.0"
|
| 9 |
+
DESCRIPTION = "AI-powered public transparency platform for India"
|
| 10 |
+
|
| 11 |
+
# Database
|
| 12 |
+
NEO4J_URI = os.getenv("NEO4J_URI", "bolt://localhost:7687")
|
| 13 |
+
NEO4J_USER = os.getenv("NEO4J_USER", "neo4j")
|
| 14 |
+
NEO4J_PASSWORD = os.getenv("NEO4J_PASSWORD", "password")
|
| 15 |
+
|
| 16 |
+
# API Keys (free ones)
|
| 17 |
+
NEWSAPI_KEY = os.getenv("NEWSAPI_KEY", "")
|
| 18 |
+
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "")
|
| 19 |
+
|
| 20 |
+
# Scraper settings
|
| 21 |
+
DEFAULT_DELAY = 2.0 # seconds between requests (be polite)
|
| 22 |
+
MAX_RETRIES = 3
|
| 23 |
+
REQUEST_TIMEOUT = 30
|
| 24 |
+
|
| 25 |
+
# Data paths
|
| 26 |
+
DATA_RAW_PATH = "data/raw/"
|
| 27 |
+
DATA_PROCESSED_PATH = "data/processed/"
|
| 28 |
+
DATA_SAMPLES_PATH = "data/samples/"
|
| 29 |
+
LOGS_PATH = "logs/"
|
| 30 |
+
|
| 31 |
+
# Data Sources URLs
|
| 32 |
+
DATAGOV_BASE_URL = "https://api.data.gov.in/resource/"
|
| 33 |
+
DATAGOV_API_KEY = os.getenv("DATAGOV_API_KEY", "579b464db66ec23d9960025070515804")
|
| 34 |
+
PIB_RSS_URL = "https://pib.gov.in/RssMain.aspx?ModId=6&Lang=1&Regid=3"
|
| 35 |
+
MYNETA_BASE_URL = "https://myneta.info"
|
| 36 |
+
MCA_BASE_URL = "https://www.mca.gov.in"
|
| 37 |
+
GEM_BASE_URL = "https://mkp.gem.gov.in"
|
| 38 |
+
LOKSABHA_URL = "https://loksabha.nic.in"
|
| 39 |
+
RAJYASABHA_URL = "https://rajyasabha.nic.in"
|
| 40 |
+
ECOURTS_URL = "https://judgments.ecourts.gov.in"
|
| 41 |
+
PRS_URL = "https://prsindia.org"
|
| 42 |
+
CAG_URL = "https://cag.gov.in"
|
| 43 |
+
ADR_URL = "https://adrindia.org"
|
data/processed/.gitkeep
ADDED
|
File without changes
|
data/raw/.gitkeep
ADDED
|
File without changes
|
data/samples/.gitkeep
ADDED
|
File without changes
|
logs/.gitkeep
ADDED
|
File without changes
|