Skip to content

Optionally use event_id instead of event_name for "Visits" on the Start tab #199

@aclark02-arcus

Description

@aclark02-arcus

In the code below, we want to be able to give app developers the option to use event_id for brevity sake. Some orgs' studies may have really long event_names so swapping for event_id could be SO much more concise... so that visits columns isn't extremely wide.

get_static_overview_data <- function(
    data, 
    expected_general_columns = NULL
){
  stopifnot(is.list(data))
  expected_general_columns <- expected_general_columns %||% character(0)
  stopifnot(is.character(expected_general_columns))
  visits <- data |> 
    bind_rows_custom("item_value") |> 
    dplyr::filter(
      !is.na(event_name), 
      !event_name %in% c("Any visit", "Exit"),
      !is.na(subject_id)
    ) |> 
    dplyr::arrange(subject_id, day) |> 
    dplyr::distinct(subject_id, event_name) |> 
    collapse_column_vals(group_by = "subject_id") |> 
    dplyr::distinct()
  
  create_table.general(
    data[["General"]], 
    expected_columns = expected_general_columns
  ) |>
    dplyr::select(tidyr::all_of("subject_id"), tidyr::any_of(c("status", "WHO.classification", "Age", "Sex"))) |>
    dplyr::left_join(visits, by = "subject_id")
}

The most important section below, for the proposed change:

dplyr::distinct(subject_id, event_name) |> 
collapse_column_vals(group_by = "subject_id") |> 

I envision the change being a new function argument... but doesn't it also need to be in the metadata.xlsx??? This could be a study-specific change...

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions