How qwertypoiuy9/sih-120-final works
Baghewala Digital Twin is a demonstration well-operations application: users inspect simulated well conditions, explore physics-derived views and insights, and run CSS, pump, simulation, or optimization what-ifs. The frontend routes role-based workflows and receives state through REST polling or WebSocket streaming; the FastAPI backend advances an in-process digital-twin state using thermal, viscosity, wellbore, rod, dynamometer, and surface models. Reports and alerts are demo outputs, not field-system integrations. Connections follow the README and shown imports/calls; unsampled page implementations are represented by their existing page paths.
Main entry points: App.tsx App routing · main.py Twin state runtime · api.ts REST client · digitalTwinStore.ts Twin state
Components 29
Operator interface
- App routing
frontend/src/App.tsx - Well views
frontend/src/pages - Live data
frontend/src/pages/LiveData.tsx - CSS control
frontend/src/pages/CSSControl.tsx - Login
frontend/src/pages/LoginPage.tsx - Supervisor dashboard
frontend/src/pages/SupervisorDashboard.tsx - Reports
frontend/src/pages/Reports.tsx - Header
frontend/src/components/Header.tsx - User management
frontend/src/components/UserManagementPanel.tsx - Translations
frontend/src/i18n.ts
Frontend state and access
- REST client
frontend/src/services/api.ts - WebSocket client
frontend/src/services/websocket.ts - Twin state
frontend/src/store/digitalTwinStore.ts - Auth state
frontend/src/store/authStore.ts - Notifications
frontend/src/store/notificationStore.ts - Sidebar state
frontend/src/store/sidebarStore.ts - User state
frontend/src/store/userManagementStore.ts
Simulation backend
- FastAPI endpoints
backend/main.py - Twin state runtime
backend/main.py - Relational database setup
backend/app/database/__init__.py - Well records
backend/app/models/well.py
Physics models
- Thermal decline
backend/app/physics/thermal_model.py - Viscosity
backend/app/physics/viscosity_model.py - Wellbore profiles
backend/app/physics/wellbore_model.py - Rod dynamics
backend/app/physics/rod_dynamics.py - Dynamometer
backend/app/physics/dynamometer_model.py - Rod-float detection
backend/app/physics/rod_float_detector.py - Surface estimates
backend/app/physics/surface_model.py
Other components
- Operator
Connections 34
- Operator → App routing: uses
README.md - App routing → Well views: routes to
frontend/src/App.tsx - App routing → Live data: routes to
frontend/src/App.tsx - App routing → CSS control: routes to
frontend/src/App.tsx - App routing → Login: routes to
frontend/src/App.tsx - App routing → Supervisor dashboard: routes to
frontend/src/App.tsx - App routing → Twin state: updates
frontend/src/App.tsx - App routing → REST client: polls
frontend/src/App.tsx - Well views → Twin state: reads
frontend/src/pages/AIInsights.tsx - Live data → Twin state: reads
frontend/src/pages/LiveData.tsx - CSS control → REST client: submits what-if
frontend/src/pages/CSSControl.tsx - Login → Auth state: sets session
frontend/src/pages/LoginPage.tsx - Login → User state: uses
frontend/src/pages/LoginPage.tsx - Supervisor dashboard → User management: renders
frontend/src/pages/SupervisorDashboard.tsx - Supervisor dashboard → Auth state: reads
frontend/src/pages/SupervisorDashboard.tsx - Reports → REST client: fetches snapshot
frontend/src/pages/Reports.tsx - Reports → Twin state: reads
frontend/src/pages/Reports.tsx - Header → Twin state: reads
frontend/src/components/Header.tsx - Header → Notifications: reads
frontend/src/components/Header.tsx - Header → Auth state: reads
frontend/src/components/Header.tsx - Header → Translations: uses
frontend/src/components/Header.tsx - User management → User state: uses
frontend/src/components/UserManagementPanel.tsx - Operator → REST client: requests data
README.md - REST client → FastAPI endpoints: calls REST
frontend/src/services/api.ts - WebSocket client → FastAPI endpoints: streams telemetry
README.md - FastAPI endpoints → Twin state runtime: serves state
backend/main.py - Twin state runtime → Thermal decline: advances
README.md - Twin state runtime → Viscosity: calculates
README.md - Twin state runtime → Wellbore profiles: calculates
README.md - Twin state runtime → Rod dynamics: calculates
README.md - Twin state runtime → Dynamometer: calculates
README.md - Twin state runtime → Rod-float detection: estimates risk
backend/main.py - Twin state runtime → Surface estimates: calculates
README.md - Well records → Relational database setup: uses base
backend/app/models/well.py