Gilead-BioStats / clindata

Synthetic Data for testing and development
https://gilead-biostats.github.io/clindata/
Apache License 2.0
9 stars 0 forks source link

Update snapshot function #76

Closed jwildfire closed 2 years ago

jwildfire commented 2 years ago

Update snapshot workflow to create a single snapshot on a given date. Something like this will be used in conjuction with GSM:

for (date in list_of_dates){
   rawplus <- clindata::make_snapshot()
   snap <- gsm::makesnapshot(data=rawplus)
   status <- checksnapshot(snap) # compare to current spec
   save(snap)
}
samussiah commented 2 years ago
for (snapshot_date in clindata::config_schedule$snapshot_date) {
    print(snapshot_date)

    out_path <- paste0(as.character(snapshot_date), '/')
    if (!file.exists(out_path))
        dir.create(out_path)

    data <- snapshot_all(snapshot_date)
    snapshot <- Make_Snapshot(lData = data) # assessment <- Study_Assess(data)
    iwalk(snapshot, function(value, key) {
        data.table::fwrite(
            value,
            paste0(out_path, key, '.csv')
        )
    })
    #jsonlite::toJSON(snapshot, auto_unbox = TRUE, pretty = TRUE) %>%
    #    writeLines(paste0(out_path, 'gsm_snapshot.json')) # stack_attack(snapshot$assessment, data$snapshot_date)
}