# mobilise-d/mobgap architecture

> Architecture diagram of the GitHub repository mobilise-d/mobgap, 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/mobilise-d/mobgap
- Repository: https://github.com/mobilise-d/mobgap

## Overview

Mobgap is a Python toolbox for estimating gait and mobility outcomes from lower-back IMU data. Its principal workflow runs sensor data through gait-sequence detection and per-bout gait analysis, then assembles walking-bout results and aggregates digital mobility outcomes. Users can also run individual algorithms and evaluation pipelines independently. The tree and README establish these capabilities; sampled source confirms the configurable full-pipeline stages and several evaluation wrappers, but not every internal call, so uncertain wiring is omitted.

Main entry points: [`src/mobgap/pipeline/_mobilised_pipeline.py`](https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/pipeline/_mobilised_pipeline.py) (Full pipeline), [`src/mobgap/data/base.py`](https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/data/base.py) (Gait dataset), [`src/mobgap/data`](https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/data) (Dataset loaders), [`src/mobgap/aggregation`](https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/aggregation) (DMO aggregation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Data input"]
  node_datasets["Dataset loaders"]
  node_dataset["Gait dataset<br/>[base.py]"]
end

subgraph group_analysis["Gait analysis"]
  node_fullpipe["Full pipeline"]
  node_gsd["Gait sequences"]
  node_reorient["Reorientation"]
  node_icd["Initial contacts"]
  node_laterality["Laterality"]
  node_cadence["Cadence"]
  node_stride["Stride length"]
  node_speed["Walking speed"]
  node_turning["Turn detection"]
end

subgraph group_outcomes["Outcome assembly"]
  node_selection["Stride selection"]
  node_assembly["Bout assembly<br/>[_wb_assembly.py]"]
  node_aggregation["DMO aggregation"]
  node_results["Gait outcomes"]
end

subgraph group_evaluation["Evaluation"]
  node_evaluation["Evaluation tools<br/>[evaluation.py]"]
  node_validation["Validation results"]
  node_emulation["Algorithm wrappers<br/>[pipeline.py]"]
end

node_user(("Researcher"))
node_imu["IMU data"]

node_user -->|"selects data"| node_datasets
node_imu -->|"provides recordings"| node_datasets
node_datasets -->|"loads"| node_dataset
node_user -->|"runs"| node_fullpipe
node_dataset -->|"provides datapoint"| node_fullpipe
node_fullpipe -->|"detects sequences"| node_gsd
node_fullpipe -->|"configures correction"| node_reorient
node_fullpipe -->|"configures detection"| node_icd
node_fullpipe -->|"configures classification"| node_laterality
node_fullpipe -->|"configures calculation"| node_cadence
node_fullpipe -->|"configures calculation"| node_stride
node_fullpipe -->|"configures calculation"| node_speed
node_fullpipe -->|"configures detection"| node_turning
node_fullpipe -->|"selects strides"| node_selection
node_fullpipe -->|"assembles bouts"| node_assembly
node_fullpipe -->|"aggregates outcomes"| node_aggregation
node_aggregation -->|"produces"| node_results
node_user -->|"evaluates algorithm"| node_emulation
node_dataset -->|"provides reference data"| node_emulation
node_user -->|"analyzes performance"| node_evaluation
node_evaluation -->|"reads results"| node_validation

click node_datasets "https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/data"
click node_dataset "https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/data/base.py"
click node_fullpipe "https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/pipeline/_mobilised_pipeline.py"
click node_gsd "https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/gait_sequences"
click node_reorient "https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/re_orientation"
click node_icd "https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/initial_contacts"
click node_laterality "https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/laterality"
click node_cadence "https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/cadence"
click node_stride "https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/stride_length"
click node_speed "https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/walking_speed"
click node_turning "https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/turning"
click node_selection "https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/wba/_stride_selection.py"
click node_assembly "https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/wba/_wb_assembly.py"
click node_aggregation "https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/aggregation"
click node_evaluation "https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/pipeline/evaluation.py"
click node_validation "https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/data/validation_results.py"
click node_emulation "https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/stride_length/pipeline.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_datasets,node_dataset toneBlue
class node_fullpipe,node_gsd,node_reorient,node_icd,node_laterality,node_cadence,node_stride,node_speed,node_turning toneAmber
class node_selection,node_assembly,node_aggregation,node_results toneMint
class node_evaluation,node_validation,node_emulation toneRose
class node_user,node_imu toneIndigo
```

## Components

### Data input

- [Dataset loaders](https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/data): `src/mobgap/data`
- [Gait dataset](https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/data/base.py): `src/mobgap/data/base.py`

### Gait analysis

- [Full pipeline](https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/pipeline/_mobilised_pipeline.py): `src/mobgap/pipeline/_mobilised_pipeline.py`
- [Gait sequences](https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/gait_sequences): `src/mobgap/gait_sequences`
- [Reorientation](https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/re_orientation): `src/mobgap/re_orientation`
- [Initial contacts](https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/initial_contacts): `src/mobgap/initial_contacts`
- [Laterality](https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/laterality): `src/mobgap/laterality`
- [Cadence](https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/cadence): `src/mobgap/cadence`
- [Stride length](https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/stride_length): `src/mobgap/stride_length`
- [Walking speed](https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/walking_speed): `src/mobgap/walking_speed`
- [Turn detection](https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/turning): `src/mobgap/turning`

### Outcome assembly

- [Stride selection](https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/wba/_stride_selection.py): `src/mobgap/wba/_stride_selection.py`
- [Bout assembly](https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/wba/_wb_assembly.py): `src/mobgap/wba/_wb_assembly.py`
- [DMO aggregation](https://github.com/mobilise-d/mobgap/tree/main/src/mobgap/aggregation): `src/mobgap/aggregation`
- **Gait outcomes**

### Evaluation

- [Evaluation tools](https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/pipeline/evaluation.py): `src/mobgap/pipeline/evaluation.py`
- [Validation results](https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/data/validation_results.py): `src/mobgap/data/validation_results.py`
- [Algorithm wrappers](https://github.com/mobilise-d/mobgap/blob/main/src/mobgap/stride_length/pipeline.py): `src/mobgap/stride_length/pipeline.py`

### Other components

- **Researcher**
- **IMU data**

## Connections

- Researcher → Dataset loaders: selects data
- IMU data → Dataset loaders: provides recordings
- Dataset loaders → Gait dataset: loads
- Researcher → Full pipeline: runs
- Gait dataset → Full pipeline: provides datapoint
- Full pipeline → Gait sequences: detects sequences
- Full pipeline → Reorientation: configures correction
- Full pipeline → Initial contacts: configures detection
- Full pipeline → Laterality: configures classification
- Full pipeline → Cadence: configures calculation
- Full pipeline → Stride length: configures calculation
- Full pipeline → Walking speed: configures calculation
- Full pipeline → Turn detection: configures detection
- Full pipeline → Stride selection: selects strides
- Full pipeline → Bout assembly: assembles bouts
- Full pipeline → DMO aggregation: aggregates outcomes
- DMO aggregation → Gait outcomes: produces
- Researcher → Algorithm wrappers: evaluates algorithm
- Gait dataset → Algorithm wrappers: provides reference data
- Researcher → Evaluation tools: analyzes performance
- Evaluation tools → Validation results: reads results
