readepi is an R package for reading data from several health information systems (HIS) and relational database management systems (RDBMS).
readepi currently supports reading data from the followings:
readepi returns a data frame with the data from the specified system.
readepi is developed by Epiverse-TRACE team at the Medical Research Center, The Gambia unit at London School of Hygiene and Tropical Medicine.
readepi can be installed from CRAN using
install.packages("readepi")
The latest development version of readepi from GitHub with:
if (!require("pak")) install.packages("pak")
::pak("epiverse-trace/readepi")
paklibrary(readepi)
readepi currently has three main functions that read data from a specified source. While the arguments to these functions are generally similar, some are specific to their data source (see the vignette for more details). The examples below show how to use the package functionalities to import data from a variety of sources.
The read_rdbms()
function is used to import data from a
variety of RDBMS, including MS SQL, MySQL, PostgreSQL, and SQLite.
Reading data from a RDBMS requires:
Users can read data from a RDBMS by providing a list with the query parameters of interest or an SQL query (for more information, see the vignette).
# CONNECT TO THE TEST MYSQL SERVER
<- readepi::login(
rdbms_login from = "mysql-rfam-public.ebi.ac.uk",
type = "mysql",
user_name = "rfamro",
password = "",
driver_name = "",
db_name = "Rfam",
port = 4497
)
# DISPLAY THE LIST OF TABLES FROM A DATABASE OF INTEREST
<- readepi::show_tables(login = rdbms_login)
tables
# READING ALL FIELDS AND ALL RECORDS FROM ONE TABLE (`author`) USING AN SQL QUERY
<- readepi::read_rdbms(
dat login = rdbms_login,
query = "select * from author"
)
# SELECT FEW COLUMNS FROM ONE TABLE AND LEFT JOIN WITH ANOTHER TABLE
<- readepi::read_rdbms(
dat login = rdbms_login,
query = "select author.author_id, author.name,
family_author.author_id from author left join family_author on
author.author_id = family_author.author_id"
)
# READING ALL FIELDS AND ALL RECORDS FROM ONE TABLE (`author`) WHERE QUERY PARAMETERS ARE SPECIFIED AS A LIST
<- readepi::read_rdbms(
dat login = rdbms_login,
query = list(table = "author", fields = NULL, filter = NULL)
)
# CONNECT TO A DHIS2 INSTANCE
<- readepi::login(
dhis2_login type = "dhis2",
from = "https://smc.moh.gm/dhis",
user_name = "test",
password = "Gambia@123"
)
# IMPORT DATA FROM DHIS2 FOR THE SPECIFIED ORGANISATION UNIT AND PROGRAM IDs
<- readepi::read_dhis2(
data login = dhis2_login,
org_unit = "GcLhRNAFppR",
program = "E5IUQuHg3Mg"
)
# CONNECT TO THE SORMAS SYSTEM
<- readepi::login(
sormas_login type = "sormas",
from = "https://demo.sormas.org/sormas-rest",
user_name = "SurvSup",
password = "Lk5R7JXeZSEc"
)
# FETCH ALL COVID (coronavirus) CASES FROM THE TEST SORMAS INSTANCE
<- readepi::read_sormas(
covid_cases login = sormas_login,
disease = "coronavirus",
)
The vignette of the readepi package contains detailed illustrations about the use of each function and the description of every argument. This can be accessed by typing the command below:
# OPEN THE VIGNETTE WITHIN RSTUDIO
vignette("readepi")
# OPEN THE VIGNETTE IN YOUR WEB BROWSER.
browseVignettes("readepi")
This package is currently maturing, as defined by the RECON software lifecycle. This means that it can be used in production with the understanding that the interface may still undergo minor changes.
Contributions are welcome via pull requests.
Please note that the readepi project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.