Main arguments
The readepi()
function expects the following
arguments:
data_source
: (required) this is the URL of the target HIS.records
: (optional) a vector or a comma-separated string of subject IDs. When specified, only the records that correspond to these subjects will be imported.fields
: (optional) a vector or a comma-separated string of column names. If provided, only those columns will be imported.id_position
: (optional) the column position of the variable that unique identifies the subjects. It’s default value is 1.id_col_name
: (optional) the name of the column that unique identifies the subjects.
Credentials file
The access to data stored in a database management system requires
valid user credentials, such as a user name and password. The
{readepi} package expect that the user credential
details to be saved in a tab-separated file. The path to that constitute
the value for the credentials_file
argument of the
readepi()
function.
This credential (tab-delimited) file must contain the following columns:
user_name
: the user name.password
: the user password (in REDCap, this corresponds to token).host_name
: the host name (in REDCap, this corresponds to the host URL).
project_id
: the name of the database (for relation DB) or the name of project (for REDCap API) that contains data of interest.comment
: (optional) a brief description of the project or database of interest.
dbms
: the type of the DBMS. Possible values are:REDCap
when reading from REDCap;MySQL
when reading from a MySQL server,SQLServer
when reading from an MS SQL server,PostgreSQL
when reading from a PostgreSQL system.
port
: (optional) the port ID, this is only used for MS SQL servers.
To see the structure of a credentials file used as a template in the
{readepi} package, use the
show_example_file()
function as shown below.
# DISPLAY THE STRUCTURE OF THE TEMPLATE CREDENTIALS FILE
show_example_file()
#> user_name password host_name
#> 1 admin district https://play.im.dhis2.org/dev
#> 2 rfamro mysql-rfam-public.ebi.ac.uk
#> 3 kmane 9A81268476645C4E5F03428B8AC3AA7B https://bbmc.ouhsc.edu/redcap/api/
#> project_id comment dbms port
#> 1 DHIS2_DEMO this is a test DHIS2 server DHIS2 NA
#> 2 Rfam this is a test MySQL server MySQL 4497
#> 3 SD_DATA testing access to REDCap project REDCap NA