# phenological/fusion architecture

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

- Interactive diagram: https://gitdiagram.com/phenological/fusion
- Repository: https://github.com/phenological/fusion

## Overview

Fusion is an R package for structuring metabolomics and phenotyping data produced with NMR and mass spectrometry. Its documented surface includes format-specific parsers, a dataElement representation, data selection and matching utilities, quality checks, calibration and lipid extension, and SPC/ASCVD-related functions. The README identifies rldx and nmr-parser as prerequisites, but the available material does not establish which functions call them or how the capabilities are wired together; the graph therefore shows these as separate product areas without speculative flow arrows.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model["Data model"]
  node_element["dataElement<br/>[ClassDataElement.R]"]
  node_element_access["Element access<br/>[getData.R]"]
  node_element_ids["Element identifiers<br/>[getID.R]"]
  node_element_types["Element types<br/>[getType.R]"]
  node_load_element["Load elements<br/>[load.dataElement.R]"]
end

subgraph group_ingest["Data ingestion"]
  node_parse_nmr["Parse NMR<br/>[parseNMR.R]"]
  node_parse_ms["Parse MS<br/>[parseMS.R]"]
  node_lookup["Lookup data<br/>[lookup.R]"]
end

subgraph group_work["Data operations"]
  node_matching["Match data<br/>[matchTo.R]"]
  node_matching_pairwise["Pairwise matching<br/>[matchPairwise.R]"]
  node_matching_all["Match all<br/>[matchAll.R]"]
  node_selection["Select and filter<br/>[selectWith.R]"]
  node_ordering["Order data<br/>[orderWith.R]"]
  node_joins["Join acquisitions"]
  node_validation["Data checks<br/>[check.R]"]
end

subgraph group_domain["Domain functions"]
  node_calibration["Calibration<br/>[uncalibrate.R]"]
  node_lipid_extension["Lipid extension<br/>[extendLipo.R]"]
  node_spc["SPC generation<br/>[makeSPC.R]"]
  node_ascvd["ASCVD calculation<br/>[calcASCVD.R]"]
end

node_researcher(("Researcher"))

click node_element "https://github.com/phenological/fusion/blob/master/R/ClassDataElement.R"
click node_element_access "https://github.com/phenological/fusion/blob/master/R/getData.R"
click node_element_ids "https://github.com/phenological/fusion/blob/master/R/getID.R"
click node_element_types "https://github.com/phenological/fusion/blob/master/R/getType.R"
click node_load_element "https://github.com/phenological/fusion/blob/master/R/load.dataElement.R"
click node_parse_nmr "https://github.com/phenological/fusion/blob/master/R/parseNMR.R"
click node_parse_ms "https://github.com/phenological/fusion/blob/master/R/parseMS.R"
click node_lookup "https://github.com/phenological/fusion/blob/master/R/lookup.R"
click node_matching "https://github.com/phenological/fusion/blob/master/R/matchTo.R"
click node_matching_pairwise "https://github.com/phenological/fusion/blob/master/R/matchPairwise.R"
click node_matching_all "https://github.com/phenological/fusion/blob/master/R/matchAll.R"
click node_selection "https://github.com/phenological/fusion/blob/master/R/selectWith.R"
click node_ordering "https://github.com/phenological/fusion/blob/master/R/orderWith.R"
click node_joins "https://github.com/phenological/fusion/blob/master/R/leftJoinWithAcqus.R"
click node_validation "https://github.com/phenological/fusion/blob/master/R/check.R"
click node_calibration "https://github.com/phenological/fusion/blob/master/R/uncalibrate.R"
click node_lipid_extension "https://github.com/phenological/fusion/blob/master/R/extendLipo.R"
click node_spc "https://github.com/phenological/fusion/blob/master/R/makeSPC.R"
click node_ascvd "https://github.com/phenological/fusion/blob/master/R/calcASCVD.R"

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_element,node_element_access,node_element_ids,node_element_types,node_load_element toneBlue
class node_parse_nmr,node_parse_ms,node_lookup toneAmber
class node_matching,node_matching_pairwise,node_matching_all,node_selection,node_ordering,node_joins,node_validation toneMint
class node_calibration,node_lipid_extension,node_spc,node_ascvd toneRose
class node_researcher toneIndigo
```

## Components

### Data model

- [dataElement](https://github.com/phenological/fusion/blob/master/R/ClassDataElement.R): `R/ClassDataElement.R`
- [Element access](https://github.com/phenological/fusion/blob/master/R/getData.R): `R/getData.R`
- [Element identifiers](https://github.com/phenological/fusion/blob/master/R/getID.R): `R/getID.R`
- [Element types](https://github.com/phenological/fusion/blob/master/R/getType.R): `R/getType.R`
- [Load elements](https://github.com/phenological/fusion/blob/master/R/load.dataElement.R): `R/load.dataElement.R`

### Data ingestion

- [Parse NMR](https://github.com/phenological/fusion/blob/master/R/parseNMR.R): `R/parseNMR.R`
- [Parse MS](https://github.com/phenological/fusion/blob/master/R/parseMS.R): `R/parseMS.R`
- [Lookup data](https://github.com/phenological/fusion/blob/master/R/lookup.R): `R/lookup.R`

### Data operations

- [Match data](https://github.com/phenological/fusion/blob/master/R/matchTo.R): `R/matchTo.R`
- [Pairwise matching](https://github.com/phenological/fusion/blob/master/R/matchPairwise.R): `R/matchPairwise.R`
- [Match all](https://github.com/phenological/fusion/blob/master/R/matchAll.R): `R/matchAll.R`
- [Select and filter](https://github.com/phenological/fusion/blob/master/R/selectWith.R): `R/selectWith.R`
- [Order data](https://github.com/phenological/fusion/blob/master/R/orderWith.R): `R/orderWith.R`
- [Join acquisitions](https://github.com/phenological/fusion/blob/master/R/leftJoinWithAcqus.R): `R/leftJoinWithAcqus.R`
- [Data checks](https://github.com/phenological/fusion/blob/master/R/check.R): `R/check.R`

### Domain functions

- [Calibration](https://github.com/phenological/fusion/blob/master/R/uncalibrate.R): `R/uncalibrate.R`
- [Lipid extension](https://github.com/phenological/fusion/blob/master/R/extendLipo.R): `R/extendLipo.R`
- [SPC generation](https://github.com/phenological/fusion/blob/master/R/makeSPC.R): `R/makeSPC.R`
- [ASCVD calculation](https://github.com/phenological/fusion/blob/master/R/calcASCVD.R): `R/calcASCVD.R`

### Other components

- **Researcher**
