For the complete documentation index, see llms.txt. This page is also available as Markdown.

Longitudinal trajectories

Explore how repeated numerical measurements, such as PSA, tumor mutational burden, or tumor size, change over time within patients and across patient groups.

Explore how repeated numerical measurements, such as PSA, tumor mutational burden, or tumor size, change over time within patients and across patient groups.

Individual patient trajectories

Description

Analysis summary

Preserves each patient's repeated numeric measurements over time without combining patients or assigning categories. Supports inspection of individual longitudinal changes.

Computation

Retains unique patient/time/measurement combinations sorted by patient and time. An optional baseline shift subtracts each patient's earliest time, converting dates to elapsed days; alternatively, ordinal alignment replaces successive observations with shared visit-rank labels. The result table contains individual measurements and original or transformed times. A single descriptive row summarises all retained patients: distinct-patient count, observation count, mean, median, minimum, maximum and sample standard deviation of the measurements across time. No longitudinal model, change estimate or hypothesis test is fitted.

When to use

Use for 'how does this measurement change in each patient?' with repeated samples or events at different timepoints. This analysis is value-based: it requires a numeric measurement and summarises its evolution, not the occurrence, ordering or duration of clinical events. For which treatments a patient received, when, and for how long, use timeline_analysis. Prefer the category-preserving mode to relate individual histories to patient categories, or the aggregated mode for cohort-level trends.

Caveats

Repeated observations at different times are needed to assess change. Exact duplicates are removed, but distinct values at the same patient/time remain separate. Null numeric measurements are excluded. Overall statistics pool observations across visits, so patients with more measurements contribute more heavily; these statistics are not within-patient change summaries. Ordinal alignment discards elapsed intervals and does not establish clinically equivalent visits; tied times receive separate ranks. Baseline shifting and ordinal alignment are mutually exclusive, and baseline shifting needs subtractable times.

Example questions

example questions
  • Show me the PSA over time for each patient.

  • Plot per-patient SNV count trajectories.

Input columns

input columns
column
type
required
description

index

any

required

Event identifier. Smallest level of granularity.

time

date, numeric, categorical

required

Observation time — alias any numeric, date, or categorical timepoint column AS time.

value

numeric

required

Measured numeric quantity (e.g. PSA, tumour size). Alias AS value.

patient_id

any

required

Patient identifier. Required for per-patient trajectories and for population summaries.

Visualizations

  • lineplot How to read: Each line connects one patient's observed measurements, with markers at recorded timepoints and a patient key in the legend. The vertical axis is the measured quantity; the horizontal axis is original time, elapsed time from the patient's first observation (days for date inputs), or ordinal visit labels after alignment. Colours distinguish patients. Rising or falling segments describe observed changes, not fitted trends or values measured between visits. Ordinal spacing does not encode elapsed duration. Only the first patients in sorted identifier order are drawn up to the configured limit; the returned table and descriptive summary still include all retained patients.

Example analysis 1

Name — TMB Trajectories per Patient (MOSAIC Bladder)

Analysis parameters

analysis_name, analysis_params, viz_params

Visualization — lineplot

TMB Trajectories per Patient (MOSAIC Bladder)

Output table

descriptive_stats (1 rows)
n_patients
n_observations
mean
median
min
max
std

15

15

43.15

37.56

27.73

99.89

18.96

Individual patient trajectories with categories

Description

Analysis summary

Preserves individual patients' repeated numeric measurements together with a patient category such as treatment arm or mutation status. Category membership does not combine patients' trajectories.

Computation

Retains unique patient/category/time/measurement combinations, sorted by patient and time, with either original times, per-patient elapsed times from baseline, or ordinal visit ranks. The result table keeps patient-level observations and their categories. The descriptive table contains one row per category with distinct-patient and observation counts, mean, median, minimum, maximum and sample standard deviation of measurements pooled across time. No between-category tests or longitudinal models are computed.

When to use

Use to inspect individual longitudinal changes while relating patients to a category, without averaging their histories. This analysis is value-based: it requires a numeric measurement and summarises its evolution, not the occurrence, ordering or duration of clinical events. For which treatments a patient received, when, and for how long, use timeline_analysis. Prefer the per-patient mode when no category is needed, or the aggregated mode for a cohort-level summary at each timepoint.

Caveats

The category should be constant per patient; changing categories are not modelled as time-varying exposures. Records with null categories or numeric measurements are excluded. Category summaries pool observations over time rather than comparing changes, and uneven sampling weights frequently measured patients more heavily. Distinct measurements at tied times remain separate. Ordinal alignment discards duration and assigns separate ranks to tied times; matching ranks need not represent equivalent clinical visits. Baseline shifting and ordinal alignment are mutually exclusive.

Example questions

example questions
  • Show per-patient PSA trajectories coloured by gender.

  • Plot tumour size per patient, coloured by mutation status, relative to baseline.

Input columns

input columns
column
type
required
description

index

any

required

Event identifier. Smallest level of granularity.

time

date, numeric, categorical

required

Observation time — alias any numeric, date, or categorical timepoint column AS time.

value

numeric

required

Measured numeric quantity (e.g. PSA, tumour size). Alias AS value.

patient_id

any

required

Patient identifier. Required for per-patient trajectories and for population summaries.

color_group

categorical, any

required

Patient-level category retained with individual trajectories and used for descriptive summaries. No aggregation of trajectories is performed. Cannot be combine…

