setup_psql_event_store: Record 'learnr' User-Events in PostgreSQL

setup_psql_event_storeR Documentation

Record learnr User-Events in PostgreSQL

Description

User-events are saved in a PostgreSQL table in the following format:

Usage

setup_psql_event_store(
  what = c("question_submission", "exercise_submission", "exercise_error"),
  db_table = "events",
  db_user = NULL,
  db_pass = NULL,
  db_name = NULL,
  db_host = NULL,
  db_port = NULL,
  ignore_errors = FALSE
)

Arguments

what

What user-events are to be stored? See https://rstudio.github.io/learnr/publishing.html#recording_events for available event names.

db_table

Name of the events table.

db_user, db_pass

User name and password. If NULL, will be retrieved from PGUSER and PGPASSWORD env vars.

db_name

Database name. If NULL, will be retrieved from PGDBNAME or, if unset falls back to the user name.

db_host, db_port

Hostname and port. If NULL, will be retrieved from PGHOST and PGPORT env vars.

ignore_errors

if TRUE, ignore database connection errors.

Details

id

primary key, generated by the database (defined as SERIAL PRIMARY KEY)

timestamp

timestamp when the event was emitted (defined as TIMESTAMP DEFAULT CURRENT_TIMESTAMP)

tutorial_id

string identifying the tutorial (defined as CHARACTER VARYING(255))

tutorial_VERSION

string identifying the version of the tutorial (defined as CHARACTER VARYING(255))

user_id

string identifying user (defined as CHARACTER VARYING(255))

event

string identifying the event (defined as CHARACTER VARYING(255))

data

event data, stored as JSON (defined as JSONB)

The user id is determined from the current session. See resume_session for details on how the user id is determined in the first place.


dakep/stat305templates documentation built on Nov. 27, 2022, 8:23 a.m.