DFreport

DFreport — Client-side, command-line interface for executing reports

Synopsis

DFreport [-S server] [-U username] [-C password] [-JS js] [-CSS css] [-usealias] [-logo] [-e errfile] [-o outfile] {-CMD cmd} {study#}

Options and Description

DFreport runs DFdiscover reports outside of DFexplore, making them available to run from a command-line or scheduled via the UNIX cron facility.

Authentication and Database Permissions

Authentication.  To authenticate, DFreport requires the username and password for connection to a specific database server. These may be supplied as:

  1. command-line options, the user can specify -S servername, -U username and -C password when the program is run, or

  2. environment variables, the user can set the variables DFSERVER servername, DFUSER username and DFPASSWD password before the program is run.

Specification of command-line options takes priority if both command-line options and environment variables are supplied. Refer to User Credentials for more information.

Database Permissions.  Subsequent to authentication with a specific database server, use of DFreport is allowed (or disallowed) by the DFexplore - Reports view or Server - Run reports permissions.

An authenticated user with one of these role permissions will then be able to run reports. The reported data is filtered by user permissions, which may further be limited by visit, plate and level restrictions associated with the user's role.

DFreport provides no warning that some records cannot be exported due to permission restrictions as this would itself provide information about the existence of restricted data records.

Report Options

-CMD command

resource request sent to server, specifying report to execute

-JS command

matching javascript resource for report interactivity

-CSS command

matching stylesheet resource for report styling and presentation

-usealias

output the subject alias, if defined, in place of the subject ID. If there is no subject alias, output the subject ID.

-logo

include the study logo in the top-left corner of the HTML output. If not defined, or not available, the study name is used

Output Options

Output File.  By default, output from DFreport is written to standard output (the command-line output). To write the output to a specific file, specify the filename with -o outfile. The user must have filesystem permission to create or modify the file. If outfile is specified as a relative pathname, the file is created relative to the DFreport command invocation directory.[13]

Output from legacy reports is written as is (plain text) while output from standard DFdiscover reports is in HTML or JSON format, determined by the file extension of the argument file.

Error Output.  Re-direct any error messages to a specific file with the -e errfile option. By default, error messages are written to standard error and hence would get intermixed with data if the data is being exported to standard output.

Exit Status

DFreport exits with status 0 if the command was successful. Exit status 1 indicates that an error occurred - errors are written to standard error or the errfile file if -e was specified.

Examples

DFexplore includes a convenience feature, available from Help > Show Command, to display the command required to run a report. For example, run the Enrollment by Site report within DFexplore and select Help > Show Command to obtain this command (line breaks are for presentation only):

DFreport -S explore.dfdiscover.com -U demo_user1 -CMD "/DFedc?cmd=getreport&name=enrollment&title=Enrollment%20by%20Site&json&compress"
-JS "https://cdn.dfdiscover.com/v5.2/js/DF_Enrollment.min.js" -CSS "https://cdn.dfdiscover.com/v5.2/css/DF_ReportStyles.css"
252 -logo -o DF_Enrollment_20191028140508.html -C xxx

Substitute the username for demo_user1, user password for xxx and provide an output filename in place of DF_Enrollment_20191028140508.html.



[13] If DFreport is invoked from a cron facility, absolute pathnames are essential.