# nikunjgoyal0344-coder/ertmac-nwis architecture

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

- Interactive diagram: https://gitdiagram.com/nikunjgoyal0344-coder/ertmac-nwis
- Repository: https://github.com/nikunjgoyal0344-coder/ertmac-nwis

## Overview

eRTMAC-NWIS is an offset-well intelligence product for drilling operations: engineers compare nearby wells and historical incidents, assess hazards ahead of the bit, and review recommended mitigations. The README describes spatial matching, predictive risk, report intelligence, and governance capabilities; sampled backend code confirms dataset serving, document upload, parsing, and risk calculations. Several frontend modules and integrations are represented by their documented roles because their implementation was not sampled, so their internal wiring is not inferred.

Main entry points: [`frontend/src/App.tsx`](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/App.tsx) (Operations Console), [`frontend/src/components/RiskEngineSimulator.tsx`](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/RiskEngineSimulator.tsx) (Hydraulics Simulator), [`backend/app/core/risk_engine.py`](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/backend/app/core/risk_engine.py) (Look-Ahead Risk Engine), [`frontend/src/components/DocumentIngestionStudio.tsx`](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/DocumentIngestionStudio.tsx) (Report Ingestion Studio)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Drilling Intelligence"]
  node_console["Operations Console<br/>[App.tsx]"]
  node_radar["Well Radar"]
  node_subsurface["3D Well Twin"]
  node_logs["Well Log Comparison"]
  node_risk_ui["Risk Intelligence"]
  node_simulator["Hydraulics Simulator"]
  node_risk_engine["Look-Ahead Risk Engine<br/>[risk_engine.py]"]
  node_geo_engine["Spatial Engine<br/>[geospatial.py]"]
  node_explain["XAI Alert Review"]
end

subgraph group_documents["Report Intelligence"]
  node_ingestion_ui["Report Ingestion Studio"]
  node_parser["PDF Entity Parser<br/>[pdf_parser.py]"]
  node_rag["Institutional Memory Search"]
end

subgraph group_platform["Service And Data"]
  node_dataset[("Well Dataset<br/>[nwis_dataset.json]")]
  node_ingest_api["Document Upload API<br/>[main.py]"]
  node_api_ingest["Ingest Handler<br/>[ingest.js]"]
end

subgraph group_governance["Security And Governance"]
  node_security_ui["Security Command Center"]
  node_governance_ui["Governance And Trends"]
  node_audit_api["Audit API<br/>[audit.js]"]
end

node_engineer(("Drilling Engineer"))

node_engineer -->|"uses"| node_console
node_console -->|"presents"| node_radar
node_console -->|"presents"| node_subsurface
node_console -->|"presents"| node_logs
node_console -->|"presents"| node_risk_ui
node_console -->|"presents"| node_simulator
node_console -->|"presents"| node_ingestion_ui
node_console -->|"presents"| node_rag
node_console -->|"opens"| node_explain
node_console -->|"presents"| node_security_ui
node_console -->|"presents"| node_governance_ui
node_geo_engine -->|"reads"| node_dataset
node_risk_engine -.->|"calculates risk for"| node_risk_ui
node_simulator -.->|"evaluates scenarios with"| node_risk_engine
node_ingestion_ui -.->|"uploads reports to"| node_ingest_api
node_ingest_api -.->|"parses report text with"| node_parser
node_engineer -.->|"submits report to"| node_api_ingest
node_console -.->|"records audit events via"| node_audit_api

