class: center, middle, inverse .leftcol40[ <center> <img src="https://surveydown.org/images/logo.png" width=100%> </center> ] .rightcol60[ <br><br> # .font150[.fancy[Getting started with surveydown]] ] --- # Meet your instructor! .leftcol30[.circle[ <img src="images/john_helveston_square.png" width=100%> ]] .rightcol70[ ### John Helveston, Ph.D. .font80[ Associate Professor, Engineering Management & Systems Engineering - 2016-2018 Postdoc at [Institute for Sustainable Energy](https://www.bu.edu/ise/), Boston University - 2016 PhD in Engineering & Public Policy at Carnegie Mellon University - 2015 MS in Engineering & Public Policy at Carnegie Mellon University - 2010 BS in Engineering Science & Mechanics at Virginia Tech - Website: [www.jhelvy.com](http://www.jhelvy.com/) ]] --- class: center # Meet the dev team! .cols3[.circle[ <center> <img src="images/john_helveston_square.png" width=90%> <br> <b>John Paul Helveston</b> </center> ]] .cols3[.circle[ <center> <img src="images/pingfan_hu.jpg" width=90%> <br> <b>Pingfan Hu</b> </center> ]] .cols3[.circle[ <center> <img src="images/bogdan_bunea.jpg" width=90%> <br> <b>Bogdan Bunea</b> </center> ]] --- # Before we start... <br> ## 1. Be sure to [install everything](https://jhelvy.github.io/2025-surveydown-workshop/install.html) ## 2. Download the [examples](https://jhelvy.github.io/2025-surveydown-workshop/examples.zip) --- class: inverse, middle # .fancy[Getting started with surveydown] ### 1. What is surveydown? ### 2. surveydown basics ### 3. Building your first surveydown survey! ### 4. Adding survey content --- class: inverse, middle # .fancy[Getting started with surveydown] ### 1. .orange[What is surveydown?] ### 2. surveydown basics ### 3. Building your first surveydown survey! ### 4. Adding survey content --- background-color: #fff class: center # Typical experience making a survey <center> <img src="images/google-form.gif" width=600> </center> --- background-color: #fff class: middle .leftcol60[ <center> <img src="images/google-form.gif" width=600> </center> ] .rightcol40[ ### ❌ Reproducible ### ❌ Data Control ### ⚠️ Free to Use ### ⚠️ Open Source ### ⚠️ Easy Collaboration ### ⚠️ Feature Packed ] --- class: center ## Introducing `surveydown` <center> <img src="images/technologies.svg" width=90%> </center> --- class: inverse, middle # .fancy[Getting started with surveydown] ### 1. What is surveydown? ### 2. .orange[surveydown basics] ### 3. Building your first surveydown survey! ### 4. Adding survey content --- class: center # Components <br> .leftcol45[ ### `survey.qmd` A **Quarto doc** defining the main survey content (pages, text, images, questions, etc). ] .rightcol45[ ### `app.R` An **R script** defining the survey Shiny app. It sets up the database and server, and launches the survey. ] --- .leftcol[.code50[ ```` markdown --- format: html echo: false warning: false --- ```{r} library(surveydown) ``` ::: {.sd_page id=welcome} # Welcome to our survey! ```{r} sd_question( type = "mc", id = "penguins", label = "What's your favorite penguin?", option = c( "Adélie" = "adelie", "Chinstrap" = "chinstrap", "Gentoo" = "gentoo" ) ) sd_next() ``` ::: ::: {.sd_page id=end} This is the last page of the survey. ```{r} sd_close() ``` ::: ```` ]] .rightcol[ # .center[survey.qmd] ] --- .leftcol[.code50[ ```` markdown *--- *format: html *echo: false *warning: false *--- *```{r} *library(surveydown) *``` ::: {.sd_page id=welcome} # Welcome to our survey! ```{r} sd_question( type = "mc", id = "penguins", label = "What's your favorite penguin?", option = c( "Adélie" = "adelie", "Chinstrap" = "chinstrap", "Gentoo" = "gentoo" ) ) sd_next() ``` ::: ::: {.sd_page id=end} This is the last page of the survey. ```{r} sd_close() ``` ::: ```` ]] .rightcol[ YAML Header <br> Load `surveydown` package ] --- .leftcol[.code50[ ```` markdown --- format: html echo: false warning: false --- ```{r} library(surveydown) ``` *::: {.sd_page id=welcome} # Welcome to our survey! ```{r} sd_question( type = "mc", id = "penguins", label = "What's your favorite penguin?", option = c( "Adélie" = "adelie", "Chinstrap" = "chinstrap", "Gentoo" = "gentoo" ) ) sd_next() ``` *::: *::: {.sd_page id=end} This is the last page of the survey. ```{r} sd_close() ``` *::: ```` ]] .rightcol[ Define pages using "fences" ``` markdown ::: {.sd_page id=page_id} Page content ::: ``` ] --- .leftcol[.code50[ ```` markdown --- format: html echo: false warning: false --- ```{r} library(surveydown) ``` ::: {.sd_page id=welcome} *# Welcome to our survey! *```{r} *sd_question( * type = "mc", * id = "penguins", * label = "What's your favorite penguin?", * option = c( * "Adélie" = "adelie", * "Chinstrap" = "chinstrap", * "Gentoo" = "gentoo" * ) *) *sd_next() *``` ::: ::: {.sd_page id=end} This is the last page of the survey. ```{r} sd_close() ``` ::: ```` ]] .rightcol[ <br><br><br><br><br>Use markdown for page content Use `sd_question()` in code chunk for survey questions <br><br>Use `sd_next()` for next button ] --- .leftcol[.code70[ ``` r library(surveydown) # Connects to database db <- sd_db_connect() # Main UI ui <- sd_ui() server <- function(input, output, session) { # Main server sd_server(db) } shiny::shinyApp( ui = ui, server = server ) ``` ]] .rightcol[ # .center[app.R] ] --- .leftcol[.code70[ ``` r *library(surveydown) # Connects to database *db <- sd_db_connect() # Main UI *ui <- sd_ui() server <- function(input, output, session) { # Main server * sd_server(db) } shiny::shinyApp( ui = ui, server = server ) ``` ]] .rightcol[ Load package Connect to database Make standard UI <br>Run surveydown server ] --- class: inverse, middle # .fancy[Getting started with surveydown] ### 1. What is surveydown? ### 2. surveydown basics ### 3. .orange[Building your first surveydown survey!] ### 4. Adding survey content --- class: inverse
−
+
05
:
00
# Your turn - start with a [template](https://surveydown.org/templates) **Step 1:** In R console, run: ``` r surveydown::sd_create_survey() ``` *Optional*: Specify a `path` and / or a `template`: ``` r surveydown::sd_create_survey( template = "question_types", path = "path/to/folder" ) ``` **Step 2:** In your IDE, open the `app.R` file, click "Run App", or in R console run: ``` r shiny::runApp('app.R') ``` --- class: inverse, middle # .fancy[Getting started with surveydown] ### 1. What is surveydown? ### 2. surveydown basics ### 3. Building your first surveydown survey! ### 4. .orange[Adding survey content] --- ## YAML Header The YAML header is at the top of the `.qmd` file: ``` yaml --- format: html echo: false warning: false --- ``` --- ## Change the survey theme Pick a different [bootswatch theme](https://bootswatch.com) with the `theme` key: ``` markdown --- format: html echo: false warning: false *theme: united --- ``` Make a custom theme with a `custom.scss` file ``` markdown --- format: html echo: false warning: false *theme: [united, custom.scss] --- ``` --- ## Progress bar You can modify the survey progress bar with the `barcolor` and `barposition` keys: .leftcol[ Change to any color with `barcolor`: ``` markdown --- format: html echo: false warning: false *barcolor: #768692 --- ``` ] .rightcol[ Change position: `top`, `bottom`, or `none` ``` markdown --- format: html echo: false warning: false *barposition: bottom --- ``` ] --- # Inserting pages Insert new pages with `:::` symbols, like this ``` r ::: {.sd_page id=page_id} Page content here ::: ``` -- Insert next buttons with the `sd_next()` function, like this (blank goes to next page): ````markdown ```{r} sd_next('next_page_id') ``` ```` --- # Inserting questions Insert questions using the `sd_question()` function, like this: .leftcol[ **Code** ``` r sd_question( type = 'mc', id = 'fruit', label = "1. Do you like fruit?", option = c( 'Yes!' = 'yes', 'Kind of' = 'kind_of', 'No :(' = 'no' ) ) ``` Format is `"Label = value"` ] .rightcol[ **Output**
Do you like fruit?
Yes!
Kind of
No :(
*
] --- ## surveydown supports lots of [question types](https://surveydown.org/docs/question-types) Some common types you may want to use: Type | Description -----|--------------------- `mc` | Multiple choice question (single choice) `mc_multiple` | Multiple choice question (multiple choices) `mc_buttons` | Multiple choice question (large buttons) `select` | Drop down menu (choose one) `text` | Open text, single row `textarea` | Open text, block --- # Embed images with html I recommend just writing html code, like this ``` html <center> <img src="https://surveydown.org/images/logo.png" width=250> </center> ``` <center> <img src="https://surveydown.org/images/logo.png" width=250> </center> --- # Embed images with markdown ``` html {fig-align="center" width="250"} ``` <center> <img src="https://surveydown.org/images/logo.png" width=250> </center> --- class: center, middle # Try out the surveydown [studio app](https://github.com/surveydown-dev/sdApps) ## `sdApps::sd_studio()` --- class: inverse
−
+
10
:
00
## Your turn - Open and edit the `survey.qmd` file that you previously made. - Pick a topic for your survey (a food, an animal, a sports team...whatever). - Draft a survey about that topic. Include the following: - Page 1: A welcome message in large font ("Welcome to a survey about [topic]") and an image about the topic (find an image somewhere). - Pages 2 to N: Add different questions about the topic using several different question types. - Try out different themes to change the look and feel.