Export the interview records (data and dictionary) of interview step(s).
Usage
amber.interview_export(
amber,
study = NULL,
interviewDesign = NULL,
campaign = NULL,
from = NULL,
to = NULL,
completed = NULL,
code = NULL,
identifier = NULL,
state = NULL,
participantValid = NULL,
query = list(),
skip = 0,
limit = 100,
df = TRUE
)
Arguments
- amber
An Amber object
- study
Study identifier (name or id), optional.
- interviewDesign
Interview design identifier (name or id), optional.
- campaign
Campaign identifier (name or id), optional.
- from
From date (included), optional
- to
To date (included), optional
- completed
When TRUE export data from completed interviews only (default is NULL)
- code
Participant interview code
- identifier
Patient/participant study identifier
- state
State of the interview: 'initiated', 'in_progress', 'completed'
- participantValid
Participant is valid (logical): active and in the valid date range
- query
The search query
- skip
Number of items to skip
- limit
Max number of items
- df
Return a data.frame (default is TRUE)
Value
A named list of data.frames, a data dictionary and a data data.frame per form revision (or a named list of raw results when 'df' is FALSE)
See also
Other studies functions:
amber.campaign()
,
amber.campaigns()
,
amber.case_report_export()
,
amber.case_report_form()
,
amber.case_report_forms()
,
amber.case_reports()
,
amber.form()
,
amber.form_revision()
,
amber.form_revisions()
,
amber.forms()
,
amber.interview_design()
,
amber.interview_designs()
,
amber.interviews()
,
amber.interviews_step_actions()
,
amber.interviews_step_data()
,
amber.interviews_steps()
,
amber.participant()
,
amber.participants()
,
amber.studies()
,
amber.study()
Examples
if (FALSE) { # \dontrun{
a <- amber.login("https://amber-demo.obiba.org")
# Extract data from all interviews
amber.interview_export(a)
# Extract data from all completed interviews
amber.interview_export(a, completed = TRUE)
# Extract data from all interviews in a range of time
amber.interview_export(a, from = "2022-01-12 00:00", to = "2022-02-13")
# Extract data from all interviews for a specific participant/patient
# study identifier
amber.interview_export(a, identifier = "1231")
# Extract data from all interviews having their participant study
# identifier matching a regular expression
amber.interview_export(a, query = list(`identifier[$search]` = "^12"))
# Extract data from all interviews having their participant attributes
# matching a value
# (will not work if the data are encrypted in the database)
amber.interview_export(a, query = list(data.country = "fr"))
# Export records collected with a study's interview design
tables <- amber.interview_export(a,
study = "liftup",
interviewDesign = "treocapa_lt")
# Result contains both data and dictionary
tables
# Tables are named with the <interview design name>-<form name>-<revision> pattern
names(tables)
# Merge datasets from different versions if relevant
dplyr::bind_rows(lapply(tables, function (t) {
t$data
}))
amber.logout(a)
} # }