An open API service indexing awesome lists of open source software.

https://github.com/epiverse-trace/readepi

An R package for importing epi data into R.
https://github.com/epiverse-trace/readepi

data-import epidemiology epiverse health-information-systems r r-package

Last synced: 3 months ago
JSON representation

An R package for importing epi data into R.

Awesome Lists containing this project

README

          

---
output: github_document
editor_options:
markdown:
wrap: 72
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# readepi: Read data from health information systems

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit/)
[![R-CMD-check](https://github.com/epiverse-trace/readepi/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/epiverse-trace/readepi/actions/workflows/R-CMD-check.yaml) [![Codecov test coverage](https://codecov.io/gh/epiverse-trace/readepi/branch/main/graph/badge.svg)](https://app.codecov.io/gh/epiverse-trace/readepi?branch=main) [![lifecycle-concept](https://raw.githubusercontent.com/reconverse/reconverse.github.io/master/images/badge-maturing.svg)](https://www.reconverse.org/lifecycle.html#concept)

**{readepi}** is an R package for reading data from several health information systems (HIS) including public repositories, relational database management systems (RDBMS).

**{readepi}** currently supports reading data from the followings:

- RDBMS (Relational Database Management Systems) such as MS SQL, MySQL, and PostgreSQL\
- [REDCap](https://projectredcap.org/software/): Research Electronic Data Capture - a secure web application for building and managing online surveys and databases\
- [DHIS2](https://dhis2.org/about/): an open source and web-based platform for managing health information\
- [Fingertips](https://fingertips.phe.org.uk/): a repository of public health indicators in England

**{readepi}** returns a list object containing one or more data frames. **{readepi}** also has a number of auxiliary functions that allow importing a subset of the original dataset.

**{readepi}** is developed by [Epiverse-TRACE](https://data.org/initiatives/epiverse/) team at the [Medical Research Center, The Gambia unit at London School of Hygiene and Tropical Medicine](https://www.lshtm.ac.uk/research/units/mrc-gambia).

## Installation

You can install the development version of **{readepi}** from [GitHub](https://github.com/epiverse-trace/readepi) with:

```{r message=FALSE}
if (!require("pak")) install.packages("pak")
pak::pak("epiverse-trace/readepi")
library(readepi)
```

## Quick start

The main function in **{readepi}** is `readepi()`. It reads data from a specified source. The `readepi()` function accepts a user-supplied string (the API's URL) as argument. Other specific arguments can be provided depending on the data source (see the **vignette** for more details). The examples below show how to use the `readepi()` function to import data from a variety of sources.

### Reading data from RDBMS and HIS

The `readepi()` function can import data from a variety of RDBMS, including MS SQL, MySQL, and PostgreSQL. Reading data from a RDBMS requires the following:

1. A MS SQL driver that is compatible with the version of DBMS of interest. The **vignette** describes how to install the appropriate driver for each database management system.\
2. Valid Credentials to access the server. The user credential details are expected to be stored in a file that will be supplied as an argument of the `readepi()` function. Use the `show_example_file()` function to visualize the structure of the template credential file.

Users can read data from a RDBMS by providing the details of the tables of interest or an SQL query (for more information, see the **vignette**).

```{r eval=FALSE}
# DEFINE THE PATH TO THE CREDENTIAL FILE
credentials_file <- system.file("extdata", "test.ini", package = "readepi")

# DISPLAY THE STRUCTUTRE OF THE TEMPLATE CREDENTIAL FILE
show_example_file()

# READING FILE FROM A PROJECT IN A REDCap DATABASE
dat <- readepi(
data_source = "https://bbmc.ouhsc.edu/redcap/api/",
credentials_file = credentials_file
)
project_data <- dat$data # accessing the actual data
project_metadeta <- dat$metadata # accessing the metadata associated with project

# VIEWING THE LIST OF ALL TABLES IN A MySQL DATABASE
show_tables(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
driver_name = "" # note that this example MySQL server does not require a driver
)

# VISUAIZE FIRST 5 ROWS OF THE TABLE 'AUTHOR'
visualise_table(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = "author", # this is the table name
driver_name = ""
)

# READING ALL FILEDS AND RECORDS FROM A MySQL SERVER
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = "author", # this is the table name
driver_name = ""
)

# READING DATA FROM DHIS2
dat <- readepi(
data_source = "https://play.dhis2.org/dev",
credentials_file = credentials_file,
dataset = "BfMAe6Itzgt",
organisation_unit = "Umh4HKqqFp6",
data_element_group = NULL,
start_date = "2014",
end_date = "2023"
)

# READING DATA FROM THE FINGERTIPS REPOSITORY
dat <- readepi(
indicator_id = 90362,
area_type_id = 202,
parent_area_type_id = 6 # optional
)
```

## Package Vignettes

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:

```{r eval=FALSE}
# OPEN THE VIGNETTE WITHIN RSTUDIO
vignette("readepi")

# OPEN THE VIGNETTE IN YOUR WEB BROWSER.
browseVignettes("readepi")
```

## Development

### Lifecycle

This package is currently a *maturing*, as defined by the [RECON software
lifecycle](https://www.reconverse.org/lifecycle.html). This means that it can be used in production with the understanding that the interface may still undergo minor changes.

### Contributions

Contributions are welcome via [pull requests](https://github.com/{{ gh_repo }}/pulls).

### Code of Conduct

Please note that the {{ packagename }} project is released with a
[Contributor Code of Conduct](https://github.com/epiverse-trace/.github/blob/main/CODE_OF_CONDUCT.md).
By contributing to this project, you agree to abide by its terms.