Typical experience making a survey


Typical experience making a survey

❌ Reproducible


❌ Data Control


⚠️ Free to Use


⚠️ Open Source


⚠️ Easy Collaboration


⚠️ Feature Packed

Introducing surveydown


Components

survey.qmd

A Quarto doc defining the main survey content (pages, text, images, questions, etc).

app.R

An R script defining the survey Shiny app. It sets up the database and server, and launches the survey.

survey.qmd

---
format: html
echo: false
warning: false
---

```{r}
library(surveydown)
```

::: {#welcome .sd-page}

# 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()
```

:::

::: {#end .sd-page}

This is the last page of the survey.

```{r}
sd_close()
```

:::

survey.qmd

---
format: html
echo: false
warning: false
---

```{r}
library(surveydown)
```

::: {#welcome .sd-page}

# 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()
```

:::

::: {#end .sd-page}

This is the last page of the survey.

```{r}
sd_close()
```

:::

YAML Header

Load Package

survey.qmd

---
format: html
echo: false
warning: false
---

```{r}
library(surveydown)
```

::: {#welcome .sd-page}

# 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()
```

:::

::: {#end .sd-page}

This is the last page of the survey.

```{r}
sd_close()
```

:::

Define pages using “fences”:

::: {#id .sd-page}
:::

Page 1 (Welcome)

Page 2 (End)

survey.qmd

---
format: html
echo: false
warning: false
---

```{r}
library(surveydown)
```

::: {#welcome .sd-page}

# 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()
```

:::

::: {#end .sd-page}

This is the last page of the survey.

```{r}
sd_close()
```

:::

Contents of Page 1

survey.qmd

---
format: html
echo: false
warning: false
---

```{r}
library(surveydown)
```

::: {#welcome .sd-page}

# 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()
```

:::

::: {#end .sd-page}

This is the last page of the survey.

```{r}
sd_close()
```

:::

Question Definition

app.R

# Load Package
library(surveydown)

# Database Credentials
sd_db_config()

# Connect to Database
db <- sd_db_connect()

# Server Setup
server <- function(input, output, session) {

  # Skip logic
  sd_skip_if(...)

  # Conditional display
  sd_show_if(...)

  # Server settings
  sd_server(
    db = db,
    ...
  )
}

# Launch Survey
shiny::shinyApp(ui = sd_ui(), server = server)

app.R

# Load Package
library(surveydown)

# Database Credentials
sd_db_config()

# Connect to Database
db <- sd_db_connect()

# Server Setup
server <- function(input, output, session) {

  # Skip logic
  sd_skip_if(...)

  # Conditional display
  sd_show_if(...)

  # Server settings
  sd_server(
    db = db,
    ...
  )
}

# Launch Survey
shiny::shinyApp(ui = sd_ui(), server = server)

Load Package

app.R

# Load Package
library(surveydown)

# Database Credentials
sd_db_config()

# Connect to Database
db <- sd_db_connect()

# Server Setup
server <- function(input, output, session) {

  # Skip logic
  sd_skip_if(...)

  # Conditional display
  sd_show_if(...)

  # Server settings
  sd_server(
    db = db,
    ...
  )
}

# Launch Survey
shiny::shinyApp(ui = sd_ui(), server = server)

Database Setup

We recommend using Supabase or any PostgreSQL database for the database setup.

app.R

# Load Package
library(surveydown)

# Database Credentials
sd_db_config()

# Connect to Database
db <- sd_db_connect()

# Server Setup
server <- function(input, output, session) {

  # Skip logic
  sd_skip_if(...)

  # Conditional display
  sd_show_if(...)

  # Server settings
  sd_server(
    db = db,
    ...
  )
}

# Launch Survey
shiny::shinyApp(ui = sd_ui(), server = server)

Server Setup

app.R

# Load Package
library(surveydown)

# Database Credentials
sd_db_config()

# Connect to Database
db <- sd_db_connect()

# Server Setup
server <- function(input, output, session) {

  # Skip logic
  sd_skip_if(...)

  # Conditional display
  sd_show_if(...)

  # Server settings
  sd_server(
    db = db,
    ...
  )
}

# Launch Survey
shiny::shinyApp(ui = sd_ui(), server = server)

Launch Survey

Templates and demos are provided on surveydown.org for an easy start.

Demo: Built-in Question Types

Demo: Custom Question (leaflet Map)

Future Work


Dashboard for managing survey data

GUI for defining surveys

More question types


You can contribute!

Dashboard (Under Construction…)

Check out surveydown.org for more!