# snowlindhanusha/ai-sustainability-consequence-intelligence architecture

> Architecture diagram of the GitHub repository snowlindhanusha/ai-sustainability-consequence-intelligence, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/snowlindhanusha/ai-sustainability-consequence-intelligence
- Repository: https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence

## Overview

This is a Streamlit decision-support MVP that helps people examine possible sustainability consequences without issuing a verdict or ranking. A user submits a decision; the system clarifies its assumptions, pauses for human confirmation, then produces consequence analysis, overlooked effects, alternatives, and verification questions. The report links findings to curated evidence and qualitative uncertainty labels. Analysis can use a configured language model or scenario-specific demo data. The graph reflects the documented workflow and sampled imports/calls; some UI-stage orchestration details and unsampled modules are not independently verified.

Main entry points: [`src/report.py`](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/report.py) (Report assembly), [`src/ai_engine.py`](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/ai_engine.py) (AI and fallback engine), [`app.py`](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/app.py) (Decision clarification), [`src/retrieval.py`](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/retrieval.py) (Evidence retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_streamlit["Streamlit interface<br/>[app.py]"]
  node_clarification["Decision clarification<br/>[app.py]"]
  node_confirmation["Human confirmation<br/>[app.py]"]
  node_analysis_ui["Analysis presentation<br/>[app.py]"]
end

subgraph group_analysis["Decision analysis"]
  node_ai_engine["AI and fallback engine<br/>[ai_engine.py]"]
  node_prompt_templates["Prompts and demo data<br/>[prompts.py]"]
  node_language_model["Configured language model"]
  node_consequence_analysis["Consequence analysis<br/>[ai_engine.py]"]
end

subgraph group_evidence["Evidence and reporting"]
  node_report_assembly["Report assembly<br/>[report.py]"]
  node_evidence_retrieval["Evidence retrieval<br/>[retrieval.py]"]
  node_knowledge_base[("Curated knowledge base")]
  node_evidence_status["Evidence status<br/>[retrieval.py]"]
  node_report_output["Structured report<br/>[report.py]"]
end

subgraph group_support["Shared support"]
  node_shared_utilities["Validation and chain helpers<br/>[utils.py]"]
end

node_user(("Decision-maker"))

node_user -->|"submits decision"| node_streamlit
node_streamlit -->|"starts clarification"| node_clarification
node_clarification -->|"requests understanding"| node_ai_engine
node_ai_engine -->|"uses templates"| node_prompt_templates
node_ai_engine -->|"calls API"| node_language_model
node_ai_engine -->|"uses demo data"| node_prompt_templates
node_clarification -->|"presents understanding"| node_confirmation
node_user -->|"confirms understanding"| node_confirmation
node_confirmation -->|"enables analysis"| node_consequence_analysis
node_consequence_analysis -.->|"requests analysis"| node_ai_engine
node_consequence_analysis -.->|"provides findings"| node_report_assembly
node_report_assembly -->|"retrieves evidence"| node_evidence_retrieval
node_evidence_retrieval -->|"reads entries"| node_knowledge_base
node_report_assembly -->|"assigns status"| node_evidence_status
node_report_assembly -->|"builds consequence chain"| node_shared_utilities
node_report_assembly -->|"assembles report"| node_report_output
node_report_output -->|"renders findings"| node_analysis_ui
node_analysis_ui -->|"shows results"| node_user

click node_streamlit "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/app.py"
click node_clarification "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/app.py"
click node_confirmation "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/app.py"
click node_analysis_ui "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/app.py"
click node_ai_engine "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/ai_engine.py"
click node_prompt_templates "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/prompts.py"
click node_consequence_analysis "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/ai_engine.py"
click node_report_assembly "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/report.py"
click node_evidence_retrieval "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/retrieval.py"
click node_knowledge_base "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/data/knowledge_base.json"
click node_evidence_status "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/retrieval.py"
click node_report_output "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/report.py"
click node_shared_utilities "https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_streamlit,node_clarification,node_confirmation,node_analysis_ui toneBlue
class node_ai_engine,node_prompt_templates,node_language_model,node_consequence_analysis toneAmber
class node_report_assembly,node_evidence_retrieval,node_knowledge_base,node_evidence_status,node_report_output toneMint
class node_shared_utilities toneRose
class node_user toneIndigo
```

## Components

### User experience

- [Streamlit interface](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/app.py): `app.py`
- [Decision clarification](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/app.py): `app.py`
- [Human confirmation](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/app.py): `app.py`
- [Analysis presentation](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/app.py): `app.py`

### Decision analysis

- [AI and fallback engine](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/ai_engine.py): `src/ai_engine.py`
- [Prompts and demo data](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/prompts.py): `src/prompts.py`
- **Configured language model**
- [Consequence analysis](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/ai_engine.py): `src/ai_engine.py`

### Evidence and reporting

- [Report assembly](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/report.py): `src/report.py`
- [Evidence retrieval](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/retrieval.py): `src/retrieval.py`
- [Curated knowledge base](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/data/knowledge_base.json): `data/knowledge_base.json`
- [Evidence status](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/retrieval.py): `src/retrieval.py`
- [Structured report](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/report.py): `src/report.py`

### Shared support

- [Validation and chain helpers](https://github.com/snowlindhanusha/ai-sustainability-consequence-intelligence/blob/main/src/utils.py): `src/utils.py`

### Other components

- **Decision-maker**

## Connections

- Decision-maker → Streamlit interface: submits decision (evidence: `README.md`)
- Streamlit interface → Decision clarification: starts clarification (evidence: `README.md`)
- Decision clarification → AI and fallback engine: requests understanding (evidence: `README.md`)
- AI and fallback engine → Prompts and demo data: uses templates (evidence: `src/ai_engine.py`)
- AI and fallback engine → Configured language model: calls API (evidence: `src/ai_engine.py`)
- AI and fallback engine → Prompts and demo data: uses demo data (evidence: `src/ai_engine.py`)
- Decision clarification → Human confirmation: presents understanding (evidence: `README.md`)
- Decision-maker → Human confirmation: confirms understanding (evidence: `README.md`)
- Human confirmation → Consequence analysis: enables analysis (evidence: `README.md`)
- Consequence analysis → AI and fallback engine: requests analysis (evidence: `src/ai_engine.py`)
- Consequence analysis → Report assembly: provides findings
- Report assembly → Evidence retrieval: retrieves evidence (evidence: `src/report.py`)
- Evidence retrieval → Curated knowledge base: reads entries (evidence: `src/retrieval.py`)
- Report assembly → Evidence status: assigns status (evidence: `src/report.py`)
- Report assembly → Validation and chain helpers: builds consequence chain (evidence: `src/report.py`)
- Report assembly → Structured report: assembles report (evidence: `src/report.py`)
- Structured report → Analysis presentation: renders findings (evidence: `README.md`)
- Analysis presentation → Decision-maker: shows results (evidence: `README.md`)
