Spaces:
Configuration error
Configuration error
Upload 35 files
Browse files- Dockerfile +13 -13
- README.md +146 -8
- config/.env.example +3 -0
- config/__pycache__/settings.cpython-314.pyc +0 -0
- config/esg_column_schema.json +0 -0
- config/settings.py +8 -0
- models/train.py +3 -16
- outputs/TECH001/TECH001_agent1_operational_output.csv +11 -0
- outputs/TECH001/TECH001_agent2_financial_output.csv +11 -0
- outputs/TECH001/TECH001_agent3_compliance_output.csv +11 -0
- outputs/TECH001/TECH001_agent4_final_output.csv +11 -0
- outputs/TECH001_master.csv +11 -0
- requirements.txt +5 -0
Dockerfile
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
-
FROM python:3.11-slim
|
| 2 |
-
|
| 3 |
-
WORKDIR /app
|
| 4 |
-
|
| 5 |
-
COPY requirements.txt .
|
| 6 |
-
|
| 7 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 8 |
-
|
| 9 |
-
COPY . .
|
| 10 |
-
|
| 11 |
-
EXPOSE 7860
|
| 12 |
-
|
| 13 |
-
CMD ["uvicorn", "API.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
COPY requirements.txt .
|
| 6 |
+
|
| 7 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 8 |
+
|
| 9 |
+
COPY . .
|
| 10 |
+
|
| 11 |
+
EXPOSE 7860
|
| 12 |
+
|
| 13 |
+
CMD ["uvicorn", "API.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
README.md
CHANGED
|
@@ -1,10 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
-
title: ESG Monitoring System
|
| 3 |
-
emoji: 📚
|
| 4 |
-
colorFrom: indigo
|
| 5 |
-
colorTo: gray
|
| 6 |
-
sdk: docker
|
| 7 |
-
pinned: false
|
| 8 |
-
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🌱 Intelligent ESG Scoring System for Enterprise Decision-Making
|
| 2 |
+
|
| 3 |
+
An AI-driven, multi-agent ESG intelligence platform that enables real-time ESG monitoring, predictive risk scoring, and automated regulatory compliance for enterprises.
|
| 4 |
+
|
| 5 |
+
Built for HackAvensis26 under the Artificial Intelligence & Machine Learning track.
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## 📌 Project Overview
|
| 10 |
+
|
| 11 |
+
Enterprises today face major challenges with manual ESG reporting, delayed insights, and rapidly changing regulations. This project introduces a real-time, explainable, and scalable ESG scoring system powered by AI-driven multi-agent architecture.
|
| 12 |
+
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
## 🎯 Problem Statement
|
| 16 |
+
|
| 17 |
+
- ESG compliance is managed through manual and delayed reporting
|
| 18 |
+
- Corporates lack real-time visibility into ESG risks
|
| 19 |
+
- Regulatory frameworks are complex and frequently changing
|
| 20 |
+
- Late detection leads to penalties, reputational damage, and loss of trust
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## ✅ Objectives
|
| 25 |
+
|
| 26 |
+
- Enable real-time ESG monitoring
|
| 27 |
+
- Provide explainable ESG insights
|
| 28 |
+
- Predict ESG risks before escalation
|
| 29 |
+
- Automate regulatory compliance checks
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## 💡 Proposed Solution
|
| 34 |
+
|
| 35 |
+
### AI-Driven Multi-Agent ESG Intelligence Platform
|
| 36 |
+
|
| 37 |
+
The platform consists of specialized agents, each responsible for a specific ESG function:
|
| 38 |
+
|
| 39 |
+
- Operational Agent – Monitors operational ESG metrics
|
| 40 |
+
- Financial Agent – Analyzes financial and investment-related ESG data
|
| 41 |
+
- Regulatory Agent – Ensures compliance with evolving ESG regulations
|
| 42 |
+
- Risk Agent – Detects anomalies and predicts future ESG risks
|
| 43 |
+
- Explanation Agent – Generates human-readable explanations for ESG score changes
|
| 44 |
+
|
| 45 |
+
---
|
| 46 |
+
|
| 47 |
+
## 🔧 Technical Architecture
|
| 48 |
+
|
| 49 |
+
### Frontend
|
| 50 |
+
- React.js
|
| 51 |
+
- Tailwind CSS
|
| 52 |
+
- Material UI
|
| 53 |
+
- Socket.IO
|
| 54 |
+
- Recharts / Chart.js
|
| 55 |
+
|
| 56 |
+
### Backend
|
| 57 |
+
- Node.js
|
| 58 |
+
- Express.js
|
| 59 |
+
- Socket.IO
|
| 60 |
+
- JWT Authentication
|
| 61 |
+
|
| 62 |
+
### AI / ML
|
| 63 |
+
- Python
|
| 64 |
+
- Scikit-Learn
|
| 65 |
+
- SpaCy
|
| 66 |
+
- BERT
|
| 67 |
+
- Multi-Agent System
|
| 68 |
+
|
| 69 |
+
### Automation & Orchestration
|
| 70 |
+
- n8n
|
| 71 |
+
- Webhooks
|
| 72 |
+
- REST APIs
|
| 73 |
+
|
| 74 |
+
### Database, Cloud & Deployment
|
| 75 |
+
- MongoDB Atlas
|
| 76 |
+
- Docker
|
| 77 |
+
- Vercel
|
| 78 |
+
- Render / AWS
|
| 79 |
+
- Hugging Face
|
| 80 |
+
|
| 81 |
+
---
|
| 82 |
+
|
| 83 |
+
## 🔄 System Workflow
|
| 84 |
+
|
| 85 |
+
1. Data ingestion from IoT sensors, APIs, ERP systems, CSVs, and databases
|
| 86 |
+
2. Data cleaning, normalization, and preprocessing
|
| 87 |
+
3. Parallel processing using multi-agent architecture
|
| 88 |
+
4. Predictive ESG risk scoring using historical and live data
|
| 89 |
+
5. Explainable AI generates insights behind ESG score changes
|
| 90 |
+
6. Live dashboard displays ESG scores, alerts, and compliance status
|
| 91 |
+
|
| 92 |
+
---
|
| 93 |
+
|
| 94 |
+
## 📊 Feasibility & Viability
|
| 95 |
+
|
| 96 |
+
- Real-time data ingestion from multiple sources
|
| 97 |
+
- Modular and scalable multi-agent architecture
|
| 98 |
+
- Machine-readable regulatory rules (SEBI BRSR, GRI, EU CSRD)
|
| 99 |
+
- Automated compliance checks reduce manual effort
|
| 100 |
+
- Easy extension for new metrics, regulations, and industries
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
## 🌍 Impact & Benefits
|
| 105 |
+
|
| 106 |
+
### Benefits
|
| 107 |
+
- Reduced penalties and reputational damage
|
| 108 |
+
- Better strategic decision-making
|
| 109 |
+
- Scalable and future-ready ESG framework
|
| 110 |
+
|
| 111 |
+
### Impact
|
| 112 |
+
- Proactive ESG risk management
|
| 113 |
+
- Continuous compliance monitoring
|
| 114 |
+
- Higher transparency and accountability
|
| 115 |
+
- Supports sustainability goals
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## 💼 Business Model
|
| 120 |
+
|
| 121 |
+
### Target Customers
|
| 122 |
+
Mid-sized enterprises in IT, manufacturing, retail, and energy sectors with mandatory ESG compliance requirements.
|
| 123 |
+
|
| 124 |
+
### Revenue Model
|
| 125 |
+
Subscription-based SaaS (monthly/yearly) with paid add-ons for customization and enterprise integrations.
|
| 126 |
+
|
| 127 |
+
### Technology Advantage
|
| 128 |
+
A unified ESG platform combining live data ingestion, AI-based risk detection, and explainable insights.
|
| 129 |
+
|
| 130 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
+
## Deployment Notes
|
| 133 |
+
|
| 134 |
+
Set these environment variables in your deployment platform before starting the API:
|
| 135 |
+
|
| 136 |
+
```env
|
| 137 |
+
MONGO_URI=mongodb+srv://<username>:<password>@<cluster-url>/?appName=<app-name>
|
| 138 |
+
MONGO_DB_NAME=company_database
|
| 139 |
+
MONGO_FIRM_ID=TECH001
|
| 140 |
+
MONGO_COLLECTION=raw_firm_data
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
The backend already reads `config/.env` locally through `python-dotenv`, and cloud deployments should provide the same keys as platform environment variables. Change `MONGO_FIRM_ID` to switch the active company without passing query parameters.
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
|
config/.env.example
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MONGO_URI=
|
| 2 |
+
MONGO_DB_NAME=
|
| 3 |
+
MONGO_COLLECTION=
|
config/__pycache__/settings.cpython-314.pyc
ADDED
|
Binary file (485 Bytes). View file
|
|
|
config/esg_column_schema.json
ADDED
|
File without changes
|
config/settings.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
|
| 5 |
+
BASE_DIR = Path(__file__).resolve().parents[1]
|
| 6 |
+
ENV_FILE = BASE_DIR / "config" / ".env"
|
| 7 |
+
|
| 8 |
+
load_dotenv(ENV_FILE)
|
models/train.py
CHANGED
|
@@ -4,25 +4,12 @@ from sklearn.model_selection import train_test_split
|
|
| 4 |
import joblib
|
| 5 |
|
| 6 |
def train_model():
|
| 7 |
-
|
| 8 |
-
df = pd.read_csv(
|
| 9 |
-
r"C:\Users\Mahek Bhatia\Desktop\ESG-Monitoring-System\outputs\agent4_final_output.csv"
|
| 10 |
-
)
|
| 11 |
|
| 12 |
-
# Create label
|
| 13 |
df["risk_label"] = (df["final_esg_risk_score"] >= 66).astype(int)
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
| 17 |
-
"ESG_Score",
|
| 18 |
-
"E_Score",
|
| 19 |
-
"S_Score",
|
| 20 |
-
"G_Score",
|
| 21 |
-
"Board_Independence",
|
| 22 |
-
"Firm_Size"
|
| 23 |
-
]
|
| 24 |
-
|
| 25 |
-
X = df[features]
|
| 26 |
y = df["risk_label"]
|
| 27 |
|
| 28 |
X_train, X_test, y_train, y_test = train_test_split(
|
|
|
|
| 4 |
import joblib
|
| 5 |
|
| 6 |
def train_model():
|
| 7 |
+
df = pd.read_csv(r"C:\Users\Mahek Bhatia\Desktop\ESG-Monitoring-System\outputs\agent4_final_output.csv")
|
|
|
|
|
|
|
|
|
|
| 8 |
|
|
|
|
| 9 |
df["risk_label"] = (df["final_esg_risk_score"] >= 66).astype(int)
|
| 10 |
|
| 11 |
+
# Drop non-feature columns
|
| 12 |
+
X = df.drop(columns=["risk_label"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
y = df["risk_label"]
|
| 14 |
|
| 15 |
X_train, X_test, y_train, y_test = train_test_split(
|
outputs/TECH001/TECH001_agent1_operational_output.csv
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Year,Industry_Type,E_Score,S_Score,G_Score,ROA,ROE,Net Profit Margin,Board_Independence
|
| 2 |
+
2014,Technology,93.7,82.2,84.3,6.4,10.4,16.8,89.4
|
| 3 |
+
2015,Technology,62.9,86.2,67.3,11.9,14.6,11.6,57.2
|
| 4 |
+
2016,Technology,89.2,88.4,67.4,7.5,13.8,17.6,93.2
|
| 5 |
+
2017,Technology,75.8,73.4,81.0,16.8,19.4,15.8,72.3
|
| 6 |
+
2018,Technology,49.7,94.5,73.3,2.5,15.7,6.7,95.0
|
| 7 |
+
2019,Technology,44.3,83.4,77.4,14.2,24.5,20.7,81.7
|
| 8 |
+
2020,Technology,69.3,52.3,61.8,3.4,17.9,17.0,93.5
|
| 9 |
+
2021,Technology,51.0,74.6,61.7,9.5,23.2,18.0,50.1
|
| 10 |
+
2022,Technology,68.2,92.9,91.3,9.3,14.8,19.3,69.9
|
| 11 |
+
2023,Technology,47.0,88.5,79.1,4.6,9.5,21.2,89.2
|
outputs/TECH001/TECH001_agent2_financial_output.csv
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Year,Industry_Type,E_Score,S_Score,G_Score,ROA,ROE,Net Profit Margin,Board_Independence,ESG_Score,financial_risk_score
|
| 2 |
+
2014,Technology,93.7,82.2,84.3,6.4,10.4,16.8,89.4,86.73,0
|
| 3 |
+
2015,Technology,62.9,86.2,67.3,11.9,14.6,11.6,57.2,72.13,0
|
| 4 |
+
2016,Technology,89.2,88.4,67.4,7.5,13.8,17.6,93.2,81.67,0
|
| 5 |
+
2017,Technology,75.8,73.4,81.0,16.8,19.4,15.8,72.3,76.73,0
|
| 6 |
+
2018,Technology,49.7,94.5,73.3,2.5,15.7,6.7,95.0,72.5,33
|
| 7 |
+
2019,Technology,44.3,83.4,77.4,14.2,24.5,20.7,81.7,68.37,33
|
| 8 |
+
2020,Technology,69.3,52.3,61.8,3.4,17.9,17.0,93.5,61.13,33
|
| 9 |
+
2021,Technology,51.0,74.6,61.7,9.5,23.2,18.0,50.1,62.43,33
|
| 10 |
+
2022,Technology,68.2,92.9,91.3,9.3,14.8,19.3,69.9,84.13,0
|
| 11 |
+
2023,Technology,47.0,88.5,79.1,4.6,9.5,21.2,89.2,71.53,33
|
outputs/TECH001/TECH001_agent3_compliance_output.csv
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Year,Industry_Type,E_Score,S_Score,G_Score,ROA,ROE,Net Profit Margin,Board_Independence,ESG_Score,financial_risk_score,E_Compliance,S_Compliance,G_Compliance,Overall_Compliance
|
| 2 |
+
2014,Technology,93.7,82.2,84.3,6.4,10.4,16.8,89.4,86.73,0,Compliant,Compliant,Compliant,Compliant
|
| 3 |
+
2015,Technology,62.9,86.2,67.3,11.9,14.6,11.6,57.2,72.13,0,Compliant,Compliant,Compliant,Compliant
|
| 4 |
+
2016,Technology,89.2,88.4,67.4,7.5,13.8,17.6,93.2,81.67,0,Compliant,Compliant,Compliant,Compliant
|
| 5 |
+
2017,Technology,75.8,73.4,81.0,16.8,19.4,15.8,72.3,76.73,0,Compliant,Compliant,Compliant,Compliant
|
| 6 |
+
2018,Technology,49.7,94.5,73.3,2.5,15.7,6.7,95.0,72.5,33,Violation,Compliant,Compliant,Non-Compliant
|
| 7 |
+
2019,Technology,44.3,83.4,77.4,14.2,24.5,20.7,81.7,68.37,33,Violation,Compliant,Compliant,Non-Compliant
|
| 8 |
+
2020,Technology,69.3,52.3,61.8,3.4,17.9,17.0,93.5,61.13,33,Compliant,Violation,Compliant,Non-Compliant
|
| 9 |
+
2021,Technology,51.0,74.6,61.7,9.5,23.2,18.0,50.1,62.43,33,Violation,Compliant,Compliant,Non-Compliant
|
| 10 |
+
2022,Technology,68.2,92.9,91.3,9.3,14.8,19.3,69.9,84.13,0,Compliant,Compliant,Compliant,Compliant
|
| 11 |
+
2023,Technology,47.0,88.5,79.1,4.6,9.5,21.2,89.2,71.53,33,Violation,Compliant,Compliant,Non-Compliant
|
outputs/TECH001/TECH001_agent4_final_output.csv
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Firm_ID,Year,Overall_Compliance,final_esg_risk_score,alert_level
|
| 2 |
+
TECH001,2014,Compliant,0,Low
|
| 3 |
+
TECH001,2015,Compliant,0,Low
|
| 4 |
+
TECH001,2016,Compliant,0,Low
|
| 5 |
+
TECH001,2017,Compliant,0,Low
|
| 6 |
+
TECH001,2018,Non-Compliant,33,Warning
|
| 7 |
+
TECH001,2019,Non-Compliant,33,Warning
|
| 8 |
+
TECH001,2020,Non-Compliant,33,Warning
|
| 9 |
+
TECH001,2021,Non-Compliant,33,Warning
|
| 10 |
+
TECH001,2022,Compliant,0,Low
|
| 11 |
+
TECH001,2023,Non-Compliant,33,Warning
|
outputs/TECH001_master.csv
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Year,Industry_Type,E_Score,S_Score,G_Score,ROA,ROE,Net Profit Margin,Board_Independence
|
| 2 |
+
2014,Technology,93.7,82.2,84.3,6.4,10.4,16.8,89.4
|
| 3 |
+
2015,Technology,62.9,86.2,67.3,11.9,14.6,11.6,57.2
|
| 4 |
+
2016,Technology,89.2,88.4,67.4,7.5,13.8,17.6,93.2
|
| 5 |
+
2017,Technology,75.8,73.4,81.0,16.8,19.4,15.8,72.3
|
| 6 |
+
2018,Technology,49.7,94.5,73.3,2.5,15.7,6.7,95.0
|
| 7 |
+
2019,Technology,44.3,83.4,77.4,14.2,24.5,20.7,81.7
|
| 8 |
+
2020,Technology,69.3,52.3,61.8,3.4,17.9,17.0,93.5
|
| 9 |
+
2021,Technology,51.0,74.6,61.7,9.5,23.2,18.0,50.1
|
| 10 |
+
2022,Technology,68.2,92.9,91.3,9.3,14.8,19.3,69.9
|
| 11 |
+
2023,Technology,47.0,88.5,79.1,4.6,9.5,21.2,89.2
|
requirements.txt
CHANGED
|
@@ -5,3 +5,8 @@ scikit-learn
|
|
| 5 |
joblib
|
| 6 |
python-multipart
|
| 7 |
shap
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
joblib
|
| 6 |
python-multipart
|
| 7 |
shap
|
| 8 |
+
Flask
|
| 9 |
+
requests
|
| 10 |
+
python-dotenv
|
| 11 |
+
pymongo
|
| 12 |
+
python-socketio
|