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

Description Usage Arguments Value Examples

View source: R/write_facility_bo.R

Description

This function is a write_reports function. It will generate summary report for one 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
20
21
write_facility_report(
  username,
  password,
  table,
  mft,
  start,
  end,
  facility,
  directory = "",
  field = NA,
  exclude = NA,
  optional = TRUE,
  email = FALSE,
  sender = NA,
  receiver = NA,
  email_password = NA,
  personname = NA,
  title = NA,
  phone = NA,
  inline = F
)

Arguments

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.

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.

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.

facility

The C_Biosense_Facility_ID for the facility that you wish to generate and write the report for.

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

receiver

Email address of receiver.

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

A report table stored at directory location. If email=TRUE, then a email will be sent, along with a confirmation of email being sent. Common Trouble Shoots: | Error Message | Solution | | ————- | ————- | | Error: Start time after end time | Make sure start time occurs after endtime | | The query yielded no data. | The facility doesn't have data for the input time period | | 535 5.7.3 Authentication unsuccessful | Double check email address and password make sure to us @kdhe.ks.gov|

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
library(emayili)
library(ggplot2)
library(keyring)
library(readxl)
## store passwords for essence
key_set(service = "essence")
## store passwords for email
key_set(service = "email")
## if you want the report only 
write_facility_report(username="bzhang02", password=key_get("essence"), 
                   table="KS_PR_Processed", mft="KS_MFT",
                   start="2020-06-1 00:00:00", 
                   end="2020-07-31 23:59:59",
                   facility=3890,
                   directory="~") 
 ## if you want to only include field containing sex and age
write_facility_report(username="bzhang02", password=key_get("essence"), 
                   table="KS_PR_Processed", mft="KS_MFT",
                   start="2020-06-1 00:00:00", 
                   end="2020-07-31 23:59:59", field="sex;age"
                   facility=3890,
                   directory="~") 
## if you want to exclude certain fields
write_facility_report(username="bzhang02", password=key_get("essence"), 
                   table="KS_PR_Processed", mft="KS_MFT",
                   start="2020-06-1 00:00:00", 
                   end="2020-07-31 23:59:59",
                   exclude=field
                   facility=3890,
                   directory="~") 
## if you want to send out an email                  
write_facility_report(username="bzhang02", password=key_get("essence"), 
                   table="KS_PR_Processed", mft="KS_MFT",
                   start="2020-06-1 00:00:00", 
                   end="2020-07-31 23:59:59",
                   facility=3890,
                   directory="~",
                   email =TRUE,sender='bo.zhang@kdhe.ks.gov',receiver="bo.zhang@kdhe.ks.gov;Greg.Crawford@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.