Learn R Programming

amberr (version 1.2.0)

amber.case_report_export: Export the case report records

Description

Export the case report records of one or several form(s).

Usage

amber.case_report_export(
  amber,
  study = NULL,
  form = NULL,
  caseReportForm = NULL,
  from = NULL,
  to = NULL,
  pId = NULL,
  query = list(),
  skip = 0,
  limit = 100,
  df = 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)

Arguments

amber

An Amber object

study

Study identifier (name or id), optional.

form

Form identifier (name or id), optional.

caseReportForm

Case report form identifier (name or id), optional.

from

From date (included), optional

to

To date (included), optional

pId

Patient/participant identifier

query

The search query

skip

Number of items to skip

limit

Max number of items

df

Return a data.frame (default is TRUE)

See Also

Other studies functions: amber.campaign(), amber.campaigns(), 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.interview_export(), amber.interviews(), amber.interviews_step_actions(), amber.interviews_step_data(), amber.interviews_steps(), amber.participant(), amber.participants(), amber.studies(), amber.study()

Examples

Run this code
if (FALSE) {
a <- amber.login("https://amber-demo.obiba.org")

# Find all case reports
amber.case_report_export(a)

# Find all case reports in a range of time
amber.case_report_export(a, from = "2022-01-12 00:00", to = "2022-02-13")

# Find all case reports for a specific participant/patient identifier
amber.case_report_export(a, pId = "1231")

# Find all case reports having their identifier matching a regular expression
amber.case_report_export(a, query = list(`data._id[$search]` = "^12"))

# Find all case reports which form data is equal to some value
# (will not work if the data are encrypted in the database)
amber.case_report_export(a, query = list(data.PATIENT.ORIGIN_REGION = "xyz"))

# Export records collected with a study's form in a specific version
amber.case_report_export(a,
  study = "Trauma Registry",
  form = "Adult trauma",
  query = list(revision = 6))

# Export records collected with a specific case report form
tables <- amber.case_report_export(a, caseReportForm = "Adult trauma - test")

# Export records collected with a study's form in all versions used
tables <- amber.case_report_export(a,
  study = "Trauma Registry",
  form = "Adult trauma")

# Result contains both data and dictionary
tables

# Tables are named with the - pattern
names(tables)

# Merge datasets from different versions if relevant
dplyr::bind_rows(lapply(tables, function (t) {
  t$data
}))

amber.logout(a)
}

Run the code above in your browser using DataLab