fetch_logs: Fetch trace data logs

Description Usage Arguments Details Value

Description

Fetches entries from the Moodle logstore and adds some extra columns that are often helpful for research purposes. Use arguments to fetch only the data you need, so execution time is minimized.

Usage

1
2
fetch_logs(course_id, user_ids = NULL, events = NULL, after = NULL,
  before = NULL, cm_ids = NULL, ..., con = get_session_con())

Arguments

course_id

A single integer corresponding to a courseid in the database.

user_ids

An integer vector corresponding to userids in the database. Logs will only be returned for these users. A NULL value will not apply this filter.

events

A character vector of eventnames by which to filter the logs. A NULL value will not apply this filter.

after

A single UNIX datetime in any format that can be cast to a lubridate datetime object. Entries before this time will be excluded. A NULL value will not apply this filter.

before

A single UNIX datetime in any format that can be cast to a lubridate datetime object. Entries on and after this time will be excluded. A NULL value will not apply this filter.

cm_ids

An integer vector corresponding to coursemoduleids in the database. Logs will only be returned for these course modules. A NULL value will not apply this filter.

...

Potential future args.

con

A database connection object, using the session connection by default.

Details

Course module ids are included for each log corresponding to a course module instance.

Section (sometimes referred to as a "unit" in the course) info is included in the output for each log corresponding to a module that is embedded in a course section. Section number is based on the position of the modules at the time this function is run.

Each contextlevel refers to a different db table and must be handled separately. There are some contextids in the logstore that no longer exist in the mdl_course_context table because the corresponding modules were deleted. Events refering to these contexts will get an NA for their section. The only people that access those deleted modules are likely staff.

Value

A tibble with one row per log event. If user_ids are passed in, the number of users in the return may be less than the number of users passed in, because some users may not have the specified logs.


TheFridayInstitute/fimoodler documentation built on May 28, 2019, 9:37 a.m.