Scope
This guide describes a controlled pilot deployment rehearsal for
learnrTrackR. It uses the simulated course pilot,
PostgreSQL, environment variables, teacher exports, Moodle-ready CSV
output, dashboard data, and an HTML teacher report.
The workflow is intended for development, local rehearsal, and small controlled pilots. It is not an institutional authentication layer and it is not a production LMS.
For the SQLite version of the same pilot, the
course-pilot example includes run-student.R,
run-teacher.R, student.env.example,
teacher.env.example, and
pilot-checklist.md.
Example directories
library(learnrTrackR)
postgres_dir <- system.file("examples/postgres-docker", package = "learnrTrackR")
course_pilot_dir <- system.file("examples/course-pilot", package = "learnrTrackR")
postgres_dir
#> [1] "/tmp/Rtmpktuqs0/temp_libpath19a65a519f54/learnrTrackR/examples/postgres-docker"
course_pilot_dir
#> [1] "/tmp/Rtmpktuqs0/temp_libpath19a65a519f54/learnrTrackR/examples/course-pilot"Environment variables
The PostgreSQL Docker example includes an env.example
file. Copy it to .env before launching the service:
The important pilot variables are:
LEARNRTRACKR_POSTGRES_DB=learnrtrackr
LEARNRTRACKR_POSTGRES_USER=learnrtrackr
LEARNRTRACKR_POSTGRES_PASSWORD=replace-with-a-long-random-password
LEARNRTRACKR_POSTGRES_HOST=127.0.0.1
LEARNRTRACKR_POSTGRES_PORT=5432
LEARNRTRACKR_POSTGRES_SCHEMA=learnrtrackr_pilot
LEARNRTRACKR_PILOT_TUTORIAL_ID=stat_descriptive_pilot
LEARNRTRACKR_PILOT_GROUP_ID=A
LEARNRTRACKR_PILOT_OUTPUT_DIR=pilot-outputs
LEARNRTRACKR_PILOT_RESET=true
LEARNRTRACKR_DASHBOARD_HOST=127.0.0.1
LEARNRTRACKR_DASHBOARD_TOKEN=replace-with-a-long-random-dashboard-token
Do not commit .env files, database dumps, or exported
student results.
Start PostgreSQL
From inst/examples/postgres-docker/:
The Compose file starts one local PostgreSQL service. The pilot smoke
test uses the schema named by LEARNRTRACKR_POSTGRES_SCHEMA.
When LEARNRTRACKR_PILOT_RESET=true, that schema is dropped
and recreated before the simulated pilot is inserted.
Run the pilot smoke test
The smoke test:
- connects to PostgreSQL;
- prepares the pilot schema;
- loads the course, tutorial, student, and question CSV configuration;
- records the simulated cohort attempts;
- prepares dashboard data with
dashboard_data(con, ...); - writes attempts, scores, gradebook, Moodle-ready grades, Canvas Gradebook grades, and a rich export bundle;
- renders an HTML teacher report when
rmarkdownis installed.
Inspect the teacher outputs
By default, outputs are written to:
inst/examples/postgres-docker/pilot-outputs/
Expected files include:
course-pilot-attempts.csv
course-pilot-scores.csv
course-pilot-gradebook.csv
course-pilot-moodle.csv
course-pilot-canvas.csv
course-pilot-teacher-report.html
course-pilot-bundle/
The Moodle CSV is filtered by
LEARNRTRACKR_PILOT_GROUP_ID. For example,
LEARNRTRACKR_PILOT_GROUP_ID=A exports only the configured
group A learners. The Canvas CSV uses the same group filter.
Dashboard
The pilot verifies dashboard tables with:
dashboard_data(
con,
tutorial_id = "stat_descriptive_pilot",
group_id = "A",
rule = "last"
)The interactive dashboard can then be launched from the same PostgreSQL environment:
The script calls run_dashboard_postgres() with the
configured PostgreSQL schema, tutorial id, group filter, dashboard host,
and dashboard token:
run_dashboard_postgres(
postgres_schema = Sys.getenv("LEARNRTRACKR_POSTGRES_SCHEMA"),
tutorial_id = Sys.getenv("LEARNRTRACKR_PILOT_TUTORIAL_ID"),
group_id = Sys.getenv("LEARNRTRACKR_PILOT_GROUP_ID"),
host = Sys.getenv("LEARNRTRACKR_DASHBOARD_HOST", unset = "127.0.0.1"),
access_token = Sys.getenv("LEARNRTRACKR_DASHBOARD_TOKEN")
)Teacher launch checklist
Before a real controlled pilot:
- read
pilot-checklist.mdandpilot-protocol.mdin thecourse-pilotexample; - choose the student identifier used for Moodle matching;
- prepare
students.csvwith only necessary student metadata; - set a PostgreSQL password that is not committed to Git;
- use a dedicated PostgreSQL database or schema;
- run
course-pilot-smoke-test.R; - inspect
course-pilot-moodle.csvbefore importing; - inspect the teacher report before using results for teaching decisions;
- launch
run-dashboard.Ronly from an explicitly managed local or protected environment; - document who can access exports and how long files are retained.
References
- PostgreSQL Global Development Group. Accessed 2026-06-04. libpq environment variables. https://www.postgresql.org/docs/current/libpq-envars.htm
- Docker Inc. Accessed 2026-06-04. Compose file reference. https://docs.docker.com/compose/compose-file/
- Docker Inc. Accessed 2026-06-04. postgres official image. https://hub.docker.com/_/postgres