# racemboujelben12345-alt/smartbio_pro architecture

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

- Interactive diagram: https://gitdiagram.com/racemboujelben12345-alt/smartbio_pro
- Repository: https://github.com/racemboujelben12345-alt/smartbio_pro

## Overview

SmartBio PRO is a research platform for quality-gated smartphone optical estimation of hemoglobin and bilirubin. Its principal workflow runs from metadata discovery and explicit canonicalization through integrity checks, patient/device-safe splits, ROI-based optical feature extraction, quantitative safeguards, model evaluation, and robustness reporting. The graph includes the experiment and benchmark gates as an internal control layer. Some documented capabilities have unsampled implementations; those relationships are attributed to the README, and uncertain links are omitted.

Main entry points: [`src/smartbio/cli.py`](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/cli.py) (Command interface), [`src/smartbio/quantitative_runner.py`](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/quantitative_runner.py) (Quantitative runner), [`src/smartbio/benchmark_gate.py`](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/benchmark_gate.py) (Benchmark gate), [`src/smartbio/optical_pipeline.py`](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/optical_pipeline.py) (Optical preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Data intake"]
  node_cli["Command interface<br/>[cli.py]"]
  node_discovery["Schema discovery"]
  node_mapping["Explicit mapping<br/>[schema.py]"]
  node_canonical["Canonical dataset<br/>[canonical.py]"]
  node_adapters["Dataset adapters"]
end

subgraph group_optics["Optical measurement"]
  node_roi["ROI contracts<br/>[roi.py]"]
  node_features["Image features<br/>[features.py]"]
  node_optical["Optical preprocessing"]
  node_biophysics["Biophysical models<br/>[biophysics.py]"]
  node_calibration["Calibration<br/>[calibration.py]"]
end

subgraph group_experiments["Research experiments"]
  node_splits["Safe splits<br/>[splits.py]"]
  node_quant_runner["Quantitative runner"]
  node_regression["Regression evaluation<br/>[regression.py]"]
  node_uncertainty["Uncertainty analysis<br/>[uncertainty.py]"]
  node_robustness["Robustness analysis<br/>[robustness.py]"]
end

subgraph group_assurance["Validation safeguards"]
  node_audit["Integrity audit<br/>[audit.py]"]
  node_acquisition["Acquisition controls<br/>[acquisition.py]"]
  node_target["Target provenance"]
  node_benchmark["Benchmark gate<br/>[benchmark_gate.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs commands"| node_cli
node_cli -->|"discovers schema"| node_discovery
node_cli -->|"canonicalizes with"| node_mapping
node_cli -->|"creates dataset"| node_canonical
node_cli -->|"runs audit"| node_audit
node_cli -->|"creates splits"| node_splits
node_cli -->|"runs features"| node_features
node_cli -->|"audits physics"| node_acquisition
node_adapters -->|"normalizes to"| node_canonical
node_features -->|"uses models"| node_biophysics
node_optical -->|"linearizes RGB"| node_biophysics
node_optical -.->|"masks ROI pixels"| node_roi
node_cli -->|"validates ROI"| node_roi
node_cli -->|"preprocesses ROI"| node_optical
node_acquisition -->|"guards capture physics"| node_biophysics
node_cli -.->|"calibrates measurements"| node_calibration
node_cli -.->|"checks targets"| node_target
node_quant_runner -->|"requests gate"| node_benchmark
node_benchmark -->|"checks capture"| node_acquisition
node_benchmark -->|"validates provenance"| node_target
node_quant_runner -.->|"evaluates predictions"| node_regression
node_quant_runner -.->|"assesses uncertainty"| node_uncertainty
node_cli -.->|"runs experiment"| node_quant_runner
node_cli -->|"reports robustness"| node_robustness
node_cli -->|"ingests datasets"| node_adapters

click node_cli "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/cli.py"
click node_discovery "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/schema_discovery.py"
click node_mapping "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/schema.py"
click node_canonical "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/canonical.py"
click node_adapters "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/dataset_adapters.py"
click node_audit "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/audit.py"
click node_splits "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/splits.py"
click node_roi "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/roi.py"
click node_features "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/features.py"
click node_optical "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/optical_pipeline.py"
click node_biophysics "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/biophysics.py"
click node_acquisition "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/acquisition.py"
click node_calibration "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/calibration.py"
click node_target "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/target_provenance.py"
click node_benchmark "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/benchmark_gate.py"
click node_quant_runner "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/quantitative_runner.py"
click node_regression "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/regression.py"
click node_uncertainty "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/uncertainty.py"
click node_robustness "https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/robustness.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_cli,node_discovery,node_mapping,node_canonical,node_adapters toneBlue
class node_roi,node_features,node_optical,node_biophysics,node_calibration toneAmber
class node_splits,node_quant_runner,node_regression,node_uncertainty,node_robustness toneMint
class node_audit,node_acquisition,node_target,node_benchmark toneRose
class node_researcher toneIndigo
```

## Components

### Data intake

- [Command interface](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/cli.py): `src/smartbio/cli.py`
- [Schema discovery](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/schema_discovery.py): `src/smartbio/schema_discovery.py`
- [Explicit mapping](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/schema.py): `src/smartbio/schema.py`
- [Canonical dataset](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/canonical.py): `src/smartbio/canonical.py`
- [Dataset adapters](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/dataset_adapters.py): `src/smartbio/dataset_adapters.py`

### Optical measurement

- [ROI contracts](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/roi.py): `src/smartbio/roi.py`
- [Image features](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/features.py): `src/smartbio/features.py`
- [Optical preprocessing](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/optical_pipeline.py): `src/smartbio/optical_pipeline.py`
- [Biophysical models](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/biophysics.py): `src/smartbio/biophysics.py`
- [Calibration](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/calibration.py): `src/smartbio/calibration.py`

### Research experiments

- [Safe splits](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/splits.py): `src/smartbio/splits.py`
- [Quantitative runner](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/quantitative_runner.py): `src/smartbio/quantitative_runner.py`
- [Regression evaluation](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/regression.py): `src/smartbio/regression.py`
- [Uncertainty analysis](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/uncertainty.py): `src/smartbio/uncertainty.py`
- [Robustness analysis](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/robustness.py): `src/smartbio/robustness.py`

### Validation safeguards

- [Integrity audit](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/audit.py): `src/smartbio/audit.py`
- [Acquisition controls](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/acquisition.py): `src/smartbio/acquisition.py`
- [Target provenance](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/target_provenance.py): `src/smartbio/target_provenance.py`
- [Benchmark gate](https://github.com/racemboujelben12345-alt/smartbio_pro/blob/main/src/smartbio/benchmark_gate.py): `src/smartbio/benchmark_gate.py`

### Other components

- **Researcher**

## Connections

- Researcher → Command interface: runs commands
- Command interface → Schema discovery: discovers schema (evidence: `src/smartbio/cli.py`)
- Command interface → Explicit mapping: canonicalizes with (evidence: `src/smartbio/cli.py`)
- Command interface → Canonical dataset: creates dataset (evidence: `src/smartbio/cli.py`)
- Command interface → Integrity audit: runs audit (evidence: `src/smartbio/cli.py`)
- Command interface → Safe splits: creates splits (evidence: `src/smartbio/cli.py`)
- Command interface → Image features: runs features (evidence: `src/smartbio/cli.py`)
- Command interface → Acquisition controls: audits physics (evidence: `src/smartbio/cli.py`)
- Dataset adapters → Canonical dataset: normalizes to (evidence: `src/smartbio/dataset_adapters.py`)
- Image features → Biophysical models: uses models (evidence: `src/smartbio/features.py`)
- Optical preprocessing → Biophysical models: linearizes RGB (evidence: `src/smartbio/optical_pipeline.py`)
- Optical preprocessing → ROI contracts: masks ROI pixels
- Command interface → ROI contracts: validates ROI (evidence: `src/smartbio/cli.py`)
- Command interface → Optical preprocessing: preprocesses ROI (evidence: `src/smartbio/cli.py`)
- Acquisition controls → Biophysical models: guards capture physics
- Command interface → Calibration: calibrates measurements
- Command interface → Target provenance: checks targets
- Quantitative runner → Benchmark gate: requests gate (evidence: `src/smartbio/quantitative_runner.py`)
- Benchmark gate → Acquisition controls: checks capture (evidence: `src/smartbio/benchmark_gate.py`)
- Benchmark gate → Target provenance: validates provenance (evidence: `src/smartbio/benchmark_gate.py`)
- Quantitative runner → Regression evaluation: evaluates predictions
- Quantitative runner → Uncertainty analysis: assesses uncertainty
- Command interface → Quantitative runner: runs experiment
- Command interface → Robustness analysis: reports robustness
- Command interface → Dataset adapters: ingests datasets (evidence: `src/smartbio/cli.py`)
