It would be helpful to have a function that codifies the recipe for reading the job_summary_data out of a log entry for a group of similar records. The need derives from our use of JSON to store the data, MySQL's inability to parse it, and JSONLite's lack of vectorization. Reading one record of job_summary_data data is easy, but most use cases can't identify the single record of interest or they want records across a span of time. Here's some sample code that reads all the records saved from a script named _warn_owners_of_impendingbill
The interesting part is the last two stanzas of code where we give names to a vector of row IDs to query, iteratively read the JSON from those rows, then join the rest of the log data to the decoded JSON:
Putting just these components into the function allows the caller to decide how many records from what script or scripts get decoded. We already have use cases for this function where we want to inspect logged email send failures generated by multiple scripts. As we logged the email failures the same way in each function, aggregating the send failures across them is trivial with a function like this.
This function will need a name. I offer these suggestions:
_spread_job_summarydata
_decode_job_summarydata
_decode_job_summaryrecords
_decode_jobsummary
_decode_jobsummaries
_read_jobsummaries
We need to keep the distinction in people's minds between the redcapcustodian job logs and REDCap's redcap_log_event table
It would be helpful to have a function that codifies the recipe for reading the job_summary_data out of a log entry for a group of similar records. The need derives from our use of JSON to store the data, MySQL's inability to parse it, and JSONLite's lack of vectorization. Reading one record of
job_summary_data
data is easy, but most use cases can't identify the single record of interest or they want records across a span of time. Here's some sample code that reads all the records saved from a script named _warn_owners_of_impendingbillThe interesting part is the last two stanzas of code where we give names to a vector of row IDs to query, iteratively read the JSON from those rows, then join the rest of the log data to the decoded JSON:
Putting just these components into the function allows the caller to decide how many records from what script or scripts get decoded. We already have use cases for this function where we want to inspect logged email send failures generated by multiple scripts. As we logged the email failures the same way in each function, aggregating the send failures across them is trivial with a function like this.
This function will need a name. I offer these suggestions:
We need to keep the distinction in people's minds between the
redcapcustodian
job logs and REDCap'sredcap_log_event
table@ChemiKyle, have any ideas on naming?