# everlynmartins/adaptive-predictive-maintenance-platform architecture

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

- Interactive diagram: https://gitdiagram.com/everlynmartins/adaptive-predictive-maintenance-platform
- Repository: https://github.com/everlynmartins/adaptive-predictive-maintenance-platform

## Overview

This is an FD001 predictive-maintenance demonstrator: a simulator replays a unit’s telemetry, and the serving workflow applies a selected telemetry policy and frozen scientific artifacts to return cycle-by-cycle horizon risk and alerts. FastAPI persists operational predictions and alerts; Streamlit uses the API for serving and history. Separate scientific branches cover model training and evaluation, explainability and uncertainty, and telemetry-reduction experiments. The README documents the main service/API/persistence flow; some internal orchestration links are based on the README or SOURCE INDEX rather than complete source excerpts.

Main entry points: [`src/predictive_maintenance/application/local_service.py`](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/application/local_service.py) (Application service), [`src/predictive_maintenance/core/records.py`](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/core/records.py) (Prediction contracts), [`src/predictive_maintenance/api/main.py`](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/api/main.py) (FastAPI serving), [`src/predictive_maintenance/data/cmapss.py`](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/data/cmapss.py) (C-MAPSS data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_serving["Serving and operations"]
  node_simulator["Telemetry replay"]
  node_dashboard["Streamlit dashboard<br/>[streamlit_app.py]"]
  node_http_client["API client<br/>[api_client.py]"]
  node_api["FastAPI serving<br/>[main.py]"]
  node_service["Application service<br/>[local_service.py]"]
  node_persistence[("Operational persistence<br/>[persistence.py]")]
end

subgraph group_science["Scientific models"]
  node_classical_train["Classical training"]
  node_tree_models["Tree risk models<br/>[classical.py]"]
  node_weibull["Weibull baseline<br/>[weibull.py]"]
  node_hazard["Discrete hazard<br/>[discrete_hazard.py]"]
  node_tcn["TCN model<br/>[tcn.py]"]
  node_transformer["Transformer model<br/>[transformer.py]"]
  node_anomaly["Anomaly diagnostics"]
  node_fusion["Probability fusion<br/>[probabilistic.py]"]
end

subgraph group_data["Data and telemetry"]
  node_records["Prediction contracts<br/>[records.py]"]
  node_cmapss["C-MAPSS data<br/>[cmapss.py]"]
  node_targets["Target construction<br/>[targets.py]"]
  node_splitting["Unit-wise splitting<br/>[splitting.py]"]
  node_filtering["Telemetry policies<br/>[policies.py]"]
  node_features["Causal features<br/>[causal.py]"]
end

subgraph group_evaluation["Evaluation and analysis"]
  node_analysis["FD001 analysis<br/>[fd001.py]"]
  node_explainability["Explainability and uncertainty"]
  node_telemetry_experiments["Telemetry experiments<br/>[experiment.py]"]
end

node_operator(("Operator"))
node_postgres[("PostgreSQL")]

node_simulator -->|"replays scenarios"| node_api
node_operator -->|"selects scenario"| node_dashboard
node_dashboard -->|"uses adapter"| node_http_client
node_http_client -->|"requests serving"| node_api
node_api -->|"runs scenario"| node_service
node_service -->|"uses contracts"| node_records
node_service -.->|"applies policy"| node_filtering
node_service -->|"loads features"| node_features
node_service -->|"loads artifacts"| node_tree_models
node_service -->|"loads artifacts"| node_anomaly
node_service -.->|"uses frozen models"| node_fusion
node_api -->|"persists records"| node_persistence
node_persistence -->|"stores history"| node_postgres
node_api -->|"serves results"| node_dashboard
node_cmapss -.->|"builds labels"| node_targets
node_cmapss -.->|"provides units"| node_splitting
node_classical_train -->|"engineers inputs"| node_features
node_classical_train -->|"trains models"| node_tree_models
node_hazard -->|"returns predictions"| node_records
node_tcn -->|"returns predictions"| node_records
node_transformer -->|"reuses temporal code"| node_tcn
node_fusion -->|"combines risks"| node_records
node_analysis -->|"analyzes schema"| node_cmapss
node_explainability -->|"evaluates models"| node_fusion
node_telemetry_experiments -->|"compares policies"| node_filtering
node_filtering -->|"processes telemetry"| node_records
node_weibull -->|"returns predictions"| node_records

click node_simulator "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/simulator/telemetry_producer.py"
click node_dashboard "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/ui/streamlit_app.py"
click node_http_client "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/ui/api_client.py"
click node_api "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/api/main.py"
click node_service "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/application/local_service.py"
click node_persistence "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/api/persistence.py"
click node_records "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/core/records.py"
click node_cmapss "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/data/cmapss.py"
click node_targets "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/data/targets.py"
click node_splitting "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/data/splitting.py"
click node_filtering "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/filtering/policies.py"
click node_features "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/features/causal.py"
click node_classical_train "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/application/classical_ml_fd001.py"
click node_tree_models "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/ml/classical.py"
click node_weibull "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/reliability/weibull.py"
click node_hazard "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/temporal/discrete_hazard.py"
click node_tcn "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/temporal/tcn.py"
click node_transformer "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/temporal/transformer.py"
click node_anomaly "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/anomaly/isolation_forest.py"
click node_fusion "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/fusion/probabilistic.py"
click node_analysis "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/analysis/fd001.py"
click node_explainability "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/application/explainability_uncertainty_fd001.py"
click node_telemetry_experiments "https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/filtering/experiment.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_simulator,node_dashboard,node_http_client,node_api,node_service,node_persistence toneBlue
class node_classical_train,node_tree_models,node_weibull,node_hazard,node_tcn,node_transformer,node_anomaly,node_fusion,node_postgres toneAmber
class node_records,node_cmapss,node_targets,node_splitting,node_filtering,node_features toneMint
class node_analysis,node_explainability,node_telemetry_experiments toneRose
class node_operator toneIndigo
```

## Components

### Serving and operations

- [Telemetry replay](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/simulator/telemetry_producer.py): `src/predictive_maintenance/simulator/telemetry_producer.py`
- [Streamlit dashboard](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/ui/streamlit_app.py): `src/predictive_maintenance/ui/streamlit_app.py`
- [API client](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/ui/api_client.py): `src/predictive_maintenance/ui/api_client.py`
- [FastAPI serving](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/api/main.py): `src/predictive_maintenance/api/main.py`
- [Application service](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/application/local_service.py): `src/predictive_maintenance/application/local_service.py`
- [Operational persistence](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/api/persistence.py): `src/predictive_maintenance/api/persistence.py`

### Scientific models

- [Classical training](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/application/classical_ml_fd001.py): `src/predictive_maintenance/application/classical_ml_fd001.py`
- [Tree risk models](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/ml/classical.py): `src/predictive_maintenance/models/ml/classical.py`
- [Weibull baseline](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/reliability/weibull.py): `src/predictive_maintenance/models/reliability/weibull.py`
- [Discrete hazard](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/temporal/discrete_hazard.py): `src/predictive_maintenance/models/temporal/discrete_hazard.py`
- [TCN model](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/temporal/tcn.py): `src/predictive_maintenance/models/temporal/tcn.py`
- [Transformer model](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/temporal/transformer.py): `src/predictive_maintenance/models/temporal/transformer.py`
- [Anomaly diagnostics](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/anomaly/isolation_forest.py): `src/predictive_maintenance/models/anomaly/isolation_forest.py`
- [Probability fusion](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/models/fusion/probabilistic.py): `src/predictive_maintenance/models/fusion/probabilistic.py`

### Data and telemetry

- [Prediction contracts](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/core/records.py): `src/predictive_maintenance/core/records.py`
- [C-MAPSS data](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/data/cmapss.py): `src/predictive_maintenance/data/cmapss.py`
- [Target construction](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/data/targets.py): `src/predictive_maintenance/data/targets.py`
- [Unit-wise splitting](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/data/splitting.py): `src/predictive_maintenance/data/splitting.py`
- [Telemetry policies](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/filtering/policies.py): `src/predictive_maintenance/filtering/policies.py`
- [Causal features](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/features/causal.py): `src/predictive_maintenance/features/causal.py`

### Evaluation and analysis

- [FD001 analysis](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/analysis/fd001.py): `src/predictive_maintenance/analysis/fd001.py`
- [Explainability and uncertainty](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/application/explainability_uncertainty_fd001.py): `src/predictive_maintenance/application/explainability_uncertainty_fd001.py`
- [Telemetry experiments](https://github.com/everlynmartins/adaptive-predictive-maintenance-platform/blob/main/src/predictive_maintenance/filtering/experiment.py): `src/predictive_maintenance/filtering/experiment.py`

### Other components

- **Operator**
- **PostgreSQL**

## Connections

- Telemetry replay → FastAPI serving: replays scenarios
- Operator → Streamlit dashboard: selects scenario
- Streamlit dashboard → API client: uses adapter (evidence: `src/predictive_maintenance/ui/streamlit_app.py`)
- API client → FastAPI serving: requests serving (evidence: `src/predictive_maintenance/ui/api_client.py`)
- FastAPI serving → Application service: runs scenario (evidence: `src/predictive_maintenance/api/main.py`)
- Application service → Prediction contracts: uses contracts (evidence: `src/predictive_maintenance/application/local_service.py`)
- Application service → Telemetry policies: applies policy
- Application service → Causal features: loads features (evidence: `src/predictive_maintenance/application/local_service.py`)
- Application service → Tree risk models: loads artifacts (evidence: `src/predictive_maintenance/application/local_service.py`)
- Application service → Anomaly diagnostics: loads artifacts (evidence: `src/predictive_maintenance/application/local_service.py`)
- Application service → Probability fusion: uses frozen models
- FastAPI serving → Operational persistence: persists records (evidence: `src/predictive_maintenance/api/main.py`)
- Operational persistence → PostgreSQL: stores history
- FastAPI serving → Streamlit dashboard: serves results
- C-MAPSS data → Target construction: builds labels
- C-MAPSS data → Unit-wise splitting: provides units
- Classical training → Causal features: engineers inputs (evidence: `src/predictive_maintenance/application/classical_ml_fd001.py`)
- Classical training → Tree risk models: trains models (evidence: `src/predictive_maintenance/application/classical_ml_fd001.py`)
- Discrete hazard → Prediction contracts: returns predictions (evidence: `src/predictive_maintenance/models/temporal/discrete_hazard.py`)
- TCN model → Prediction contracts: returns predictions (evidence: `src/predictive_maintenance/models/temporal/tcn.py`)
- Transformer model → TCN model: reuses temporal code (evidence: `src/predictive_maintenance/models/temporal/transformer.py`)
- Probability fusion → Prediction contracts: combines risks (evidence: `src/predictive_maintenance/models/fusion/probabilistic.py`)
- FD001 analysis → C-MAPSS data: analyzes schema (evidence: `src/predictive_maintenance/analysis/fd001.py`)
- Explainability and uncertainty → Probability fusion: evaluates models (evidence: `src/predictive_maintenance/application/explainability_uncertainty_fd001.py`)
- Telemetry experiments → Telemetry policies: compares policies (evidence: `src/predictive_maintenance/filtering/experiment.py`)
- Telemetry policies → Prediction contracts: processes telemetry (evidence: `src/predictive_maintenance/filtering/policies.py`)
- Weibull baseline → Prediction contracts: returns predictions (evidence: `src/predictive_maintenance/models/reliability/weibull.py`)
