amber.case_report_export {amberr}R Documentation

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
)

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)

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.campaigns(), amber.campaign(), amber.case_report_forms(), amber.case_report_form(), amber.case_reports(), amber.form_revisions(), amber.form_revision(), amber.forms(), amber.form(), amber.interview_designs(), amber.interview_design(), amber.interview_export(), amber.interviews(), amber.participants(), amber.participant(), amber.studies(), amber.study()

Examples

## Not run: 
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 <case report 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)

## End(Not run)

[Package amberr version 1.0.0 Index]