Skip to contents

[Stable]

This function generates a summary table for a report by joining the provided results data frame with the site-level metadata from dfGroups. It then filters and arranges the data based on certain conditions and displays the result in a datatable.

Usage

Report_MetricTable(
  dfResults,
  dfGroups = NULL,
  strGroupLevel = c("Site", "Country", "Study"),
  strGroupDetailsParams = NULL,
  vFlags = c(-2, -1, 1, 2)
)

Arguments

dfResults

data.frame A stacked summary of analysis pipeline output. Created by passing a list of results returned by Summarize() to BindResults(). Expected columns: GroupID, GroupLevel, Numerator, Denominator, Metric, Score, Flag, MetricID, StudyID, SnapshotDate. For this function, dfResults must be filtered to a single KRI (MetricID).

dfGroups

data.frame Group-level metadata dictionary. Created by passing CTMS site and study data to MakeLongMeta(). Expected columns: GroupID, GroupLevel, Param, Value.

strGroupLevel

group level for the table

strGroupDetailsParams

one or more parameters from dfGroups to be added as columns in the table

vFlags

integer List of flag values to include in output table. Default: c(-2, -1, 1, 2).

Value

A gt::gt() containing the summary table.

Examples

# site-level report
Report_MetricTable(
  dfResults = reportingResults %>%
    dplyr::filter(.data$MetricID == "Analysis_kri0001") %>%
    FilterByLatestSnapshotDate(),
  dfGroups = reportingGroups
)
Group Enrolled Numerator Denominator Metric Score Flag
0X036 (Gonzales) 2 327 6619 0.05 -2.25
0X052 (Agenar) 3 378 7502 0.05 -2.04
0X045 (Horton) 4 383 6013 0.06 2.49
X187X (al-Hasen) 4 521 8423 0.06 2.24
0X027 (Owens) 1 113 1652 0.07 2.11
0X024 (Rinard) 4 491 8002 0.06 2.00
0X004 (Touch) 3 360 7137 0.05 -1.97
0X096 (el-Agha) 4 274 5510 0.05 -1.95
0X057 (Aragon) 1 33 823 0.04 -1.91
0X066 (Lipps) 2 187 3792 0.05 -1.73
0X115 (John) 3 266 5249 0.05 -1.62
0X165 (Pinar) 1 73 1569 0.05 -1.57
0X034 (Yeadon) 2 222 4392 0.05 -1.52
0X179 (Terry) 3 339 6552 0.05 -1.45
0X090 (el-Attar) 4 302 5850 0.05 -1.40
0X166 (Garcia) 5 484 9192 0.05 -1.35
0X123 (Martinez) 1 66 1391 0.05 -1.34
0X143 (el-Salih) 1 66 1391 0.05 -1.34
0X170 (Herlin) 1 66 1391 0.05 -1.34
0X135 (Hager) 2 193 3793 0.05 -1.32
0X029 (Truong) 3 202 3960 0.05 -1.32
0X013 (el-Allam) 2 153 3027 0.05 -1.26
0X177 (Crowe) 3 136 2694 0.05 -1.20
0X042 (el-Massoud) 3 265 5092 0.05 -1.19
0X134 (Keese) 1 111 2219 0.05 -1.18
0X095 (Gonzales) 3 274 5257 0.05 -1.18
0X159 (Flores) 2 193 3743 0.05 -1.14
0X110 (Cleckley) 2 188 3628 0.05 -1.06
0X030 (Hutchinson) 2 111 2191 0.05 -1.05
0X010 (al-Radi) 1 52 1070 0.05 -1.01
0X103 (al-Mona) 3 226 4317 0.05 -1.01
0X121 (Rodriguez-Cruz) 1 73 1467 0.05 -1.00