SafetyGraphics / safetyCharts

Charts for monitoring clinical trial safety designed for use with {safetyGraphics}
Other
8 stars 7 forks source link

added ecg domain + QT charts #90

Closed xni7 closed 3 years ago

xni7 commented 3 years ago

Address #81

Summary

This is based on the hard coded prototype , formalized into the {safetyCharts} pkg structure

Test Code

# Sample ADEG data
# https://physionet.org/content/ecgcipa/1.0.0/
# https://physionet.org/content/ecgcipa/1.0.0/adeg.csv

adeg <- readr::read_csv("https://physionet.org/files/ecgcipa/1.0.0/adeg.csv?download") %>%
  mutate(ATPTFCT = forcats::fct_reorder(ATPT, .x = ATPTN, .fun = min)) %>%
  mutate(ANRHI=0, ANRLO=0)

meta_new <- rbind(safetyGraphics::meta, safetyCharts::metaecg)
chartsQT <- makeChartConfig() 

mappings_QT <- read_yaml(text=
"
ecg:
  visit_col: ATPT
  visitn_col: ATPTN
")

safetyGraphicsApp(charts=chartsQT, domainData = list(ecg=adeg), meta = meta_new, mapping = mappings_QT)
jwildfire commented 3 years ago

Looks great, @xni7! Test code above works with no edits on my end.

Going to think a little bit about workflow details for the charts we want to re-use across multiple domains. At the very least, I think we should be able to share the init functions across domains in many cases. Would be nice to avoid the duplication of the chart YAML as well, but will need to think about that (and maybe update safetyGraphics).

jwildfire commented 3 years ago

@xni7 This is working great! I set this up to use the same init functions as the labs domain, and made some minor tweaks to standardize things and clear checks. Going to work on incorporating in to work shop now. Going to go ahead and merge - can tweak further with a different PR if needed.

My test code

adeg <- readr::read_csv("https://physionet.org/files/ecgcipa/1.0.0/adeg.csv?download") %>%
  mutate(ATPTFCT = forcats::fct_reorder(ATPT, .x = ATPTN, .fun = min)) %>%
  mutate(ANRHI=0, ANRLO=0)

mappingsQT <- list(
  ecg=list(
    'visit_col'='ATPT',
    'visitn_col'='ATPTN'
  )
)

safetyGraphicsApp(
    domainData = list(ecg=adeg), 
    meta = safetyCharts::meta_ecg, 
    mapping = mappingsQT
)