Visualizations

  • lineplot How to read: Each line connects one patient's measurements and markers identify observed timepoints. Line colours and the legend identify categories, not category averages; multiple lines of the same colour remain separate patients. A patient's first retained category determines its line colour. The vertical axis is the measurement and the horizontal axis is original time, time from individual baseline, or ordinal visit rank. Compare within-category variability as well as differences between categories; connected segments are not fitted trends. The display limit selects patients in sorted identifier order, while returned observations and category statistics include all retained patients.

Example analysis 1

Name — TMB Trajectories per Patient Colored by Gender (MOSAIC Bladder)

Analysis parameters

analysis_name, analysis_params, viz_params

Visualization — lineplot

TMB Trajectories per Patient Colored by Gender (MOSAIC Bladder)

Output table

descriptive_stats (2 rows)
color_group
n_patients
n_observations
mean
median
min
max
std

female

4

4

56.1

47.02

30.46

99.89

30.47

male

11

11

38.44

37.44

27.73

64.01

11.54

Group-level longitudinal summaries

Description

Analysis summary

Summarises repeated numeric measurements within patient groups to compare cohort-level patterns over time. Shared observation times or aligned visit ranks allow patients with different recording dates to contribute to comparable timepoints.

Computation

Deduplicates patient/group/time/measurement combinations and optionally shifts each patient's time to baseline or replaces it with ordinal visit ranks. Groups are retained in sorted order up to the requested limit. The returned table keeps patient observations rather than pre-aggregated timepoint values. The descriptive table contains one row per retained group with patient and observation counts, mean, median, minimum, maximum and sample standard deviation pooled across time. Timepoint summaries can use the requested mean or median of observations at exact shared times, or patient-weighted mean and median within time bins: repeated samples within a bin first yield one mean per patient. No repeated-measures model, group-difference test or change estimate is computed.

When to use

Use for 'how does the typical measurement evolve in each treatment arm or cohort?' when comparable timepoints are available. This analysis is value-based: it requires a numeric measurement and summarises its evolution, not the occurrence, ordering or duration of clinical events. For which treatments a patient received, when, and for how long, use timeline_analysis. Prefer ordinal alignment when a common visit sequence is needed rather than actual elapsed intervals. Prefer either individual trajectory mode when patient-to-patient histories or heterogeneous responses matter.

Caveats

Aligned ranks do not guarantee clinically comparable visits and discard elapsed time. Changing patient composition over follow-up can mimic within-patient change. Returned group statistics pool observations, not timepoint summaries, and therefore weight frequent sampling more heavily. Exact-time observation summaries and binned patient-weighted summaries need not agree. The group limit also restricts returned data and statistics. Null groups or numeric measurements are excluded; tied times with different measurements remain separate and get separate ordinal ranks. Baseline shifting and ordinal alignment are mutually exclusive.

Example questions

example questions
  • Show the mean TMB over aligned timepoints per treatment arm.

  • Plot the median tumour-size trajectory per cohort.

Input columns

input columns
column
type
required
description

index

any

required

Event identifier. Smallest level of granularity.

time

date, numeric, categorical

required

Observation time — alias any numeric, date, or categorical timepoint column AS time.

value

numeric

required

Measured numeric quantity (e.g. PSA, tumour size). Alias AS value.

patient_id

any

required

Patient identifier. Required for per-patient trajectories and for population summaries.

x_group

categorical, any

required

Grouping column for aggregated trajectories. Values are aggregated per (x_group, time) pair (e.g. gender AS x_group → one summary per gender and timepoint, usi…

Visualizations

  • lineplot How to read: The vertical axis is the measurement and the horizontal axis is original time, elapsed time from each patient's baseline, or ordinal visits. In Plotly, one line per group connects the selected mean or median of observations at each exact shared time; colours and the legend identify groups. In ECharts, groups occupy separate panels: the solid line is the patient-weighted median and the dashed line the patient-weighted mean, regardless of the requested aggregation. Date inputs use calendar-month bins, numeric inputs use one-unit bins, and categorical visits remain distinct. Repeated samples in a bin first yield one mean per patient. For groups with at least 40 patients, shaded quantile fans span the 5th–95th percentiles in 5-point increments; these show patient variability, not confidence intervals. Hover text reports the bin's median, mean and patient count, plus outer percentiles when shown. Changes can reflect which patients were sampled, not just changes within patients.

Example analysis 1

Name — Mean Measurement Trajectories by Metric (MOSAIC Bladder)

Analysis parameters

analysis_name, analysis_params, viz_params

Visualization — lineplot

Mean Measurement Trajectories by Metric (MOSAIC Bladder)

Output table

descriptive_stats (8 rows)
x_group
n_patients
n_observations
mean
median
min
max
std

tmb

15

15

43.15

37.56

27.73

99.89

18.96

n_snv_target_regions_per_mb

15

15

37.36

31.39

25.99

97.28

17.94

genome_instability_index

15

15

0.02342

0.02252

0.003415

0.059

0.01607

n_indel_target_regions

15

15

193.1

99.0

45.0

788.0

221.4

n_indel

15

15

358.7

230.0

164.0

1085.0

288.2

n_snv_target_regions

15

15

1246.0

1047.0

867.0

3245.0

598.4

n_indel_target_regions_per_mb

15

15

5.79

2.968

1.349

23.62

6.638

n_snv

15

15

2042.0

1846.0

1466.0

4736.0

816.2

Last updated

Was this helpful?