# tousif166/newsih architecture

> Architecture diagram of the GitHub repository tousif166/newsih, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tousif166/newsih
- Repository: https://github.com/tousif166/newsih

## Overview

SiteSync AI is a role-based infrastructure project controls app that turns field reports into reviewed schedule progress. Supervisors enter voice, text, DPR, or photo evidence; the central store processes events with the AI engine, and planners review proposed links before progress is reflected in schedule and project views. The README also documents conflict guardrails, 4D visualization, scenario simulation, copilot, audit provenance, and a guided demo. Several view-to-store links are based on the source index; unsampled implementation details are not inferred.

Main entry points: [`src/services/store.tsx`](https://github.com/tousif166/newsih/blob/main/src/services/store.tsx) (Reactive Store), [`src/App.tsx`](https://github.com/tousif166/newsih/blob/main/src/App.tsx) (Application Router), [`src/components/views/FieldInputCenter.tsx`](https://github.com/tousif166/newsih/blob/main/src/components/views/FieldInputCenter.tsx) (Field Input), [`src/components/views/ReviewCenter.tsx`](https://github.com/tousif166/newsih/blob/main/src/components/views/ReviewCenter.tsx) (AI Review Center)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Progress Workflow"]
  node_field_input["Field Input"]
  node_review["AI Review Center<br/>[ReviewCenter.tsx]"]
end

subgraph group_planning["Project Controls"]
  node_schedule["Schedule Explorer"]
  node_dashboard["Project Dashboard"]
  node_gantt["4D Digital Twin"]
  node_whatif["What-If Simulator"]
end

subgraph group_intelligence["Planning Intelligence"]
  node_ai_engine["AI Matcher and Rules<br/>[aiEngine.ts]"]
  node_conflicts["Conflict Center<br/>[ConflictCenter.tsx]"]
  node_activity_dna["Activity DNA Memory"]
  node_copilot["Project Copilot<br/>[CopilotDrawer.tsx]"]
  node_audit["Audit Trail<br/>[AuditTrailView.tsx]"]
end

subgraph group_platform["App and Data"]
  node_app["Application Router<br/>[App.tsx]"]
  node_store["Reactive Store<br/>[store.tsx]"]
  node_demo["Guided Demo"]
  node_login["Login<br/>[LoginPage.tsx]"]
  node_seed_data[("Synthetic Project Data<br/>[seedData.ts]")]
  node_supabase[("Supabase Database")]
end

node_field_user(("Field Supervisor"))
node_planner_user(("Planner"))

node_field_user -->|"reports progress"| node_field_input
node_planner_user -->|"reviews matches"| node_review
node_app -->|"routes to"| node_field_input
node_app -->|"routes to"| node_review
node_app -->|"routes to"| node_schedule
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_gantt
node_app -->|"routes to"| node_whatif
node_app -->|"renders"| node_login
node_field_input -->|"submits reports"| node_store
node_store -->|"extracts events"| node_ai_engine
node_store -->|"loads demo data"| node_seed_data
node_review -->|"reads review state"| node_store
node_conflicts -->|"reads conflicts"| node_store
node_schedule -->|"reads schedule"| node_store
node_dashboard -->|"reads project state"| node_store
node_gantt -->|"reads schedule state"| node_store
node_whatif -->|"uses scenarios"| node_store
node_store -->|"simulates scenarios"| node_ai_engine
node_activity_dna -->|"reads activity data"| node_store
node_copilot -->|"reads project facts"| node_store
node_copilot -->|"requests answers"| node_ai_engine
node_audit -->|"reads provenance"| node_store
node_demo -->|"uses demo state"| node_store
node_store -.->|"persists optionally"| node_supabase

click node_app "https://github.com/tousif166/newsih/blob/main/src/App.tsx"
click node_field_input "https://github.com/tousif166/newsih/blob/main/src/components/views/FieldInputCenter.tsx"
click node_store "https://github.com/tousif166/newsih/blob/main/src/services/store.tsx"
click node_ai_engine "https://github.com/tousif166/newsih/blob/main/src/services/aiEngine.ts"
click node_review "https://github.com/tousif166/newsih/blob/main/src/components/views/ReviewCenter.tsx"
click node_conflicts "https://github.com/tousif166/newsih/blob/main/src/components/views/ConflictCenter.tsx"
click node_schedule "https://github.com/tousif166/newsih/blob/main/src/components/views/ScheduleExplorer.tsx"
click node_dashboard "https://github.com/tousif166/newsih/blob/main/src/components/views/ProjectDashboard.tsx"
click node_gantt "https://github.com/tousif166/newsih/blob/main/src/components/views/GanttDigitalTwin.tsx"
click node_whatif "https://github.com/tousif166/newsih/blob/main/src/components/views/WhatIfSimulator.tsx"
click node_activity_dna "https://github.com/tousif166/newsih/blob/main/src/components/views/ActivityDNAView.tsx"
click node_copilot "https://github.com/tousif166/newsih/blob/main/src/components/views/CopilotDrawer.tsx"
click node_audit "https://github.com/tousif166/newsih/blob/main/src/components/views/AuditTrailView.tsx"
click node_demo "https://github.com/tousif166/newsih/blob/main/src/components/views/JudgeDemoWalkthrough.tsx"
click node_login "https://github.com/tousif166/newsih/blob/main/src/components/views/LoginPage.tsx"
click node_seed_data "https://github.com/tousif166/newsih/blob/main/src/services/seedData.ts"
click node_supabase "https://github.com/tousif166/newsih/blob/main/supabase/migrations/20260929_sitesync_schema.sql"

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_field_input,node_review toneBlue
class node_schedule,node_dashboard,node_gantt,node_whatif toneAmber
class node_ai_engine,node_conflicts,node_activity_dna,node_copilot,node_audit toneMint
class node_app,node_store,node_demo,node_login,node_seed_data,node_supabase toneRose
class node_field_user,node_planner_user toneIndigo
```

## Components

### Progress Workflow

- [Field Input](https://github.com/tousif166/newsih/blob/main/src/components/views/FieldInputCenter.tsx): `src/components/views/FieldInputCenter.tsx`
- [AI Review Center](https://github.com/tousif166/newsih/blob/main/src/components/views/ReviewCenter.tsx): `src/components/views/ReviewCenter.tsx`

### Project Controls

- [Schedule Explorer](https://github.com/tousif166/newsih/blob/main/src/components/views/ScheduleExplorer.tsx): `src/components/views/ScheduleExplorer.tsx`
- [Project Dashboard](https://github.com/tousif166/newsih/blob/main/src/components/views/ProjectDashboard.tsx): `src/components/views/ProjectDashboard.tsx`
- [4D Digital Twin](https://github.com/tousif166/newsih/blob/main/src/components/views/GanttDigitalTwin.tsx): `src/components/views/GanttDigitalTwin.tsx`
- [What-If Simulator](https://github.com/tousif166/newsih/blob/main/src/components/views/WhatIfSimulator.tsx): `src/components/views/WhatIfSimulator.tsx`

### Planning Intelligence

- [AI Matcher and Rules](https://github.com/tousif166/newsih/blob/main/src/services/aiEngine.ts): `src/services/aiEngine.ts`
- [Conflict Center](https://github.com/tousif166/newsih/blob/main/src/components/views/ConflictCenter.tsx): `src/components/views/ConflictCenter.tsx`
- [Activity DNA Memory](https://github.com/tousif166/newsih/blob/main/src/components/views/ActivityDNAView.tsx): `src/components/views/ActivityDNAView.tsx`
- [Project Copilot](https://github.com/tousif166/newsih/blob/main/src/components/views/CopilotDrawer.tsx): `src/components/views/CopilotDrawer.tsx`
- [Audit Trail](https://github.com/tousif166/newsih/blob/main/src/components/views/AuditTrailView.tsx): `src/components/views/AuditTrailView.tsx`

### App and Data

- [Application Router](https://github.com/tousif166/newsih/blob/main/src/App.tsx): `src/App.tsx`
- [Reactive Store](https://github.com/tousif166/newsih/blob/main/src/services/store.tsx): `src/services/store.tsx`
- [Guided Demo](https://github.com/tousif166/newsih/blob/main/src/components/views/JudgeDemoWalkthrough.tsx): `src/components/views/JudgeDemoWalkthrough.tsx`
- [Login](https://github.com/tousif166/newsih/blob/main/src/components/views/LoginPage.tsx): `src/components/views/LoginPage.tsx`
- [Synthetic Project Data](https://github.com/tousif166/newsih/blob/main/src/services/seedData.ts): `src/services/seedData.ts`
- [Supabase Database](https://github.com/tousif166/newsih/blob/main/supabase/migrations/20260929_sitesync_schema.sql): `supabase/migrations/20260929_sitesync_schema.sql`

### Other components

- **Field Supervisor**
- **Planner**

## Connections

- Field Supervisor → Field Input: reports progress (evidence: `README.md`)
- Planner → AI Review Center: reviews matches (evidence: `README.md`)
- Application Router → Field Input: routes to (evidence: `src/App.tsx`)
- Application Router → AI Review Center: routes to (evidence: `src/App.tsx`)
- Application Router → Schedule Explorer: routes to (evidence: `src/App.tsx`)
- Application Router → Project Dashboard: routes to (evidence: `src/App.tsx`)
- Application Router → 4D Digital Twin: routes to (evidence: `src/App.tsx`)
- Application Router → What-If Simulator: routes to (evidence: `src/App.tsx`)
- Application Router → Login: renders (evidence: `src/App.tsx`)
- Field Input → Reactive Store: submits reports (evidence: `src/components/views/FieldInputCenter.tsx`)
- Reactive Store → AI Matcher and Rules: extracts events (evidence: `src/services/store.tsx`)
- Reactive Store → Synthetic Project Data: loads demo data (evidence: `src/services/store.tsx`)
- AI Review Center → Reactive Store: reads review state (evidence: `src/components/views/ReviewCenter.tsx`)
- Conflict Center → Reactive Store: reads conflicts (evidence: `src/components/views/ConflictCenter.tsx`)
- Schedule Explorer → Reactive Store: reads schedule (evidence: `src/components/views/ScheduleExplorer.tsx`)
- Project Dashboard → Reactive Store: reads project state (evidence: `src/components/views/ProjectDashboard.tsx`)
- 4D Digital Twin → Reactive Store: reads schedule state (evidence: `src/components/views/GanttDigitalTwin.tsx`)
- What-If Simulator → Reactive Store: uses scenarios (evidence: `src/components/views/WhatIfSimulator.tsx`)
- Reactive Store → AI Matcher and Rules: simulates scenarios (evidence: `src/services/store.tsx`)
- Activity DNA Memory → Reactive Store: reads activity data (evidence: `src/components/views/ActivityDNAView.tsx`)
- Project Copilot → Reactive Store: reads project facts (evidence: `src/components/views/CopilotDrawer.tsx`)
- Project Copilot → AI Matcher and Rules: requests answers (evidence: `src/components/views/CopilotDrawer.tsx`)
- Audit Trail → Reactive Store: reads provenance (evidence: `src/components/views/AuditTrailView.tsx`)
- Guided Demo → Reactive Store: uses demo state (evidence: `src/components/views/JudgeDemoWalkthrough.tsx`)
- Reactive Store → Supabase Database: persists optionally
