Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1bcdad8
update question and answer options
larnsce Sep 10, 2025
134b5e4
complete quiz
larnsce Sep 10, 2025
dddd13a
update config
larnsce Sep 10, 2025
0bc448e
fix error
larnsce Sep 10, 2025
fe71337
update link
larnsce Sep 10, 2025
7af9774
update text
larnsce Sep 10, 2025
ff59bb1
update ID
larnsce Sep 10, 2025
3c46402
chore: update github username with latest roaster
massarin Sep 11, 2025
b2d8e5d
Merge pull request #2 from ds4owd-dev/dev
massarin Sep 11, 2025
1e912e5
fix: broken link, https:/ was repeated
massarin Sep 11, 2025
c34eac9
Merge pull request #3 from ds4owd-dev/dev
massarin Sep 11, 2025
224802c
update roster
larnsce Sep 12, 2025
d377098
Add options
larnsce Sep 12, 2025
05a5c3f
add CLAUDE.md
larnsce Sep 12, 2025
e861e8f
initial commit
larnsce Sep 12, 2025
9cb0073
draft map exercise
larnsce Sep 12, 2025
661765a
add participants summary
larnsce Sep 12, 2025
77a1a1c
simplify map
larnsce Sep 12, 2025
f21b6c7
make map interactive
larnsce Sep 12, 2025
3a78f91
add gradethis
larnsce Sep 13, 2025
1ea75cd
do not display quiz 2
larnsce Sep 16, 2025
a7489af
update usernames
larnsce Sep 16, 2025
1ca7053
add sentence
larnsce Sep 17, 2025
e5f6cbb
add section
larnsce Sep 17, 2025
01aa594
update username
larnsce Sep 18, 2025
74994ca
Add quiz for module 2
larnsce Sep 18, 2025
29c6c63
fix: #6, include libraries to DESCRIPTION > Imports
massarin Sep 18, 2025
1e92ab2
fix: bundle only required files for each quiz
massarin Sep 18, 2025
bdb8744
fix: Creates a temporary directory
massarin Sep 18, 2025
bf228d2
fix: remove here::here, refactor data pathing
massarin Sep 18, 2025
1c4619b
fix: deploy from separate dirs, remove setwd and temp
massarin Sep 19, 2025
bd9e91a
fix: add show logs
massarin Sep 19, 2025
1e5575b
fix: readme modules path
massarin Sep 19, 2025
c424377
fix: add missing rnaturalearthdata dependency
massarin Sep 19, 2025
368355d
fix: add fallback
massarin Sep 19, 2025
797f8f8
fix: add remotes, add slow warning, remove second loading of world map
massarin Sep 19, 2025
c8179b0
fix: remove plotly
massarin Sep 19, 2025
6cb30ee
fix: remove plotly
massarin Sep 19, 2025
96ae00b
fix: remove plotly
massarin Sep 19, 2025
421cb37
update usernames
larnsce Sep 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ docs/
!docs/*.md
*.dcf
*.html
*.png

# renv - using DESCRIPTION for dependencies instead
renv/
Expand All @@ -20,4 +21,6 @@ rsconnect/

venv/

legacy/
legacy/

CLAUDE.md
14 changes: 12 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ URL: https://github.com/ds4owd-dev/quiz,
https://ds4owd-dev.github.io/quiz/
BugReports: https://github.com/ds4owd-dev/quiz/issues
Imports:
remotes,
learnr,
dplyr,
gapminder,
Expand All @@ -24,9 +25,18 @@ Imports:
shiny,
bslib,
rsconnect,
yaml
yaml,
countrycode,
ggplot2,
here,
palmerpenguins,
readr,
rnaturalearth,
rnaturalearthdata,
sf
Suggests:
pkgdown
Remotes:
rstudio/gradethis,
rundel/learnrhash
rundel/learnrhash,
ropensci/rnaturalearthdata
50 changes: 33 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@

This directory contains interactive learnr quizzes for the openwashdata course and a landing page to access them.

**Live Demo**: https://hjj91u-nicolo-massari.shinyapps.io/openwashdata-quiz-hub/
**Live Demo**: https://u4x6xe-lars-sch0bitz.shinyapps.io/ds4owd-002-quiz/

## Structure

- `app.R` - Quiz landing page that automatically displays all configured quizzes
- `build.R` - Deployment script with helper functions for automated deployment
- `config.R` - Shared configuration file defining all available quizzes
- `modules/` - Directory containing all quiz files
- `md-01-quiz.Rmd` - Module 1 quiz on Quarto basics (learnr tutorial)
- `_github_username.Rmd` - Reusable component for GitHub username input with CSV data
- `_submission.Rmd` - Reusable component for quiz submission
- `github_usernames.csv` - Student GitHub username database
- Additional quiz files can be added as `md-XX-quiz.Rmd`
- `modules/` - Directory containing individual quiz directories
- `md-01-quiz/` - Module 1 quiz directory with all required files
- `md-02-quiz/` - Module 2 quiz directory with all required files
- Each quiz directory contains:
- `md-XX-quiz.Rmd` - Main quiz file (learnr tutorial)
- `_github_username.Rmd` - Reusable component for GitHub username input
- `_participation.Rmd` - Reusable component for participation tracking
- `_submission.Rmd` - Reusable component for quiz submission
- `github_usernames.csv` - Student GitHub username database
- `data/` - Quiz-specific data files (if needed)

## Required Packages

Expand Down Expand Up @@ -145,44 +149,55 @@ source("build.R")
```

The deployment system features:
- **Automatic file bundling**: CSV files and dependencies are automatically included
- **Direct module deployment**: Deploys directly from module directories (no temp files)
- **Self-contained modules**: Each quiz directory contains all required files
- **Streamlined process**: One script deploys everything configured in `config.R`

## Adding New Quizzes

The system now uses automatic configuration - adding a new quiz is simple:
The system uses a modular directory structure - adding a new quiz requires creating a complete directory:

### 1. Create the Quiz File
### 1. Create the Quiz Directory

Create `modules/md-02-quiz.Rmd` with the standardized YAML header:
Create a new directory `modules/md-XX-quiz/` and add all required files:

```bash
mkdir modules/md-03-quiz
cp modules/md-01-quiz/_*.Rmd modules/md-01-quiz/github_usernames.csv modules/md-03-quiz/
```

### 2. Create the Quiz File

Create `modules/md-XX-quiz/md-XX-quiz.Rmd` with the standardized YAML header:

```yaml
---
title: "Module 2: Your Title"
title: "Module 3: Your Title"
output: learnr::tutorial
runtime: shiny_prerendered
description: "Your quiz description"
tutorial:
id: "module2-your-id"
id: "md-03-quiz"
---
```

Add your quiz content following the existing pattern, including:
- GitHub username collection: `{r github-username, child='_github_username.Rmd'}`
- Quiz submission: `{r submission-section, child='_submission.Rmd'}`

### 2. Update Configuration
### 3. Update Configuration

Edit `config.R` to include your new quiz:

```r
quiz_names <- c(
"md-01-quiz",
"md-02-quiz" # Add new quiz here
"md-02-quiz",
"md-03-quiz" # Add new quiz here
)
```

### 3. Deploy
### 4. Deploy

Run the build script to deploy everything:

Expand All @@ -200,7 +215,8 @@ This will:

```r
# Test a quiz locally
rmarkdown::run("modules/md-01-quiz.Rmd")
setwd("modules/md-01-quiz")
rmarkdown::run("md-01-quiz.Rmd")
```

### Test Landing Page
Expand Down
16 changes: 9 additions & 7 deletions app.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ source("config.R")

# Function to extract quiz metadata from Rmd files
extract_quiz_metadata <- function(quiz_name) {
rmd_path <- file.path("modules", paste0(quiz_name, ".Rmd"))
rmd_path <- file.path("modules", quiz_name, paste0(quiz_name, ".Rmd"))

if (!file.exists(rmd_path)) {
return(NULL)
Expand Down Expand Up @@ -60,7 +60,7 @@ quizzes <- generate_quiz_list(quiz_names)

# UI
ui <- page_navbar(
title = "openwashdata Quizzes",
title = "ds4owd-002 quiz",
theme = bs_theme(bootswatch = "cosmo"),

nav_panel(
Expand All @@ -69,8 +69,9 @@ ui <- page_navbar(
class = "container mt-5",
div(
class = "text-center mb-5",
h1("openwashdata Course Quizzes"),
p(class = "lead", "Interactive tutorials to test your knowledge")
h1("data science for openwashdata - quiz"),
p(class = "lead", "Interactive tutorials to test your knowledge."),
p(class = "lead text-warning fw-bold", "For successful completion of the course, you need to complete the quizzes for each module."),
),

div(
Expand Down Expand Up @@ -118,15 +119,15 @@ ui <- page_navbar(
div(
class = "col-md-8",
h2("About These Quizzes"),
p("These interactive quizzes are designed to help you learn and practice concepts from the openwashdata course."),
p("These interactive quizzes are designed to help you learn and practice concepts from the ds4owd course. They are required to be completed for each module of the course."),

h3("Features"),
tags$ul(
tags$li("Interactive R code exercises"),
tags$li("Immediate feedback on your answers"),
tags$li("Hints and solutions available"),
tags$li("Progress tracking within each quiz"),
tags$li("Automatic grading with gradethis")
tags$li("Automatic grading")
),

h3("How to Use"),
Expand All @@ -136,7 +137,8 @@ ui <- page_navbar(
tags$li("Work through the questions at your own pace"),
tags$li("Run code in the interactive exercises"),
tags$li("Use hints if you get stuck"),
tags$li("Check your solutions for immediate feedback")
tags$li("Check your solutions for immediate feedback"),
tags$li("Ensure to submit the Quiz with your GitHub username")
),

h3("Technical Requirements"),
Expand Down
13 changes: 11 additions & 2 deletions build.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ source("config.R")
# HELPER

deploy_quiz <- function(module_name) {
module_path <- paste0(file.path("modules", module_name), ".Rmd")
# Deploy directly from module directory - no temp directories!
module_dir <- file.path("modules", module_name)
rmd_file <- file.path(module_dir, paste0(module_name, ".Rmd"))

if (!file.exists(rmd_file)) {
stop("Quiz file not found: ", rmd_file)
}

# Deploy directly from module directory
rsconnect::deployDoc(
doc = module_path,
doc = rmd_file,
appName = module_name,
forceUpdate = TRUE,
logLevel = "verbose"
)
rsconnect::showLogs()
}


Expand Down
8 changes: 4 additions & 4 deletions config.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

# List of quiz modules to deploy and display
quiz_names <- c(
"md-01-quiz"
"md-01-quiz",
"md-02-quiz"
# Add new quizzes here:
# "md-02-quiz",
# "md-03-quiz"
)

# Base URL for deployed quizzes
base_url <- "https://hjj91u-nicolo-massari.shinyapps.io/"
base_url <- "https://u4x6xe-lars-sch0bitz.shinyapps.io/"

# Main app configuration
main_app_name <- "openwashdata-quiz-hub"
main_app_name <- "ds4owd-002-quiz"

# in modules/_submission.Rmd
#
Expand Down
9 changes: 0 additions & 9 deletions modules/_participation.Rmd

This file was deleted.

9 changes: 0 additions & 9 deletions modules/github_usernames.csv

This file was deleted.

Loading
Loading