click node_console "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/App.tsx"
click node_radar "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/GeospatialRadar2D.tsx"
click node_subsurface "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/Subsurface3DMap.tsx"
click node_logs "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/WellLogComparison.tsx"
click node_risk_ui "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/Phase3RiskIntelligence.tsx"
click node_simulator "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/RiskEngineSimulator.tsx"
click node_risk_engine "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/backend/app/core/risk_engine.py"
click node_geo_engine "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/backend/app/core/geospatial.py"
click node_dataset "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/backend/data/nwis_dataset.json"
click node_ingestion_ui "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/DocumentIngestionStudio.tsx"
click node_parser "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/backend/app/core/pdf_parser.py"
click node_rag "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/InstitutionalMemoryRAG.tsx"
click node_ingest_api "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/backend/app/main.py"
click node_api_ingest "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/api/ingest.js"
click node_explain "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/ExplainAlertModal.tsx"
click node_security_ui "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/SecurityCommandCenter.tsx"
click node_governance_ui "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/Phase4GovernanceAndTrends.tsx"
click node_audit_api "https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/api/audit.js"

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_console,node_radar,node_subsurface,node_logs,node_risk_ui,node_simulator,node_risk_engine,node_geo_engine,node_explain toneBlue
class node_ingestion_ui,node_parser,node_rag toneAmber
class node_dataset,node_ingest_api,node_api_ingest toneMint
class node_security_ui,node_governance_ui,node_audit_api toneRose
class node_engineer toneIndigo
```

## Components

### Drilling Intelligence

- [Operations Console](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Well Radar](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/GeospatialRadar2D.tsx): `frontend/src/components/GeospatialRadar2D.tsx`
- [3D Well Twin](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/Subsurface3DMap.tsx): `frontend/src/components/Subsurface3DMap.tsx`
- [Well Log Comparison](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/WellLogComparison.tsx): `frontend/src/components/WellLogComparison.tsx`
- [Risk Intelligence](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/Phase3RiskIntelligence.tsx): `frontend/src/components/Phase3RiskIntelligence.tsx`
- [Hydraulics Simulator](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/RiskEngineSimulator.tsx): `frontend/src/components/RiskEngineSimulator.tsx`
- [Look-Ahead Risk Engine](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/backend/app/core/risk_engine.py): `backend/app/core/risk_engine.py`
- [Spatial Engine](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/backend/app/core/geospatial.py): `backend/app/core/geospatial.py`
- [XAI Alert Review](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/ExplainAlertModal.tsx): `frontend/src/components/ExplainAlertModal.tsx`

### Report Intelligence

- [Report Ingestion Studio](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/DocumentIngestionStudio.tsx): `frontend/src/components/DocumentIngestionStudio.tsx`
- [PDF Entity Parser](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/backend/app/core/pdf_parser.py): `backend/app/core/pdf_parser.py`
- [Institutional Memory Search](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/InstitutionalMemoryRAG.tsx): `frontend/src/components/InstitutionalMemoryRAG.tsx`

### Service And Data

- [Well Dataset](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/backend/data/nwis_dataset.json): `backend/data/nwis_dataset.json`
- [Document Upload API](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/backend/app/main.py): `backend/app/main.py`
- [Ingest Handler](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/api/ingest.js): `api/ingest.js`

### Security And Governance

- [Security Command Center](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/SecurityCommandCenter.tsx): `frontend/src/components/SecurityCommandCenter.tsx`
- [Governance And Trends](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/frontend/src/components/Phase4GovernanceAndTrends.tsx): `frontend/src/components/Phase4GovernanceAndTrends.tsx`
- [Audit API](https://github.com/nikunjgoyal0344-coder/ertmac-nwis/blob/main/api/audit.js): `api/audit.js`

### Other components

- **Drilling Engineer**

## Connections

- Drilling Engineer → Operations Console: uses
- Operations Console → Well Radar: presents
- Operations Console → 3D Well Twin: presents
- Operations Console → Well Log Comparison: presents
- Operations Console → Risk Intelligence: presents
- Operations Console → Hydraulics Simulator: presents
- Operations Console → Report Ingestion Studio: presents
- Operations Console → Institutional Memory Search: presents
- Operations Console → XAI Alert Review: opens
- Operations Console → Security Command Center: presents
- Operations Console → Governance And Trends: presents
- Spatial Engine → Well Dataset: reads
- Look-Ahead Risk Engine → Risk Intelligence: calculates risk for
- Hydraulics Simulator → Look-Ahead Risk Engine: evaluates scenarios with
- Report Ingestion Studio → Document Upload API: uploads reports to
- Document Upload API → PDF Entity Parser: parses report text with
- Drilling Engineer → Ingest Handler: submits report to
- Operations Console → Audit API: records audit events via
