library(dplyr)
library(ggplot2)
library(readr)2 Functional Testing
Functional testing (also called performance-based testing) is an objective measure of a participant’s physical functionality and complements self-reported pain and disability. Before surgery, the Acute to Chronic Pain Signatures Study (A2CPS) collects a short battery of standardized functional tasks and records the pain a participant reports right before and right after each task. The change in pain across a task gives us a measure of movement-evoked pain (MEP), pain that is provoked by movement rather than pain at rest. MEP is increasingly recognized as its own meaningful construct (Corbett et al., 2019).
The battery is tailored to each surgical cohort (Berardi et al., 2022):
- Knee arthroplasty (TKA) cohort: lower-limb function is assessed with two tasks.
- The 10-meter walk test (10MWT), a standard measure of gait speed. Participants rate their pain before and after walking.
- The 5-times sit-to-stand test (5TSTS), which measures lower-limb strength and mobility by timing five repetitions of rising from a chair. Pain is again rated before and after the task.
- Thoracic (thoracic surgery) cohort: since the surgical site is the chest wall, function is assessed with a deep breathing and coughing task, carried in a separate table.
This kit builds on the knee cohort, which has the two lower-limb tasks. The NIMH Data Archive (NDA) table for this cohort uses NDA’s own short field names, which we rename to the HEAL Common Data Element names (Wandner et al., 2022) so the measures match across HEAL studies. For each task the movement-evoked pain is the final pain rating minus the initial rating, so higher values mean more pain was evoked by the movement.
2.1 Starting Project
2.1.1 Locate Data
We assume that the data were downloaded from the NIMH Data Archive (NDA) as a Data Package and saved to data/nda inside the project folder (Appendix C describes what a package contains). Each NDA data structure is a table, <structure>.txt, and any files that the structure references are underneath a folder of the same name, <structure>/. Paths in the text start from the folder that holds the structure’s files (for the MRI data, <structure>/corral-secure/projects/A2CPS/products/consortium-data/pre-surgery), while code chunks spell out the full path from the project folder.
Functional testing is one NDA structure per cohort: heal_ft_tka01 for the TKA cohort and heal_ft_thoracic01 for the thoracic cohort. This kit uses the knee table:
data/nda/heal_ft_tka01.txt2.1.2 Extract Data
The file is a tab-separated table. We read it without its line of column descriptions, convert record_id to a number, and drop any exact duplicate rows so that a participant appears only once. We then derive the surgical cohort from record_id; every record here is TKA.
func_file <- "data/nda/heal_ft_tka01.txt"
# line 2 of an NDA table describes each column, so take names from line 1 and data from line 3
func_names <- names(read_tsv(func_file, n_max = 0, show_col_types = FALSE))
func <- read_tsv(func_file, skip = 2, col_names = func_names) |>
rename(record_id = src_subject_id) |>
mutate(record_id = as.numeric(record_id)) |>
distinct()The downloaded file uses NDA’s short field names (walk10finalpainscl, fivetstsprepainscl, and so on). We rename them to the HEAL Common Data Element names using the A2CPS crosswalk. The 5TSTS fields begin with a digit, so they need backticks when referenced in R.
func_crosswalk <- c(
Walk10InitialPainScl = "walk10initialpainscl",
Walk10finalPainScl = "walk10finalpainscl",
Walk10time = "walk10time",
Walk10CompleteYN = "walk10completeyn",
Walk10IncompleteReason = "walk10incompletereason",
`5TSTSbpscreen` = "fivetstsbpscreen",
`5TSTSprePainScl` = "fivetstsprepainscl",
`5TSTSpostPainScl` = "fivetstspostpainscl",
`5TSTStime` = "fivetststime",
`5TSTSCompleteYN` = "fivetstscompleteyn",
`5TSTSNonReasonYN` = "fivetstsnonreasonyn",
`5TSTSnumbRepsYN` = "fivetstsnumbrepsyn",
`5TSTSassistYN` = "fivetstsassistyn"
)
func <- func |>
rename(all_of(func_crosswalk))NDA provides the raw pain ratings rather than the movement-evoked pain scores, so we compute them here. For each task the score is the final rating minus the initial rating, a plain subtraction, so a missing endpoint leaves the score missing.
func <- func |>
mutate(
mep_walk = Walk10finalPainScl - Walk10InitialPainScl,
mep_5tsts = `5TSTSpostPainScl` - `5TSTSprePainScl`
)A look at the pain ratings and the two movement-evoked pain scores.
func |>
select(
record_id,
Walk10InitialPainScl,
Walk10finalPainScl,
mep_walk,
`5TSTSprePainScl`,
`5TSTSpostPainScl`,
mep_5tsts
) |>
head()| record_id | Walk10InitialPainScl | Walk10finalPainScl | mep_walk | 5TSTSprePainScl | 5TSTSpostPainScl | mep_5tsts |
|---|---|---|---|---|---|---|
| 10099 | 6.5 | 6.5 | 0.0 | 0.0 | 6.0 | 6.0 |
| 10100 | 4.0 | 6.0 | 2.0 | 4.0 | 6.0 | 2.0 |
| 10101 | 0.0 | 0.0 | 0.0 | 0.0 | 0.5 | 0.5 |
| 10104 | 2.5 | 2.5 | 0.0 | 0.5 | 1.0 | 0.5 |
| 10106 | 1.0 | 1.5 | 0.5 | 0.0 | 1.5 | 1.5 |
| 10107 | 0.0 | 1.5 | 1.5 | 1.0 | 3.0 | 2.0 |
Check that the pain ratings and scores are stored as numbers.
func |>
select(record_id, mep_walk, mep_5tsts) |>
glimpse()Rows: 976
Columns: 3
$ record_id <dbl> 10099, 10100, 10101, 10104, 10106, 10107, 10108, 10109, 1011…
$ mep_walk <dbl> 0.0, 2.0, 0.0, 0.0, 0.5, 1.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, …
$ mep_5tsts <dbl> 6.0, 2.0, 0.5, 0.5, 1.5, 2.0, 2.0, -1.0, 0.0, 0.0, 4.0, 0.0,…
2.1.3 Data Quality
The movement-evoked pain scores need both endpoints: mep_walk and mep_5tsts are defined only when both the initial and the final pain rating are present, and are otherwise missing. So expect a modest number of missing scores even among completed tasks. We tally the coverage first.
func |>
summarise(
mep_walk_n = sum(!is.na(mep_walk)),
mep_5tsts_n = sum(!is.na(mep_5tsts))
)| mep_walk_n | mep_5tsts_n |
|---|---|
| 952 | 932 |
2.1.4 Cross-Modality Links
A2CPS relies on several different schemes for labeling and describing metadata entities. For example, across modalities, participants are identified by Record ID, Subject GUID, Individual ID, and NDA GUID. In NDA data structures, the NDA GUID is often stored in a field called subjectkey, and the Record ID is stored in src_subject_id. For more details on how these identifiers relate, see Appendix B.
2.2 Exploratory data analysis
Both tasks evoke pain through movement. If walking and standing provoke pain through a common mechanism, then a participant who is sensitive to one should also be sensitive to the other, and the two scores should track together.
We first compare the two tasks. On average, sit-to-stand evokes noticeably more pain than the 10-meter walk (mean mep_5tsts around 1.8 against mep_walk around 0.7), which makes sense since rising from a chair loads the knee more than walking on level ground does.
func |>
summarise(
across(
c(mep_walk, mep_5tsts),
list(
n = \(x) sum(!is.na(x)),
mean = \(x) mean(x, na.rm = TRUE),
sd = \(x) sd(x, na.rm = TRUE)
)
)
)| mep_walk_n | mep_walk_mean | mep_walk_sd | mep_5tsts_n | mep_5tsts_mean | mep_5tsts_sd |
|---|---|---|---|---|---|
| 952 | 0.657563 | 1.265645 | 932 | 1.832081 | 1.96846 |
Since both scores are bounded, discrete difference scores rather than smooth continuous measures, a spearman (rank-based) correlation is a better choice here than pearson. We add use = "complete.obs" to ignore rows that are missing either score.
cor(func$mep_walk, func$mep_5tsts, method = "spearman", use = "complete.obs")[1] 0.259747
The correlation is positive but modest (around 0.26). So the two tasks are related, but not highly correlated: each one captures a somewhat different aspect of movement-evoked pain, and it is worth looking at both rather than treating one as a surrogate for the other. We visualize the relationship with a boxplot of sit-to-stand MEP grouped by walk MEP.
func |>
filter(!is.na(mep_walk), !is.na(mep_5tsts)) |>
ggplot(aes(x = factor(mep_walk), y = mep_5tsts, fill = factor(mep_walk))) +
geom_boxplot(show.legend = FALSE) +
labs(
title = "Sit-to-stand movement-evoked pain by 10-meter walk movement-evoked pain",
x = "Walk MEP (final minus initial pain)",
y = "5TSTS MEP (post minus pre pain)"
) +
theme_minimal()
2.3 Considerations While Working on the Project
2.3.1 Data Generation
Functional tasks are administered in person by trained study staff, following the A2CPS Manual of Procedures, which specifies the walk course, the sit-to-stand protocol, and the timing of the pre- and post-task pain ratings.
2.3.2 Data Quality
Initial internal versions of this dataset were stored and processed in a different environment than the NDA. The NDA data are relatively more raw, and several additional quality checks are warranted. The A2CPS DIRC is working on producing a workflow describing the checks that we recommend for the NDA data.
2.3.3 Other
- Movement-evoked pain, not resting pain. The scores are change scores tied to a specific task, so they behave differently from resting or clinical pain measures. A score can be negative if pain fell across the task.
- Cohort-specific batteries. The knee and thoracic cohorts do not share tasks, so
mep_walkandmep_5tstsappear only for the knee cohort; the thoracic table (heal_ft_thoracic01) carries the deep breathing and coughing measures instead. - Sample size after merging. Joining with other modalities can shrink the effective sample size, so the counts are worth a glance after each merge.
2.3.4 Citations
In publications or presentations including data from A2CPS, please include the following statement as attribution:
Data were provided (in part) by the A2CPS Consortium funded by the National Institutes of Health (NIH) Common Fund, which is managed by the Office of the Director (OD)/Office of Strategic Coordination (OSC). Consortium components and their associated funding sources include Clinical Coordinating Center (U24NS112873), Data Integration and Resource Center (U54DA049110), Omics Data Generation Centers (U54DA049116, U54DA049115, U54DA049113), Multi-site Clinical Center 1 (MCC1) (UM1NS112874), and Multi-site Clinical Center 2 (MCC2) (UM1NS118922).