run_report: Run code to generate priority tables.

Description Usage Arguments Value Examples

View source: R/run_report.R

Description

Run code to generate priority tables.

Get Connection String Functions

Runs a query with RODBC sqlQuery. Takes a connections string and exectues a query

opens a new connection to a database with a supplied connection string.

Closes an open RODBC database connection

Sets the table names to be used in QA quereis. Replaces any table names with those in CHORDS_TableNames VDW table or tablereplace.csv from the working directory.

Returns a vector with the column numbers of character variables in the data frame

trims all character variables in a dataframe, sets blank to NA

age category calculator

Variable NA or Null or Empty

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
run_report(
  priority,
  dbserver = NULL,
  dbname = NULL,
  dbuser = NULL,
  dbpassword = NULL,
  outputdir = NULL,
  batchmode = FALSE,
  dbport = NULL,
  dbencrypt = NULL,
  ...
)

getConnectionString(params)

run_db_query(Connection_String, query_text, ...)

get_new_connection(Connection_String)

close_conection(db_conn)

runTableReplacements(ConnectionString)

charVars(df)

trimChrVars(df)

ageCatCalc(age)

NAorNullorEmpty(variable)

Arguments

priority

A character vector. This is the priority table for which you want to generate the report. Options are "P1", "P2", or "P3".

dbserver

A string vector. The name of the database server name. This is selected via an html window.

dbname

A string vector. The name of the database. This is selected via an html window.

dbuser

A string vector. The username that is used to connect to the database. Should be an empty string for windows authentication

dbpassword

A string vector. The password used to connect to the database. Should be an empty string for windows authentication

outputdir

A string vector. The directory for the output document. If none is specified, default is C:/Users/<username>/Documents

batchmode

A boolean value. Parameter to help determine if the code is being run via batch mode or requires the UI for input parameters

dbport

A string value. Optional parameter to specify the server port to use.

dbencrypt

A string value. Parameter to establish if the encryption configurations should be added to the connection string.

...

Extra arguments.

params

R Shiny params object

Connection_String

A string vector. A pre-formated connection string to a database

query_text

A string vector. A pre-formated query to execute

db_conn

Closes a RODBC Open Connection

ConnectionString

A preformated connection string

df

A dataframe

age

An integer value

variable

A variable

Value

Creates a word document generated from an .Rmd file. The file is located in C:/Users/<username>/Documents folder (the My Documents folder for the user who generated the report) and the name of the file is the value of the priority argument (e.g., P1.docx)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
## Not run: 
run_report("P1")

## End(Not run)
## Not run: 
getConnectionString(params)

## End(Not run)
## Not run: 
run_db_query(Connection_String, query_text)

## End(Not run)
## Not run: 
get_new_connection(Connection_String)

## End(Not run)
## Not run: 
close_conection(db_conn)

## End(Not run)
## Not run: 
runTableReplacements(ConnectionString)

## End(Not run)
## Not run: 
charVars(df)

## End(Not run)
## Not run: 
charVars(df)

## End(Not run)
## Not run: 
ageCatCalc(age)

## End(Not run)
## Not run: 
NAorNullorEmpty(variable)

## End(Not run)

UCCC/CHORDS-QA documentation built on July 18, 2021, 6:39 a.m.