knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Generate standardised reports from the MSF OCA HIS EMR.
This package is designed to provide reporting functionality for the MSF OCA EMR being released in 2019. Functions for connecting to the PostgreSQL data base, data reformatting and R-markdown templates are all included. The package has been designed with automated workflows in mind rather than interactive use since this is likely to be the most frequent use-case.
You can install the released version of hisreportr
from Github with:
# installing packages from Github requires devtools require(devtools) # install package devtools::install_github("JayAchar/hisreportr") # load package library(hisreportr)
The access_postgresql()
has been configured to access the MSF OCA
PostgreSQL server instance using the credentials provided by system
administrators. The following environment variables are accessed
by the render_report()
function to access the server for data
retrieval:
To generate reports using render_report()
, these environment variables
should be defined, or R markdown parameters passed during the function call.
Please see the render_report()
documentation about how this can be done.
The code below gives an example of how to include add a R environment variable:
# add PostgreSQL server password to R environment Sys.setenv(PGRES_PWD_OCA = "testpwd1234")
This will add the environment variable and password to the .Renviron
file, which is executed when R starts up.
Report templates are saved in the inst/rmarkdown
folder. Current plans are for the following report templates to be developed:
Future development time may focus on data quality reports, annualised reports, more detailed cohort reports or interactive data visualisation through the use of Shiny.
To generate a report using this package to connect to the current PostgreSQL server instance, use the render_report()
function. A suggested function call is described:
# generate a TB monthly cohort report including data from October 2019 render_report(report_name = "tb_month", output_dir = "~/Documents", params = list(reporting_month = 10, reporting_year = 2019))
The argument output_dir
can be used to define the local output directory. In the example above, the .html file will be saved to the user's Documents folder.
The parameters reporting_month
and reporting_year
have been included within each monthly template to allow users to re-generate historical reports. If they are not defined in the function call, values from the current local date will be substituted.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.