repeated_facility_table: Write NSSP BioSense Platform Data Quality Summary Reports for...

Description Usage Arguments Value Examples

View source: R/repeated_facility_table.R

Description

This function iteratively performs 'write_facilty_report' function for all . It will generate summary report for all specified facility. The summary workbook shows percents and counts of nulls and invalids, Additionally it generates a timeliness report and creates a table. The program can send out a report to designated email address

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
repeated_facility_table(
  contact,
  table,
  mft,
  username,
  password,
  start,
  end,
  directory,
  field = NA,
  exclude = NA,
  optional = T,
  email = F,
  sender,
  email_password,
  personname = NA,
  title = NA,
  phone = NA
)

Arguments

contact

A datatable of 2 colomns, facility is the facility number, receiver is the receive email address

table

The table that you want to retrieve the data from, as a string.

mft

The MFT (master facilities table) from where the facility name will be retrieved, as a string.

username

Your BioSense username, as a string. This is the same username you may use to log into RStudio or Adminer.

password

Your BioSense password, as a string. This is the same password you may use to log into RStudio or Adminer.

start

The start date time that you wish to begin pulling data from, as a string.

end

The end data time that you wish to stop pulling data from, as a string.

directory

The directory where you would like to write the reports to (i.e., "~/Documents/MyReports"), as a string.

field

Default NA. Can add a string with delimiter of ':'. Only fields that countain those words will be included in the final report.

exclude

Default NA. Can add a string with delimiter of ':'. Exclude fields with certain keywords in the final report.

optional

Default True. If False then remove all optional fields

email

Default False. If True, then the function will atempt to send out a form

sender

Email address of sender. Make sure it's kdhe.KS.gov

email_password

Your Email Password

personname

Your Name to be used in your email text

title

Your job title to be used in your email text

phone

Your phone number to be used in your email text

Value

Report table stored at directory location. If email=TRUE, then a email will be sent. A table with facility, receiver and conformation of email being sent.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(emayili)
library(ggplot2)
library(readxl)
library(keyring)

## store passwords for essence
key_set(service = "essence")
## store passwords for email
key_set(service = "email")
Facilities_Spreadsheet <- read_excel("Facilities Spreadsheet.xlsx", 
sheet = "Data Quality Reports")
contact<-as.data.frame(cbind(Facilities_Spreadsheet$C_Biosense_Facility_ID, Facilities_Spreadsheet$`Facilty Contact Email`)) 
colnames(contact)=c('facility','receiver')
repeated_facility_table(contact=contact, username="bzhang02", password=key_get("essence"),
 table="KS_PR_Processed", mft="KS_MFT",  start="2020-05-01 00:00:00", 
 end="2020-05-30 23:59:59", directory="~",
 email =TRUE,sender="bo.zhang@kdhe.ks.gov",
email_password=key_get("email"),personname='Bo Zhang',title='intern',phone='630-457-8915')

princeofbrit/Biosensequlaty_BZ documentation built on Sept. 1, 2020, 6:46 p.m.