# github-harsha63/genai-ethical-evaluation-game architecture

> Architecture diagram of the GitHub repository github-harsha63/genai-ethical-evaluation-game, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/github-harsha63/genai-ethical-evaluation-game
- Repository: https://github.com/github-harsha63/genai-ethical-evaluation-game

## Overview

The product is an interactive ethical-decision simulation: users answer randomly selected dilemmas, submit their choices, and receive generated feedback, with options to retake or start a new test. The Streamlit app calls a Flask API; the sampled backend uses Gemini, despite the README’s Mistral description. The separate `backend/mistral.py` also calls Gemini but is not shown as wired into the Flask app. The graph reflects only evidenced calls and documented behavior; question selection and feedback generation are represented as stages within the backend file that implements them.

Main entry points: [`frontend/app.py`](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/frontend/app.py) (Simulation app), [`backend/main.py`](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/main.py) (Flask API), [`backend/mistral.py`](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/mistral.py) (Separate AI helper), [`frontend/static/images`](https://github.com/github-harsha63/genai-ethical-evaluation-game/tree/main/frontend/static/images) (Scenario images)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_streamlit["Simulation app<br/>[app.py]"]
  node_scenario_view["Scenario display<br/>[app.py]"]
  node_choice_state["Choice tracking<br/>[app.py]"]
  node_feedback_view["Feedback and retake<br/>[app.py]"]
  node_images["Scenario images"]
end

subgraph group_api["Simulation API"]
  node_flask_api["Flask API<br/>[main.py]"]
  node_question_pool["Question pool<br/>[questions.json]"]
  node_question_selection["Random selection<br/>[main.py]"]
  node_response_handler["Response submission<br/>[main.py]"]
  node_prompt_builder["Feedback prompt<br/>[main.py]"]
end

subgraph group_ai["AI feedback"]
  node_gemini_request["Gemini request<br/>[main.py]"]
  node_mistral_module["Separate AI helper<br/>[mistral.py]"]
end

node_user(("Participant"))
node_gemini{{"Gemini API"}}

node_user -->|"uses"| node_streamlit
node_streamlit -->|"requests questions"| node_flask_api
node_flask_api -->|"routes to"| node_question_selection
node_question_selection -->|"samples from"| node_question_pool
node_streamlit -->|"displays"| node_scenario_view
node_scenario_view -->|"loads"| node_images
node_scenario_view -->|"records choice"| node_choice_state
node_user -->|"chooses"| node_choice_state
node_choice_state -->|"submits responses"| node_streamlit
node_streamlit -->|"posts responses"| node_flask_api
node_flask_api -->|"routes to"| node_response_handler
node_response_handler -->|"builds prompt"| node_prompt_builder
node_response_handler -->|"requests feedback"| node_gemini_request
node_gemini_request -->|"calls"| node_gemini
node_response_handler -->|"returns feedback"| node_flask_api
node_streamlit -->|"shows feedback"| node_feedback_view
node_feedback_view -->|"presents result"| node_user
node_mistral_module -->|"calls"| node_gemini

click node_streamlit "https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/frontend/app.py"
click node_scenario_view "https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/frontend/app.py"
click node_choice_state "https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/frontend/app.py"
click node_feedback_view "https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/frontend/app.py"
click node_images "https://github.com/github-harsha63/genai-ethical-evaluation-game/tree/main/frontend/static/images"
click node_flask_api "https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/main.py"
click node_question_pool "https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/questions.json"
click node_question_selection "https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/main.py"
click node_response_handler "https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/main.py"
click node_prompt_builder "https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/main.py"
click node_gemini_request "https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/main.py"
click node_mistral_module "https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/mistral.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_scenario_view,node_choice_state,node_feedback_view,node_images toneBlue
class node_flask_api,node_question_pool,node_question_selection,node_response_handler,node_prompt_builder toneAmber
class node_gemini_request,node_mistral_module,node_gemini toneMint
class node_user toneIndigo
```

## Components

### User experience

- [Simulation app](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/frontend/app.py): `frontend/app.py`
- [Scenario display](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/frontend/app.py): `frontend/app.py`
- [Choice tracking](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/frontend/app.py): `frontend/app.py`
- [Feedback and retake](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/frontend/app.py): `frontend/app.py`
- [Scenario images](https://github.com/github-harsha63/genai-ethical-evaluation-game/tree/main/frontend/static/images): `frontend/static/images`

### Simulation API

- [Flask API](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/main.py): `backend/main.py`
- [Question pool](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/questions.json): `backend/questions.json`
- [Random selection](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/main.py): `backend/main.py`
- [Response submission](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/main.py): `backend/main.py`
- [Feedback prompt](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/main.py): `backend/main.py`

### AI feedback

- [Gemini request](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/main.py): `backend/main.py`
- [Separate AI helper](https://github.com/github-harsha63/genai-ethical-evaluation-game/blob/main/backend/mistral.py): `backend/mistral.py`

### Other components

- **Participant**
- **Gemini API**

## Connections

- Participant → Simulation app: uses (evidence: `README.md`)
- Simulation app → Flask API: requests questions (evidence: `frontend/app.py`)
- Flask API → Random selection: routes to (evidence: `backend/main.py`)
- Random selection → Question pool: samples from (evidence: `backend/main.py`)
- Simulation app → Scenario display: displays (evidence: `frontend/app.py`)
- Scenario display → Scenario images: loads (evidence: `frontend/app.py`)
- Scenario display → Choice tracking: records choice (evidence: `frontend/app.py`)
- Participant → Choice tracking: chooses (evidence: `README.md`)
- Choice tracking → Simulation app: submits responses (evidence: `frontend/app.py`)
- Simulation app → Flask API: posts responses (evidence: `frontend/app.py`)
- Flask API → Response submission: routes to (evidence: `backend/main.py`)
- Response submission → Feedback prompt: builds prompt (evidence: `backend/main.py`)
- Response submission → Gemini request: requests feedback (evidence: `backend/main.py`)
- Gemini request → Gemini API: calls (evidence: `backend/main.py`)
- Response submission → Flask API: returns feedback (evidence: `backend/main.py`)
- Simulation app → Feedback and retake: shows feedback (evidence: `frontend/app.py`)
- Feedback and retake → Participant: presents result (evidence: `README.md`)
- Separate AI helper → Gemini API: calls (evidence: `backend/mistral.py`)
