# harshal1428/wellsight architecture

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

- Interactive diagram: https://gitdiagram.com/harshal1428/wellsight
- Repository: https://github.com/harshal1428/wellsight

## Overview

WELLSIGHT is a well-operations decision-support workspace: engineers review monitoring and offset-well context, investigate historical evidence and risk, manage alerts and review records, and use reports or an AI assistant to support decisions. The visible implementation is primarily a React client using local reference data and browser state; the README describes broader production integrations that are not represented as implemented runtime components here. Relationships below follow sampled imports/calls, the source index, or documented routes and capabilities.

Main entry points: [`src/App.tsx`](https://github.com/harshal1428/wellsight/blob/main/src/App.tsx) (Application routes), [`src/hooks/useWellContext.tsx`](https://github.com/harshal1428/wellsight/blob/main/src/hooks/useWellContext.tsx) (Active well context), [`src/data/intelligenceCasework.ts`](https://github.com/harshal1428/wellsight/blob/main/src/data/intelligenceCasework.ts) (Case evidence), [`src/pages/LiveWellPage.tsx`](https://github.com/harshal1428/wellsight/blob/main/src/pages/LiveWellPage.tsx) (Well monitoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application and well state"]
  node_app["Application routes<br/>[App.tsx]"]
  node_wellstate["Active well context<br/>[useWellContext.tsx]"]
  node_mockdata[("Reference well data<br/>[mockData.ts]")]
end

subgraph group_operations["Well operations"]
  node_monitor["Well monitoring<br/>[LiveWellPage.tsx]"]
  node_channels["Monitoring channels"]
  node_scenario["Scenario playback"]
  node_nearby["Nearby wells"]
  node_map["Well map<br/>[WellMap.tsx]"]
  node_correlation["Well correlation"]
end

subgraph group_intelligence["Historical intelligence"]
  node_knowledge["Historical knowledge<br/>[KnowledgePage.tsx]"]
  node_casework["Case evidence"]
  node_documents["Case documents<br/>[caseDocuments.ts]"]
  node_intelhub["Intelligence hub"]
  node_intelpages["Intelligence investigations"]
end

subgraph group_review["Risk and follow-up"]
  node_risk["Risk scoring<br/>[riskScoring.ts]"]
  node_alerts["Alert generation<br/>[alertGeneration.ts]"]
  node_alertpage["Alert review<br/>[AlertsPage.tsx]"]
  node_feedback["Engineer feedback"]
end

subgraph group_assist["Import, reports, and assistant"]
  node_imports["Data import<br/>[DataImportPage.tsx]"]
  node_reports["Engineering reports<br/>[ReportsPage.tsx]"]
  node_reportpreview["Report preview<br/>[ReportPreview.tsx]"]
  node_chat["WELLSIGHT assistant<br/>[ChatPage.tsx]"]
  node_chatapi["Chat API<br/>[chat.ts]"]
  node_gemini["Gemini service<br/>[gemini.ts]"]
end

node_engineer(("Engineer"))

node_engineer -->|"uses"| node_app
node_app -->|"provides context"| node_wellstate
node_app -->|"routes to"| node_monitor
node_app -->|"routes to"| node_nearby
node_app -->|"routes to"| node_correlation
node_app -->|"routes to"| node_knowledge
node_app -->|"routes to"| node_intelhub
node_app -->|"routes to"| node_intelpages
node_app -->|"routes to"| node_alertpage
node_app -->|"routes to"| node_imports
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_chat
node_wellstate -->|"reads"| node_mockdata
node_wellstate -->|"generates"| node_alerts
node_alerts -->|"uses scoring"| node_risk
node_monitor -->|"reads context"| node_wellstate
node_monitor -->|"uses channels"| node_channels
node_scenario -->|"reads series"| node_mockdata
node_nearby -->|"reads context"| node_wellstate
node_nearby -->|"renders map"| node_map
node_correlation -->|"reads context"| node_wellstate
node_knowledge -->|"reads context"| node_wellstate
node_knowledge -->|"inspects cases"| node_casework
node_casework -->|"resolves evidence"| node_documents
node_intelhub -->|"reads context"| node_wellstate
node_intelpages -->|"reads context"| node_wellstate
node_intelpages -->|"collects cases"| node_casework
node_alertpage -->|"reads alerts"| node_wellstate
node_feedback -->|"reads context"| node_wellstate
node_feedback -->|"collects cases"| node_casework
node_reports -->|"assembles preview"| node_reportpreview
node_reportpreview -->|"reads context"| node_wellstate
node_chat -->|"uses well context"| node_wellstate
node_chatapi -->|"invokes"| node_gemini

click node_app "https://github.com/harshal1428/wellsight/blob/main/src/App.tsx"
click node_wellstate "https://github.com/harshal1428/wellsight/blob/main/src/hooks/useWellContext.tsx"
click node_mockdata "https://github.com/harshal1428/wellsight/blob/main/src/data/mockData.ts"
click node_monitor "https://github.com/harshal1428/wellsight/blob/main/src/pages/LiveWellPage.tsx"
click node_channels "https://github.com/harshal1428/wellsight/blob/main/src/data/monitoringChannels.ts"
click node_scenario "https://github.com/harshal1428/wellsight/blob/main/src/hooks/useScenarioStream.ts"
click node_nearby "https://github.com/harshal1428/wellsight/blob/main/src/pages/NearbyWellsPage.tsx"
click node_map "https://github.com/harshal1428/wellsight/blob/main/src/components/map/WellMap.tsx"
click node_correlation "https://github.com/harshal1428/wellsight/blob/main/src/pages/CorrelationPage.tsx"
click node_knowledge "https://github.com/harshal1428/wellsight/blob/main/src/pages/KnowledgePage.tsx"
click node_casework "https://github.com/harshal1428/wellsight/blob/main/src/data/intelligenceCasework.ts"
click node_documents "https://github.com/harshal1428/wellsight/blob/main/src/data/caseDocuments.ts"
click node_intelhub "https://github.com/harshal1428/wellsight/blob/main/src/pages/IntelligencePage.tsx"
click node_intelpages "https://github.com/harshal1428/wellsight/tree/main/src/pages/intelligence"
click node_risk "https://github.com/harshal1428/wellsight/blob/main/src/utils/riskScoring.ts"
click node_alerts "https://github.com/harshal1428/wellsight/blob/main/src/utils/alertGeneration.ts"
click node_alertpage "https://github.com/harshal1428/wellsight/blob/main/src/pages/AlertsPage.tsx"
click node_feedback "https://github.com/harshal1428/wellsight/blob/main/src/pages/intelligence/EngineerFeedbackPage.tsx"
click node_imports "https://github.com/harshal1428/wellsight/blob/main/src/pages/DataImportPage.tsx"
click node_reports "https://github.com/harshal1428/wellsight/blob/main/src/pages/ReportsPage.tsx"
click node_reportpreview "https://github.com/harshal1428/wellsight/blob/main/src/components/reports/ReportPreview.tsx"
click node_chat "https://github.com/harshal1428/wellsight/blob/main/src/pages/ChatPage.tsx"
click node_chatapi "https://github.com/harshal1428/wellsight/blob/main/api/chat.ts"
click node_gemini "https://github.com/harshal1428/wellsight/blob/main/server/gemini.ts"

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_wellstate,node_mockdata toneBlue
class node_monitor,node_channels,node_scenario,node_nearby,node_map,node_correlation toneAmber
class node_knowledge,node_casework,node_documents,node_intelhub,node_intelpages toneMint
class node_risk,node_alerts,node_alertpage,node_feedback toneRose
class node_imports,node_reports,node_reportpreview,node_chat,node_chatapi,node_gemini,node_engineer toneIndigo
```

## Components

### Application and well state

- [Application routes](https://github.com/harshal1428/wellsight/blob/main/src/App.tsx): `src/App.tsx`
- [Active well context](https://github.com/harshal1428/wellsight/blob/main/src/hooks/useWellContext.tsx): `src/hooks/useWellContext.tsx`
- [Reference well data](https://github.com/harshal1428/wellsight/blob/main/src/data/mockData.ts): `src/data/mockData.ts`

### Well operations

- [Well monitoring](https://github.com/harshal1428/wellsight/blob/main/src/pages/LiveWellPage.tsx): `src/pages/LiveWellPage.tsx`
- [Monitoring channels](https://github.com/harshal1428/wellsight/blob/main/src/data/monitoringChannels.ts): `src/data/monitoringChannels.ts`
- [Scenario playback](https://github.com/harshal1428/wellsight/blob/main/src/hooks/useScenarioStream.ts): `src/hooks/useScenarioStream.ts`
- [Nearby wells](https://github.com/harshal1428/wellsight/blob/main/src/pages/NearbyWellsPage.tsx): `src/pages/NearbyWellsPage.tsx`
- [Well map](https://github.com/harshal1428/wellsight/blob/main/src/components/map/WellMap.tsx): `src/components/map/WellMap.tsx`
- [Well correlation](https://github.com/harshal1428/wellsight/blob/main/src/pages/CorrelationPage.tsx): `src/pages/CorrelationPage.tsx`

### Historical intelligence

- [Historical knowledge](https://github.com/harshal1428/wellsight/blob/main/src/pages/KnowledgePage.tsx): `src/pages/KnowledgePage.tsx`
- [Case evidence](https://github.com/harshal1428/wellsight/blob/main/src/data/intelligenceCasework.ts): `src/data/intelligenceCasework.ts`
- [Case documents](https://github.com/harshal1428/wellsight/blob/main/src/data/caseDocuments.ts): `src/data/caseDocuments.ts`
- [Intelligence hub](https://github.com/harshal1428/wellsight/blob/main/src/pages/IntelligencePage.tsx): `src/pages/IntelligencePage.tsx`
- [Intelligence investigations](https://github.com/harshal1428/wellsight/tree/main/src/pages/intelligence): `src/pages/intelligence`

### Risk and follow-up

- [Risk scoring](https://github.com/harshal1428/wellsight/blob/main/src/utils/riskScoring.ts): `src/utils/riskScoring.ts`
- [Alert generation](https://github.com/harshal1428/wellsight/blob/main/src/utils/alertGeneration.ts): `src/utils/alertGeneration.ts`
- [Alert review](https://github.com/harshal1428/wellsight/blob/main/src/pages/AlertsPage.tsx): `src/pages/AlertsPage.tsx`
- [Engineer feedback](https://github.com/harshal1428/wellsight/blob/main/src/pages/intelligence/EngineerFeedbackPage.tsx): `src/pages/intelligence/EngineerFeedbackPage.tsx`

### Import, reports, and assistant

- [Data import](https://github.com/harshal1428/wellsight/blob/main/src/pages/DataImportPage.tsx): `src/pages/DataImportPage.tsx`
- [Engineering reports](https://github.com/harshal1428/wellsight/blob/main/src/pages/ReportsPage.tsx): `src/pages/ReportsPage.tsx`
- [Report preview](https://github.com/harshal1428/wellsight/blob/main/src/components/reports/ReportPreview.tsx): `src/components/reports/ReportPreview.tsx`
- [WELLSIGHT assistant](https://github.com/harshal1428/wellsight/blob/main/src/pages/ChatPage.tsx): `src/pages/ChatPage.tsx`
- [Chat API](https://github.com/harshal1428/wellsight/blob/main/api/chat.ts): `api/chat.ts`
- [Gemini service](https://github.com/harshal1428/wellsight/blob/main/server/gemini.ts): `server/gemini.ts`

### Other components

- **Engineer**

## Connections

- Engineer → Application routes: uses
- Application routes → Active well context: provides context (evidence: `src/App.tsx`)
- Application routes → Well monitoring: routes to (evidence: `src/App.tsx`)
- Application routes → Nearby wells: routes to (evidence: `src/App.tsx`)
- Application routes → Well correlation: routes to (evidence: `src/App.tsx`)
- Application routes → Historical knowledge: routes to (evidence: `src/App.tsx`)
- Application routes → Intelligence hub: routes to (evidence: `src/App.tsx`)
- Application routes → Intelligence investigations: routes to (evidence: `src/App.tsx`)
- Application routes → Alert review: routes to (evidence: `src/App.tsx`)
- Application routes → Data import: routes to (evidence: `src/App.tsx`)
- Application routes → Engineering reports: routes to (evidence: `src/App.tsx`)
- Application routes → WELLSIGHT assistant: routes to (evidence: `src/App.tsx`)
- Active well context → Reference well data: reads (evidence: `src/hooks/useWellContext.tsx`)
- Active well context → Alert generation: generates (evidence: `src/hooks/useWellContext.tsx`)
- Alert generation → Risk scoring: uses scoring (evidence: `src/utils/alertGeneration.ts`)
- Well monitoring → Active well context: reads context (evidence: `src/pages/LiveWellPage.tsx`)
- Well monitoring → Monitoring channels: uses channels (evidence: `src/pages/LiveWellPage.tsx`)
- Scenario playback → Reference well data: reads series (evidence: `src/hooks/useScenarioStream.ts`)
- Nearby wells → Active well context: reads context (evidence: `src/pages/NearbyWellsPage.tsx`)
- Nearby wells → Well map: renders map (evidence: `src/pages/NearbyWellsPage.tsx`)
- Well correlation → Active well context: reads context (evidence: `src/pages/CorrelationPage.tsx`)
- Historical knowledge → Active well context: reads context (evidence: `src/pages/KnowledgePage.tsx`)
- Historical knowledge → Case evidence: inspects cases (evidence: `src/pages/KnowledgePage.tsx`)
- Case evidence → Case documents: resolves evidence (evidence: `src/pages/intelligence/EvidenceChainPage.tsx`)
- Intelligence hub → Active well context: reads context (evidence: `src/pages/IntelligencePage.tsx`)
- Intelligence investigations → Active well context: reads context (evidence: `src/pages/intelligence/EngineerFeedbackPage.tsx`)
- Intelligence investigations → Case evidence: collects cases (evidence: `src/pages/intelligence/EngineerFeedbackPage.tsx`)
- Alert review → Active well context: reads alerts (evidence: `src/pages/AlertsPage.tsx`)
- Engineer feedback → Active well context: reads context (evidence: `src/pages/intelligence/EngineerFeedbackPage.tsx`)
- Engineer feedback → Case evidence: collects cases (evidence: `src/pages/intelligence/EngineerFeedbackPage.tsx`)
- Engineering reports → Report preview: assembles preview (evidence: `src/components/reports/ReportPreview.tsx`)
- Report preview → Active well context: reads context (evidence: `src/components/reports/ReportPreview.tsx`)
- WELLSIGHT assistant → Active well context: uses well context (evidence: `src/pages/ChatPage.tsx`)
- Chat API → Gemini service: invokes (evidence: `api/chat.ts`)
