This function turns a mapped data frame or data.table to a payload ready for upload.
generate_payload( dt, program_id = "program_id", status = "COMPLETED", storedBy = "old / archive import" )
dt | A mapped data.table or data frame to transform. |
---|---|
program_id | The ID of the event program. |
status | The status of events. By default, events are marked as completed. |
storedBy | A reference of the imports. If its an historical upload it better to lebale them as "old / archive import". |
A transformed data.frame.
generate_payload
is typically used in a map or apply function but you can also directly supply a mapped data.table or
data frame.
if (FALSE) { # transform a single dt to a payload generate_payload(dt, program_id = "idgtsybkji2") # transform a list of data frames to a payload purrr::map(dt, generate_payload) }