# malkudkarnitya-creator/sih26054_phm_v2 architecture

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

- Interactive diagram: https://gitdiagram.com/malkudkarnitya-creator/sih26054_phm_v2
- Repository: https://github.com/malkudkarnitya-creator/sih26054_phm_v2

## Overview

This UAV propulsion-health monitoring product ingests flight telemetry, estimates engine state, compares it with a physics model, classifies faults, and derives mission guidance. Users interact through a React command dashboard and a Streamlit ground-control dashboard; the FastAPI backend also exposes a persistent digital twin with telemetry, history, fleet, mission, and what-if operations. The graph emphasizes relationships visible in excerpts or the source index; unsampled UI and backend subsystems are represented at their existing directory paths, with uncertain links omitted.

Main entry points: [`dashboard.py`](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/dashboard.py) (Ground-control dashboard), [`backend/api/main.py`](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/api/main.py) (FastAPI endpoints), [`src/uav_health/experiment_runner/runner.py`](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/experiment_runner/runner.py) (Experiment runner), [`src/uav_health/pipeline/runner.py`](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/pipeline/runner.py) (Analysis pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Operator interfaces"]
  node_react_app["React command app<br/>[App.jsx]"]
  node_mission_ui["Mission dashboard<br/>[Dashboard.jsx]"]
  node_mission_state["Mission state<br/>[useMission.js]"]
  node_v2_ui["Twin interface"]
  node_streamlit["Ground-control dashboard<br/>[dashboard.py]"]
  node_http_client["PHM API client<br/>[phmApi.js]"]
end

subgraph group_api["API and twin"]
  node_api_service["FastAPI endpoints<br/>[main.py]"]
  node_api_contracts["API data models<br/>[models.py]"]
  node_twin_routes["Twin routes<br/>[router.py]"]
  node_twin_service["Twin service<br/>[service.py]"]
  node_twin_models["Twin state models<br/>[model.py]"]
  node_twin_schemas["Twin request schemas<br/>[schemas.py]"]
  node_twin_db[("Twin SQLite history<br/>[service.py]")]
end

subgraph group_analysis["Health analysis"]
  node_estimator["EKF estimator<br/>[ekf.py]"]
  node_engine_model["Engine physics model<br/>[engine_model.py]"]
  node_residuals["Residual generator"]
  node_classifier["Fault classifier<br/>[classifier.py]"]
end

subgraph group_operations["Mission operations"]
  node_decision["Mission decision<br/>[decision.py]"]
  node_pipeline["Analysis pipeline<br/>[runner.py]"]
  node_replay["Replay engine<br/>[replay.py]"]
  node_experiments["Experiment runner<br/>[runner.py]"]
  node_validation["Validation metrics<br/>[metrics.py]"]
  node_flight_data["Flight data loading"]
  node_fault_injection["Fault injection"]
  node_digital_twin_lib["Digital twin model<br/>[digital_twin.py]"]
end

node_operator(("Operator"))

node_operator -->|"uses"| node_react_app
node_react_app -->|"routes to"| node_mission_ui
node_react_app -.->|"routes to"| node_v2_ui
node_mission_ui -->|"reads"| node_mission_state
node_mission_state -.->|"loads data"| node_http_client
node_operator -->|"uses"| node_streamlit
node_http_client -.->|"requests"| node_api_service
node_api_service -->|"validates with"| node_api_contracts
node_api_service -->|"estimates"| node_estimator
node_api_service -->|"predicts with"| node_engine_model
node_api_service -->|"calculates"| node_residuals
node_api_service -->|"classifies with"| node_classifier
node_api_service -->|"decides with"| node_decision
node_api_service -->|"registers"| node_twin_routes
node_twin_routes -->|"dispatches to"| node_twin_service
node_twin_routes -->|"validates with"| node_twin_schemas
node_twin_service -->|"updates"| node_twin_models
node_twin_service -->|"persists"| node_twin_db
node_pipeline -->|"loads"| node_flight_data
node_pipeline -->|"uses"| node_estimator
node_pipeline -->|"uses"| node_engine_model
node_pipeline -->|"uses"| node_residuals
node_pipeline -->|"uses"| node_classifier
node_pipeline -->|"uses"| node_decision
node_replay -->|"uses"| node_flight_data
node_replay -->|"uses"| node_estimator
node_replay -->|"uses"| node_engine_model
node_replay -->|"uses"| node_residuals
node_replay -->|"uses"| node_classifier
node_replay -->|"uses"| node_decision
node_experiments -->|"uses"| node_estimator
node_experiments -->|"uses"| node_classifier
node_experiments -->|"uses"| node_fault_injection
node_experiments -->|"uses"| node_decision
node_experiments -->|"uses"| node_engine_model
node_experiments -->|"uses"| node_residuals
node_experiments -->|"measures with"| node_validation
node_streamlit -->|"runs"| node_experiments
node_streamlit -->|"uses"| node_estimator
node_streamlit -->|"uses"| node_classifier
node_streamlit -->|"uses"| node_fault_injection
node_streamlit -->|"uses"| node_decision
node_streamlit -->|"uses"| node_engine_model
node_streamlit -->|"uses"| node_residuals
node_streamlit -->|"uses"| node_validation

click node_react_app "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/frontend/src/App.jsx"
click node_mission_ui "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/frontend/src/pages/Dashboard.jsx"
click node_mission_state "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/frontend/src/hooks/useMission.js"
click node_v2_ui "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/tree/main/frontend/src/v2"
click node_streamlit "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/dashboard.py"
click node_http_client "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/frontend/src/api/phmApi.js"
click node_api_service "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/api/main.py"
click node_api_contracts "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/api/models.py"
click node_twin_routes "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/twin/router.py"
click node_twin_service "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/twin/service.py"
click node_twin_models "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/twin/model.py"
click node_twin_schemas "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/twin/schemas.py"
click node_twin_db "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/twin/service.py"
click node_estimator "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/ekf/ekf.py"
click node_engine_model "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/physics_model/engine_model.py"
click node_residuals "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/residual_generator.py"
click node_classifier "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/fault_classifier/classifier.py"
click node_decision "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/mission_decision/decision.py"
click node_pipeline "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/pipeline/runner.py"
click node_replay "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/replay_engine/replay.py"
click node_experiments "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/experiment_runner/runner.py"
click node_validation "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/validation_metrics/metrics.py"
click node_flight_data "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/tree/main/src/uav_health/flight_data"
click node_fault_injection "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/tree/main/src/uav_health/fault_injection"
click node_digital_twin_lib "https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/digital_twin/digital_twin.py"

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_react_app,node_mission_ui,node_mission_state,node_v2_ui,node_streamlit,node_http_client toneBlue
class node_api_service,node_api_contracts,node_twin_routes,node_twin_service,node_twin_models,node_twin_schemas,node_twin_db toneAmber
class node_estimator,node_engine_model,node_residuals,node_classifier toneMint
class node_decision,node_pipeline,node_replay,node_experiments,node_validation,node_flight_data,node_fault_injection,node_digital_twin_lib toneRose
class node_operator toneIndigo
```

## Components

### Operator interfaces

- [React command app](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Mission dashboard](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Mission state](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/frontend/src/hooks/useMission.js): `frontend/src/hooks/useMission.js`
- [Twin interface](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/tree/main/frontend/src/v2): `frontend/src/v2`
- [Ground-control dashboard](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/dashboard.py): `dashboard.py`
- [PHM API client](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/frontend/src/api/phmApi.js): `frontend/src/api/phmApi.js`

### API and twin

- [FastAPI endpoints](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/api/main.py): `backend/api/main.py`
- [API data models](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/api/models.py): `backend/api/models.py`
- [Twin routes](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/twin/router.py): `backend/twin/router.py`
- [Twin service](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/twin/service.py): `backend/twin/service.py`
- [Twin state models](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/twin/model.py): `backend/twin/model.py`
- [Twin request schemas](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/twin/schemas.py): `backend/twin/schemas.py`
- [Twin SQLite history](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/backend/twin/service.py): `backend/twin/service.py`

### Health analysis

- [EKF estimator](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/ekf/ekf.py): `src/uav_health/ekf/ekf.py`
- [Engine physics model](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/physics_model/engine_model.py): `src/uav_health/physics_model/engine_model.py`
- [Residual generator](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/residual_generator.py): `src/uav_health/residual_generator.py`
- [Fault classifier](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/fault_classifier/classifier.py): `src/uav_health/fault_classifier/classifier.py`

### Mission operations

- [Mission decision](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/mission_decision/decision.py): `src/uav_health/mission_decision/decision.py`
- [Analysis pipeline](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/pipeline/runner.py): `src/uav_health/pipeline/runner.py`
- [Replay engine](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/replay_engine/replay.py): `src/uav_health/replay_engine/replay.py`
- [Experiment runner](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/experiment_runner/runner.py): `src/uav_health/experiment_runner/runner.py`
- [Validation metrics](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/validation_metrics/metrics.py): `src/uav_health/validation_metrics/metrics.py`
- [Flight data loading](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/tree/main/src/uav_health/flight_data): `src/uav_health/flight_data`
- [Fault injection](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/tree/main/src/uav_health/fault_injection): `src/uav_health/fault_injection`
- [Digital twin model](https://github.com/malkudkarnitya-creator/sih26054_phm_v2/blob/main/src/uav_health/digital_twin/digital_twin.py): `src/uav_health/digital_twin/digital_twin.py`

### Other components

- **Operator**

## Connections

- Operator → React command app: uses (evidence: `frontend/src/App.jsx`)
- React command app → Mission dashboard: routes to (evidence: `frontend/src/App.jsx`)
- React command app → Twin interface: routes to
- Mission dashboard → Mission state: reads (evidence: `frontend/src/pages/Dashboard.jsx`)
- Mission state → PHM API client: loads data
- Operator → Ground-control dashboard: uses (evidence: `dashboard.py`)
- PHM API client → FastAPI endpoints: requests
- FastAPI endpoints → API data models: validates with (evidence: `backend/api/main.py`)
- FastAPI endpoints → EKF estimator: estimates (evidence: `backend/api/main.py`)
- FastAPI endpoints → Engine physics model: predicts with (evidence: `backend/api/main.py`)
- FastAPI endpoints → Residual generator: calculates (evidence: `backend/api/main.py`)
- FastAPI endpoints → Fault classifier: classifies with (evidence: `backend/api/main.py`)
- FastAPI endpoints → Mission decision: decides with (evidence: `backend/api/main.py`)
- FastAPI endpoints → Twin routes: registers (evidence: `backend/api/main.py`)
- Twin routes → Twin service: dispatches to (evidence: `backend/twin/router.py`)
- Twin routes → Twin request schemas: validates with (evidence: `backend/twin/router.py`)
- Twin service → Twin state models: updates (evidence: `backend/twin/service.py`)
- Twin service → Twin SQLite history: persists (evidence: `backend/twin/service.py`)
- Analysis pipeline → Flight data loading: loads (evidence: `src/uav_health/pipeline/runner.py`)
- Analysis pipeline → EKF estimator: uses (evidence: `src/uav_health/pipeline/runner.py`)
- Analysis pipeline → Engine physics model: uses (evidence: `src/uav_health/pipeline/runner.py`)
- Analysis pipeline → Residual generator: uses (evidence: `src/uav_health/pipeline/runner.py`)
- Analysis pipeline → Fault classifier: uses (evidence: `src/uav_health/pipeline/runner.py`)
- Analysis pipeline → Mission decision: uses (evidence: `src/uav_health/pipeline/runner.py`)
- Replay engine → Flight data loading: uses (evidence: `src/uav_health/replay_engine/replay.py`)
- Replay engine → EKF estimator: uses (evidence: `src/uav_health/replay_engine/replay.py`)
- Replay engine → Engine physics model: uses (evidence: `src/uav_health/replay_engine/replay.py`)
- Replay engine → Residual generator: uses (evidence: `src/uav_health/replay_engine/replay.py`)
- Replay engine → Fault classifier: uses (evidence: `src/uav_health/replay_engine/replay.py`)
- Replay engine → Mission decision: uses (evidence: `src/uav_health/replay_engine/replay.py`)
- Experiment runner → EKF estimator: uses (evidence: `src/uav_health/experiment_runner/runner.py`)
- Experiment runner → Fault classifier: uses (evidence: `src/uav_health/experiment_runner/runner.py`)
- Experiment runner → Fault injection: uses (evidence: `src/uav_health/experiment_runner/runner.py`)
- Experiment runner → Mission decision: uses (evidence: `src/uav_health/experiment_runner/runner.py`)
- Experiment runner → Engine physics model: uses (evidence: `src/uav_health/experiment_runner/runner.py`)
- Experiment runner → Residual generator: uses (evidence: `src/uav_health/experiment_runner/runner.py`)
- Experiment runner → Validation metrics: measures with (evidence: `src/uav_health/experiment_runner/runner.py`)
- Ground-control dashboard → Experiment runner: runs (evidence: `dashboard.py`)
- Ground-control dashboard → EKF estimator: uses (evidence: `dashboard.py`)
- Ground-control dashboard → Fault classifier: uses (evidence: `dashboard.py`)
- Ground-control dashboard → Fault injection: uses (evidence: `dashboard.py`)
- Ground-control dashboard → Mission decision: uses (evidence: `dashboard.py`)
- Ground-control dashboard → Engine physics model: uses (evidence: `dashboard.py`)
- Ground-control dashboard → Residual generator: uses (evidence: `dashboard.py`)
- Ground-control dashboard → Validation metrics: uses (evidence: `dashboard.py`)
