# bfast2/bfast architecture

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

- Interactive diagram: https://gitdiagram.com/bfast2/bfast
- Repository: https://github.com/bfast2/bfast

## Overview

bfast is an R package for analyzing time series, especially detecting and monitoring structural change. A principal documented workflow is for a user to provide a time series to `bfastmonitor()` and inspect or plot the result. The package tree also exposes preprocessing, time-series conversion, alternative analysis functions, and result visualization. The README documents performance-option controls and optimized C++ paths, but the supplied excerpts do not show how R functions call those paths, so those relationships are not inferred here.

Main entry points: [`R/bfastmonitor.R`](https://github.com/bfast2/bfast/blob/master/R/bfastmonitor.R) (Change monitor), [`R/zzz.R`](https://github.com/bfast2/bfast/blob/master/R/zzz.R) (Performance options)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Analysis"]
  node_bfast["BFAST<br/>[bfast.R]"]
  node_monitor["Change monitor<br/>[bfastmonitor.R]"]
  node_lite["BFAST lite<br/>[bfastlite.R]"]
  node_bfast01["BFAST 01<br/>[bfast01.R]"]
  node_classify["Break classification<br/>[bfast01classify.R]"]
  node_historybreak["Historical breaks<br/>[history_break.R]"]
  node_historyroc["Historical ROC<br/>[history_roc.R]"]
  node_seasonal["Seasonal analysis<br/>[seasonal.R]"]
end

subgraph group_preparation["Time-series preparation"]
  node_preprocess["BFAST preprocessing<br/>[bfastpp.R]"]
  node_timeseries["Time-series conversion<br/>[bfastts.R]"]
  node_create16day["16-day series creation<br/>[create16dayts.R]"]
  node_cppclosest["Closest-date routine<br/>[bfastts.cpp]"]
end

subgraph group_results["Results and options"]
  node_plotbfast["BFAST plots<br/>[plot.bfast.R]"]
  node_plotmonitor["Monitor plots"]
  node_printbfast["BFAST output<br/>[print.bfast.R]"]
  node_printmonitor["Monitor output"]
  node_options["Performance options<br/>[zzz.R]"]
end

node_user(("Analyst"))

node_user -->|"runs"| node_monitor
node_user -->|"sets options"| node_options

click node_bfast "https://github.com/bfast2/bfast/blob/master/R/bfast.R"
click node_monitor "https://github.com/bfast2/bfast/blob/master/R/bfastmonitor.R"
click node_lite "https://github.com/bfast2/bfast/blob/master/R/bfastlite.R"
click node_bfast01 "https://github.com/bfast2/bfast/blob/master/R/bfast01.R"
click node_classify "https://github.com/bfast2/bfast/blob/master/R/bfast01classify.R"
click node_historybreak "https://github.com/bfast2/bfast/blob/master/R/history_break.R"
click node_historyroc "https://github.com/bfast2/bfast/blob/master/R/history_roc.R"
click node_preprocess "https://github.com/bfast2/bfast/blob/master/R/bfastpp.R"
click node_timeseries "https://github.com/bfast2/bfast/blob/master/R/bfastts.R"
click node_create16day "https://github.com/bfast2/bfast/blob/master/R/create16dayts.R"
click node_seasonal "https://github.com/bfast2/bfast/blob/master/R/seasonal.R"
click node_plotbfast "https://github.com/bfast2/bfast/blob/master/R/plot.bfast.R"
click node_plotmonitor "https://github.com/bfast2/bfast/blob/master/R/plot.bfastmonitor.R"
click node_printbfast "https://github.com/bfast2/bfast/blob/master/R/print.bfast.R"
click node_printmonitor "https://github.com/bfast2/bfast/blob/master/R/print.bfastmonitor.R"
click node_options "https://github.com/bfast2/bfast/blob/master/R/zzz.R"
click node_cppclosest "https://github.com/bfast2/bfast/blob/master/src/bfastts.cpp"

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_bfast,node_monitor,node_lite,node_bfast01,node_classify,node_historybreak,node_historyroc,node_seasonal toneBlue
class node_preprocess,node_timeseries,node_create16day,node_cppclosest toneAmber
class node_plotbfast,node_plotmonitor,node_printbfast,node_printmonitor,node_options toneMint
class node_user toneIndigo
```

## Components

### Analysis

- [BFAST](https://github.com/bfast2/bfast/blob/master/R/bfast.R): `R/bfast.R`
- [Change monitor](https://github.com/bfast2/bfast/blob/master/R/bfastmonitor.R): `R/bfastmonitor.R`
- [BFAST lite](https://github.com/bfast2/bfast/blob/master/R/bfastlite.R): `R/bfastlite.R`
- [BFAST 01](https://github.com/bfast2/bfast/blob/master/R/bfast01.R): `R/bfast01.R`
- [Break classification](https://github.com/bfast2/bfast/blob/master/R/bfast01classify.R): `R/bfast01classify.R`
- [Historical breaks](https://github.com/bfast2/bfast/blob/master/R/history_break.R): `R/history_break.R`
- [Historical ROC](https://github.com/bfast2/bfast/blob/master/R/history_roc.R): `R/history_roc.R`
- [Seasonal analysis](https://github.com/bfast2/bfast/blob/master/R/seasonal.R): `R/seasonal.R`

### Time-series preparation

- [BFAST preprocessing](https://github.com/bfast2/bfast/blob/master/R/bfastpp.R): `R/bfastpp.R`
- [Time-series conversion](https://github.com/bfast2/bfast/blob/master/R/bfastts.R): `R/bfastts.R`
- [16-day series creation](https://github.com/bfast2/bfast/blob/master/R/create16dayts.R): `R/create16dayts.R`
- [Closest-date routine](https://github.com/bfast2/bfast/blob/master/src/bfastts.cpp): `src/bfastts.cpp`

### Results and options

- [BFAST plots](https://github.com/bfast2/bfast/blob/master/R/plot.bfast.R): `R/plot.bfast.R`
- [Monitor plots](https://github.com/bfast2/bfast/blob/master/R/plot.bfastmonitor.R): `R/plot.bfastmonitor.R`
- [BFAST output](https://github.com/bfast2/bfast/blob/master/R/print.bfast.R): `R/print.bfast.R`
- [Monitor output](https://github.com/bfast2/bfast/blob/master/R/print.bfastmonitor.R): `R/print.bfastmonitor.R`
- [Performance options](https://github.com/bfast2/bfast/blob/master/R/zzz.R): `R/zzz.R`

### Other components

- **Analyst**

## Connections

- Analyst → Change monitor: runs (evidence: `README.md`)
- Analyst → Performance options: sets options (evidence: `README.md`)
