# luckynest7-beep/lodgetrust-phase-1 architecture

> Architecture diagram of the GitHub repository luckynest7-beep/lodgetrust-phase-1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luckynest7-beep/lodgetrust-phase-1
- Repository: https://github.com/luckynest7-beep/lodgetrust-phase-1

## Overview

LodgeTrust verifies hotel-listing photos through a React dashboard and FastAPI service. The principal workflow uploads listing images, runs reuse, AI-generation, and visual-quality checks, then presents per-image and aggregate results; optional trust evaluation adds compliance and price/description analysis. The graph also preserves the documented image-signal stages and compliance retrieval subsystem. Some model and route wiring is represented from README or SOURCE INDEX references rather than fully sampled implementation, so those links are limited to relationships supported there.

Main entry points: [`backend/api/main.py`](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/api/main.py) (FastAPI routes), [`backend/image_analysis/combine_signals.py`](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/combine_signals.py) (Signal aggregation), [`frontend/src/App.tsx`](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/App.tsx) (Dashboard), [`frontend/src/components/AnalyzeResults.tsx`](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/components/AnalyzeResults.tsx) (Results view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web dashboard"]
  node_app["Dashboard<br/>[App.tsx]"]
  node_upload["Image uploader<br/>[ImageUploader.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_results["Results view<br/>[AnalyzeResults.tsx]"]
  node_signal_panels["Signal panels"]
  node_compliance_panel["Compliance panel"]
  node_seed_panel["Index manager<br/>[SeedIndexPanel.tsx]"]
end

subgraph group_service["HTTP service"]
  node_api["FastAPI routes<br/>[main.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
  node_seed["Demo index seeder<br/>[seed_index.py]"]
end

subgraph group_signals["Image signals"]
  node_reuse["Reuse detection<br/>[stolen_image.py]"]
  node_clip["CLIP embeddings<br/>[clip_utils.py]"]
  node_ai_detection["AI-image detection"]
  node_combiner["Signal aggregation<br/>[combine_signals.py]"]
  node_style["Style tier<br/>[style_tier.py]"]
  node_aesthetic["Aesthetic score<br/>[aesthetic_score.py]"]
  node_furniture["Furniture detection"]
  node_lighting["Lighting analysis"]
  node_color["Color analysis<br/>[color_analysis.py]"]
end

subgraph group_trust["Trust evaluation"]
  node_trust_eval["Trust evaluator<br/>[trust_evaluator.py]"]
end

subgraph group_compliance["Compliance RAG"]
  node_compliance_check["Compliance check"]
  node_retrieval["Criteria retrieval<br/>[retrieval.py]"]
  node_criteria_db[("Chroma criteria store")]
end

node_guest(("Listing reviewer"))
node_gemini{{"Gemini API"}}

node_guest -->|"uses"| node_app
node_app -->|"renders"| node_upload
node_app -->|"submits images"| node_api_client
node_api_client -->|"calls analysis API"| node_api
node_app -->|"renders results"| node_results
node_results -->|"renders signals"| node_signal_panels
node_results -->|"renders compliance"| node_compliance_panel
node_app -->|"renders index controls"| node_seed_panel
node_seed_panel -->|"requests index actions"| node_api_client
node_api -->|"uses schemas"| node_schemas
node_api -->|"checks reuse"| node_reuse
node_api -->|"detects generated images"| node_ai_detection
node_api -->|"aggregates image signals"| node_combiner
node_api -->|"seeds index"| node_seed
node_seed -->|"adds demo images"| node_reuse
node_reuse -->|"embeds query images"| node_clip
node_combiner -->|"classifies style"| node_style
node_combiner -->|"scores aesthetics"| node_aesthetic
node_combiner -->|"detects amenities"| node_furniture
node_combiner -->|"analyzes lighting"| node_lighting
node_combiner -->|"analyzes color"| node_color
node_style -->|"uses embeddings"| node_clip
node_api -->|"evaluates trust"| node_trust_eval
node_trust_eval -->|"checks compliance"| node_compliance_check
node_trust_eval -->|"requests price analysis"| node_gemini
node_compliance_check -->|"fetches criteria"| node_retrieval
node_retrieval -->|"queries criteria"| node_criteria_db
node_compliance_check -->|"judges criteria"| node_gemini

click node_app "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/App.tsx"
click node_upload "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/components/ImageUploader.tsx"
click node_api_client "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/lib/api.ts"
click node_results "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/components/AnalyzeResults.tsx"
click node_signal_panels "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/components/FeatureVectorPanel.tsx"
click node_compliance_panel "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/components/CompliancePanel.tsx"
click node_seed_panel "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/components/SeedIndexPanel.tsx"
click node_api "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/api/main.py"
click node_schemas "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/api/schemas.py"
click node_seed "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/api/seed_index.py"
click node_reuse "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/stolen_image.py"
click node_clip "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/clip_utils.py"
click node_ai_detection "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/ai_image_detector.py"
click node_combiner "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/combine_signals.py"
click node_style "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/style_tier.py"
click node_aesthetic "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/aesthetic_score.py"
click node_furniture "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/furniture_detector.py"
click node_lighting "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/lighting_analysis.py"
click node_color "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/color_analysis.py"
click node_trust_eval "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/trust_evaluator.py"
click node_compliance_check "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/compliance_rag/compliance_check.py"
click node_retrieval "https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/compliance_rag/retrieval.py"
click node_criteria_db "https://github.com/luckynest7-beep/lodgetrust-phase-1/tree/main/compliance_rag/chroma_db"

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_app,node_upload,node_api_client,node_results,node_signal_panels,node_compliance_panel,node_seed_panel,node_guest toneBlue
class node_api,node_schemas,node_seed toneAmber
class node_reuse,node_clip,node_ai_detection,node_combiner,node_style,node_aesthetic,node_furniture,node_lighting,node_color,node_gemini toneMint
class node_trust_eval toneRose
class node_compliance_check,node_retrieval,node_criteria_db toneIndigo
```

## Components

### Web dashboard

- [Dashboard](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Image uploader](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/components/ImageUploader.tsx): `frontend/src/components/ImageUploader.tsx`
- [API client](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Results view](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/components/AnalyzeResults.tsx): `frontend/src/components/AnalyzeResults.tsx`
- [Signal panels](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/components/FeatureVectorPanel.tsx): `frontend/src/components/FeatureVectorPanel.tsx`
- [Compliance panel](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/components/CompliancePanel.tsx): `frontend/src/components/CompliancePanel.tsx`
- [Index manager](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/frontend/src/components/SeedIndexPanel.tsx): `frontend/src/components/SeedIndexPanel.tsx`

### HTTP service

- [FastAPI routes](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/api/main.py): `backend/api/main.py`
- [API schemas](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/api/schemas.py): `backend/api/schemas.py`
- [Demo index seeder](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/api/seed_index.py): `backend/api/seed_index.py`

### Image signals

- [Reuse detection](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/stolen_image.py): `backend/image_analysis/stolen_image.py`
- [CLIP embeddings](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/clip_utils.py): `backend/image_analysis/clip_utils.py`
- [AI-image detection](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/ai_image_detector.py): `backend/image_analysis/ai_image_detector.py`
- [Signal aggregation](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/combine_signals.py): `backend/image_analysis/combine_signals.py`
- [Style tier](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/style_tier.py): `backend/image_analysis/style_tier.py`
- [Aesthetic score](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/aesthetic_score.py): `backend/image_analysis/aesthetic_score.py`
- [Furniture detection](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/furniture_detector.py): `backend/image_analysis/furniture_detector.py`
- [Lighting analysis](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/lighting_analysis.py): `backend/image_analysis/lighting_analysis.py`
- [Color analysis](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/image_analysis/color_analysis.py): `backend/image_analysis/color_analysis.py`

### Trust evaluation

- [Trust evaluator](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/backend/trust_evaluator.py): `backend/trust_evaluator.py`

### Compliance RAG

- [Compliance check](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/compliance_rag/compliance_check.py): `compliance_rag/compliance_check.py`
- [Criteria retrieval](https://github.com/luckynest7-beep/lodgetrust-phase-1/blob/main/compliance_rag/retrieval.py): `compliance_rag/retrieval.py`
- [Chroma criteria store](https://github.com/luckynest7-beep/lodgetrust-phase-1/tree/main/compliance_rag/chroma_db): `compliance_rag/chroma_db`

### Other components

- **Listing reviewer**
- **Gemini API**

## Connections

- Listing reviewer → Dashboard: uses (evidence: `README.md`)
- Dashboard → Image uploader: renders (evidence: `frontend/src/App.tsx`)
- Dashboard → API client: submits images (evidence: `frontend/src/App.tsx`)
- API client → FastAPI routes: calls analysis API (evidence: `frontend/src/lib/api.ts`)
- Dashboard → Results view: renders results (evidence: `frontend/src/App.tsx`)
- Results view → Signal panels: renders signals (evidence: `frontend/src/components/AnalyzeResults.tsx`)
- Results view → Compliance panel: renders compliance (evidence: `frontend/src/components/AnalyzeResults.tsx`)
- Dashboard → Index manager: renders index controls (evidence: `frontend/src/App.tsx`)
- Index manager → API client: requests index actions (evidence: `frontend/src/lib/api.ts`)
- FastAPI routes → API schemas: uses schemas (evidence: `backend/api/main.py`)
- FastAPI routes → Reuse detection: checks reuse (evidence: `backend/api/main.py`)
- FastAPI routes → AI-image detection: detects generated images (evidence: `backend/api/main.py`)
- FastAPI routes → Signal aggregation: aggregates image signals (evidence: `backend/api/main.py`)
- FastAPI routes → Demo index seeder: seeds index (evidence: `backend/api/main.py`)
- Demo index seeder → Reuse detection: adds demo images (evidence: `backend/api/seed_index.py`)
- Reuse detection → CLIP embeddings: embeds query images (evidence: `backend/image_analysis/stolen_image.py`)
- Signal aggregation → Style tier: classifies style (evidence: `backend/image_analysis/combine_signals.py`)
- Signal aggregation → Aesthetic score: scores aesthetics (evidence: `backend/image_analysis/combine_signals.py`)
- Signal aggregation → Furniture detection: detects amenities (evidence: `backend/image_analysis/combine_signals.py`)
- Signal aggregation → Lighting analysis: analyzes lighting (evidence: `backend/image_analysis/combine_signals.py`)
- Signal aggregation → Color analysis: analyzes color (evidence: `backend/image_analysis/combine_signals.py`)
- Style tier → CLIP embeddings: uses embeddings (evidence: `backend/image_analysis/style_tier.py`)
- FastAPI routes → Trust evaluator: evaluates trust (evidence: `backend/api/main.py`)
- Trust evaluator → Compliance check: checks compliance (evidence: `backend/trust_evaluator.py`)
- Trust evaluator → Gemini API: requests price analysis (evidence: `backend/trust_evaluator.py`)
- Compliance check → Criteria retrieval: fetches criteria (evidence: `compliance_rag/compliance_check.py`)
- Criteria retrieval → Chroma criteria store: queries criteria (evidence: `compliance_rag/retrieval.py`)
- Compliance check → Gemini API: judges criteria (evidence: `compliance_rag/compliance_check.py`)
