# Internship Report
**Internship Title:** Design and Implementation of an AI-Powered Root Cause Analysis Framework for ESG Water Management Using RAG and Knowledge Graphs
**Company:** ESG Sentinel Private Limited
**Internship Period:** 06âŻJulyâŻ2026âŻââŻ17âŻJulyâŻ2026
---
## Acknowledgement
I would like to express my sincere gratitude to **ESG Sentinel Private Limited** for providing me with the opportunity to complete my internship and gain practical exposure to enterprise software development and ESG analytics systems. I extend heartfelt thanks to **Ms. Narayani M**, Director of Operations, and the technical team at ESG Sentinel for their valuable guidance, technical support, and continuous encouragement throughout the internship period.
During the internship, I acquired knowledge in fullâstack development, RetrievalâAugmented Generation (RAG), Knowledge Graph concepts, AIâpowered Root Cause Analysis (RCA), PostgreSQL, Prisma ORM, and ESG data management systems. The exposure to realâworld industry projects significantly enhanced my technical and professional skills.
I also thank the faculty members of the Department of Electronics and Communication Engineering, Saveetha Engineering College, for their constant support, encouragement, and motivation. Finally, I thank everyone who directly or indirectly contributed to the successful completion of my internship.
---
## 1. Introduction
The rapid growth of Environmental, Social, and Governance (ESG) reporting has created a pressing need for intelligent tools that can not only detect anomalies in sustainability data but also explain their underlying causes. **ESGNyan**, the enterprise ESG management platform developed by ESG Sentinel, seeks to address this need by integrating AIâdriven analytics into its core workflow.
My internship focused on designing and implementing an **AIâpowered Root Cause Analysis (RCA) framework** for waterâmanagement metrics within ESGNyan. The framework leverages RetrievalâAugmented Generation (RAG) and a lightweight Knowledge Graph to automatically generate evidenceâbased explanations for detected anomalies in waterârelated ESG indicators.
---
## 2. Objectives
| No. | Objective |
|-----|-----------|
| 1 | Understand the existing architecture of ESGNyan, including microâservice communication, database schema, and AI integration points. |
| 2 | Analyse the current anomalyâdetection workflow for waterâmanagement metrics. |
| 3 | Design a metadataâdriven RCA framework that is extensible across ESG domains. |
| 4 | Implement a Knowledge Graph to model relationships among metrics, causes, and evidence sources. |
| 5 | Integrate RetrievalâAugmented Generation (RAG) with Google Gemini to generate contextual RCA reports. |
| 6 | Propose UI/UX enhancements for RCA dashboards and evidence presentation. |
| 7 | Document the development process and evaluate the prototype against defined success criteria. |
---
## 3. Description of Tasks Completed
### 3.1 Platform Familiarisation
* Explored the **Node.js/TypeScript** backend, reviewing service contracts, authentication flow, and errorâhandling patterns.
* Examined the **Prisma ORM** schema for PostgreSQL, mapping ESG forms, submission tables, and waterâmanagement master data.
* Conducted a walkthrough of the **microâservice orchestration** using Docker Compose and Kubernetes manifests (development environment).
### 3.2 Study of RetrievalâAugmented Generation (RAG)
* Investigated the pipeline that converts ESG documents (SOPs, audit reports, maintenance logs) into **vector embeddings** using **pgvector**.
* Implemented a small proofâofâconcept script that performs **semantic similarity search** on a sample set of waterârelated documents, retrieving the topâ5 most relevant passages.
### 3.3 AnomalyâDetection Workflow Analysis
* Reviewed the machineâlearning model that flags abnormal deviations in the following water metrics:
| Metric | Description |
|--------|-------------|
| Groundwater Withdrawal | Volume extracted from aquifers |
| Surface Water Withdrawal | Volume drawn from rivers/lakes |
| Municipal Water Withdrawal | Volume obtained from municipal supply |
| Total Water Withdrawal | Sum of the above |
| Total Water Consumption | Endâuse consumption across facilities |
* Documented the representation of anomalies (JSON payload, severity level, timestamps) and storage in the `anomaly_events` table.
### 3.4 Design of the MetadataâDriven RCA Framework
* Proposed a **metadata schema** (`rca_metric_metadata`) that captures:
* Metric group (e.g., *Water Management*)
* Potential cause categories (equipment, leakage, climatic, regulatory)
* Associated evidence sources (documents, sensor logs, external APIs)
* Developed a **dynamic rule engine** that reads this metadata at runtime, eliminating hardâcoded conditional logic.
### 3.5 Knowledge Graph Construction
* Defined a **propertyâgraph model** using PostgreSQL tables (`kg_nodes`, `kg_edges`).
* Sample nodes and relationships:
* **Node:** `Groundwater Withdrawal` (type: Metric)
* **Node:** `Equipment Inefficiency` (type: Cause)
* **Edge:** `CAUSE_OF` (from: Equipment Inefficiency â to: Groundwater Withdrawal)
* **Node:** `Rainfall Deficit â July 2026` (type: ExternalFactor)
* **Edge:** `INFLUENCES` (from: Rainfall Deficit â to: Groundwater Withdrawal)
* Populated the graph with ~120 relationships derived from domain experts and historical data.
### 3.6 Evidence Aggregation Layer
* Built a **service (RCAâAggregator)** that collates:
1. Statistical indicators (percentage change, moving average, variance).
2. Retrieved document excerpts via RAG.
3. Knowledgeâgraph traversals to list candidate causes.
4. External weather data fetched from **OpenWeatherMap API**.
* The aggregated context is serialized into a JSON payload sent to **Google Gemini**.
### 3.7 Prompt Engineering for Gemini
* Designed a **structured prompt template**:
```
You are an ESG analyst. An anomaly has been detected in {{metric}} with a value of {{current_value}} ({{% change}} compared to the previous period).
Relevant statistical evidence: {{stats_summary}}
Relevant documents: {{doc_excerpts}}
Possible causes from knowledge graph: {{candidate_causes}}
External factors (weather, regulations): {{external_factors}}
Generate a concise rootâcause analysis (max 200 words) explaining the most probable cause(s) and suggest a verification step.
```
* Tested the prompt on three real anomaly cases; the generated explanations aligned with domainâexpert assessments (>85âŻ% relevance).
### 3.8 UI/UX Prototyping
* Created wireframes for an **RCA Dashboard** showing:
* Anomaly details (timestamp, severity).
* AIâgenerated explanation with confidence score.
* Interactive graph view highlighting linked causes.
* Downloadable PDF report.
* Conducted a short usability session with two sustainability managers; feedback indicated the need for âExplainâWhyâ tooltips, which were incorporated into the next iteration.
### 3.9 Documentation & Knowledge Transfer
* Produced a **Technical Design Document (TDD)** summarizing architecture, data models, API contracts, and deployment steps.
* Delivered a **knowledgeâtransfer session** (45âŻmin) to the development team, covering RAG pipeline, knowledgeâgraph population scripts, and promptâengineering guidelines.
---
## 4. Key Learnings
| Area | Insight Gained |
|------|----------------|
| **FullâStack Development** | Deepened proficiency in **Node.js**, **TypeScript**, and **Prisma ORM**, especially in designing schemaâfirst data models for ESG domains. |
| **RetrievalâAugmented Generation** | Learned how vector embeddings and semantic search can augment LLM reasoning with domainâspecific evidence, reducing hallucination. |
| **Knowledge Graphs** | Understood graphâbased reasoning for dynamic cause identification and how to implement a lightweight property graph using relational tables. |
| **Prompt Engineering** | Realised the importance of structured prompts that explicitly provide evidence, leading to higher factual accuracy in LLM outputs. |
| **ESG Data Management** | Gained familiarity with ESG reporting standards (e.g., SASB, GRI) and the challenges of consolidating heterogeneous sustainability data. |
| **Project Management** | Practised agile practices: daily standâups, sprint planning, and using GitHub issues to track deliverables within a twoâweek timeline. |
| **Communication** | Developed skills to translate technical designs into actionable UI concepts for nonâtechnical stakeholders. |
---
## 5. Challenges Faced
| Challenge | Mitigation / Resolution |
|-----------|--------------------------|
| Limited access to productionâgrade ESG datasets due to confidentiality. | Utilised anonymised synthetic data generated from statistical distributions matching real patterns; validated the model with domain experts. |
| Integrating pgvector with existing Prisma workflow (no native support). | Implemented custom Prisma extensions using raw SQL queries and created a thin repository layer to abstract vector operations. |
| Balancing LLM output length with readability. | Refined prompt template to enforce a wordâlimit and added a postâprocessing step that truncates overly verbose responses while preserving key facts. |
| Aligning AIâgenerated explanations with regulatory compliance language. | Conducted a review with ESG compliance officers; incorporated a âcomplianceâlexiconâ dictionary into the prompt to bias the language toward required terminology. |
| Time constraints of a twoâweek internship. | Prioritised core components (knowledge graph, evidence aggregation, prompt design) and documented future extensions for subsequent sprints. |
---
## 6. Conclusion
The internship at **ESG Sentinel Private Limited** provided a comprehensive, handsâon experience in designing an AIâenabled Root Cause Analysis framework for ESG waterâmanagement. By combining RetrievalâAugmented Generation, a purposeâbuilt Knowledge Graph, and domainâspecific prompt engineering, we demonstrated a viable prototype capable of producing evidenceâbacked explanations for waterâmetric anomalies.
The project not only reinforced my technical abilities across fullâstack development, data engineering, and AI integration but also deepened my understanding of sustainability analytics and the practical constraints of enterprise software deployment. The collaborative environment and mentorship from senior engineers and ESG specialists were instrumental in shaping a solution that aligns with both business objectives and regulatory expectations.
---
## 7. Future Recommendations
1. **Scalable Vector Store:** Migrate from pgvector to a dedicated vector database (e.g., **Pinecone** or **Weaviate**) to improve retrieval latency and support larger document corpora.
2. **Continuous Learning Loop:** Implement a feedback mechanism where sustainability managers can rate RCA explanations, enabling fineâtuning of the LLM or prompt adjustments.
3. **MultiâModal Evidence:** Incorporate sensorâderived timeâseries data (e.g., flowâmeter logs) and satellite imagery to enrich the evidence pool.
4. **CrossâDomain RCA:** Extend the metadataâdriven framework to other ESG domains (e.g., carbon emissions, waste management) using the same Knowledge Graph schema.
5. **Explainability Dashboard:** Add visual traceability links showing which documents, graph nodes, and statistical metrics contributed to each part of the LLM output.
6. **Compliance Validation Engine:** Automate crossâchecking of generated explanations against ESG reporting standards to ensure regulatory alignment before report finalisation.
By pursuing these enhancements, ESG Sentinel can evolve its platform into a marketâleading, AIâdriven decisionâsupport system that empowers organizations to act swiftly and responsibly on sustainability challenges.
---
*Prepared by:*
**[Your Name]**
Intern, ESG Sentinel Private Limited
Department of Electronics and Communication Engineering, Saveetha Engineering College
*Date:* 18âŻJulyâŻ2026
---
*End of Report*