jpinfect

R Package for Acquiring and Processing Data from Japan Institute for Health Security

https://github.com/tomonorihoshi/jpinfect

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: joss.theoj.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.4%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

R Package for Acquiring and Processing Data from Japan Institute for Health Security

Basic Info
  • Host: GitHub
  • Owner: TomonoriHoshi
  • License: gpl-3.0
  • Language: R
  • Default Branch: master
  • Size: 8.71 MB
Statistics
  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 1 year ago · Last pushed 11 months ago
Metadata Files
Readme License Code of conduct

README.md

jpinfect: Notifiable Infectious Diseases in Japan

CRAN status status Total downloads CRAN downloads <!-- badges: end -->

The jpinfect package provides tools for acquiring and processing notifiable infectious disease data in Japan. It is designed to help researchers, public health officials and developers access, clean, and manipulate data. This package aims to streamline data analysis processes while enabling reproducible research in public health and epidemiology.

Key features include:

  • Access ready-to-use datasets for immediate analysis.

  • Automate the downloading of raw data files for notifiable infectious disease, provided by the government

  • Tools for organising and renaming data files when importing into R

  • Combine segmented data files into a single dataset

  • Compatibility with epidemiological analysis and reporting workflows.

Data sourced from the Japan Institute for Health Security (JIHS). Data provided in this package is subject to their open data policy (Government Standard Terms of Use v1.0). For further details, see data usage terms. This library is independently developed and is not affiliated with any government entity.

Installation

The jpinfect package can be installed from either CRAN or GitHub using the remotes package. Through the Github repository, the latest Provisional weekly Case Reports (bullet) data can be acquired, which may not be available on CRAN. To install the package, run the following command in your R console:

From CRAN: r install.packages("jpinfect")

From GitHub (for the latest version): r if(!require("remotes")) install.packages("remotes") remotes::install_github("TomonoriHoshi/jpinfect")

Load the package after installation:

``` r library(jpinfect)

> jpinfect package loaded successfully. Timezone set to Asia/Tokyo.

> Note: Data accuracy depends on the original source.

> Data sourced from the Japan Institute for Health Security (JIHS).

> Usage is subject to their open data policy (Government Standard Terms of Use v1.0).

> Details: https://id-info.jihs.go.jp/usage-contract.html

> This library is independently developed and is not affiliated with any government entity.

```

Usage

Built-in Datasets

The following datasets are included in this package and sourced from the Japan Institute for Health Security (JIHS). These datasets are:

  • sex_prefecture: Confirmed weekly case reports on the sex distribution of reported cases by prefecture from 1999 to 2023. For further details, run ?sex_prefecture.

  • place_prefecture: Confirmed weekly case reports about the place of infection by prefecture between 2001 and 2023. For further details, run ?place_prefecture.

  • bullet: Provisional weekly case reported by prefecture from 2024 to the current latest reports. For further details, run ?bullet.

``` r

Loading build-in datasets

data("sexprefecture") data("placeprefecture") data("bullet") ```

Data Merging

The jpinfect_merge function helps to merge the datasets into one dataset if necessary, which enables users to start their data analysis instantly.

``` r

Merge build-in datasets

Merging confirmed case reports into one dataset

confirmeddataset <- jpinfectmerge(sexprefecture, placeprefecture)

Merge three datasets

bindresult <- jpinfectmerge(sexprefecture, placeprefecture, bullet) ```

Data Transformation from Wider to Longer; Vice Versa

The jpinfect_pivot function enables users to seamlessly pivot datasets between wide and long formats. This functionality is particularly useful for reorganising data to suit analysis or visualisation needs.

``` r

Pivot the dataset: wider to longer

bulletlong <- jpinfectpivot(bullet)

Pivot the dataset: longer to wider

bulletwide <- jpinfectpivot(bullet_long) ```

The jpinfect_pivot function efficiently handles data transformation, ensuring compatibility with epidemiological workflows and making it easier to manage complex datasets.

Building Datasets from Source

Although the build-in datasets are provided in this package, it is ideal for scientists, epidemiologists and public health officers to review whole data handling process from the upstream to downstream. For those who cares the precision of dataset, jpinfect provides the following functions to build the same datasets or even the latest bullet datasets sourced from the government-provided raw data.

Data Source Checks

The sources of these datasets can be checked by using jpinfect_url_confirmed for confirmed case reports and jpinfect_url_bullet for provisional case reports, respectively.

``` r

Check the source URL for confirmed dataset

Download case reports by sex and prefecture

jpinfecturlconfirmed(year = 2021, type = "sex")

Download case reports by the place of incetion and prefecture

jpinfecturlconfirmed(year = 2021, type = "place") ```

Data Acquisition

The raw data can be downloaded using jpinfect_get_confirmed for confirmed case reports and jpinfect_get_bullet for provisional case reports, respectively. Confirmed weekly case data is organised into a single Microsoft Excel file for each year, while provisional data is provided as separate CSV files for each week. Since this function connect to the government website, it may take some time to download the data. To avoid excessive burden on the server, please kindly avoid downloading the files frequently. The downloaded files are saved under the specified directory (e.g., raw_data folder).

``` r

Download data for 2020 and 2021

jpinfectgetconfirmed(years = c(2020, 2021), type = "sex", destdir = "rawdata")

Download data for all available years

jpinfectgetconfirmed(type = "place", destdir = "rawdata")

Download English data for weeks 1 to 5 in 2025

jpinfectgetbullet(year = 2025, week = 1:5, destdir = "rawdata")

Download Japanese data for all weeks in 2025

jpinfectgetbullet(year = 2025, language = "jp", destdir = "rawdata") ```

Data Import

The acquired raw data into your local computer could be imported into R using jpinfect_read_confirmed and jpinfect_read_bullet.

``` r

Import confirmed case reports from file or directory

Process a single file

dataset2021 <- jpinfectreadconfirmed(path = "2021Syu01_1.xlsx")

Process all files in a directory

placedataset <- jpinfectreadconfirmed(path = "rawdata", type = "place")

Import bullet case reports

Import all English reports in a directory

bullet <- jpinfectreadbullet(directory = "raw_data")

Import specific period of the data for 2025, weeks 1 to 10

bullet2025 <- jpinfectreadbullet(year = 2025, week = 1:10, directory = "raw_data") ```

Report a bug

If you encounter a bug or issue while using the jpinfect package, we encourage you to report it. Please follow the steps below to help us resolve the problem efficiently:

  1. Check Existing Issues: Before submitting a new bug report, visit the Issues page on GitHub to check if the issue has already been reported.

  2. Submit a New Issue: If the issue is new, create a detailed report by clicking on the "New Issue" button. Include the following information:

-   A clear description of the issue or unexpected behaviour.

-   Steps to reproduce the issue, if possible.

-   Your R version and operating system (e.g., Windows 10, macOS Ventura).

-   Any relevant error messages or output.

-   Example code or datasets (if applicable) to demonstrate the problem.
  1. Follow-Up: We appreciate your feedback! Once your issue is submitted, we may ask for additional information to resolve it. Please check back periodically for updates.

By contributing bug reports, you help us improve the jpinfect package for everyone. Thank you for your support!

Owner

  • Name: TomonoriHoshi
  • Login: TomonoriHoshi
  • Kind: user

JOSS Publication

An R Package for Acquiring and Processing Notifiable Infectious Diseases Dataset from the Japan Institute for Health Security
Published
November 16, 2025
Volume 10, Issue 115, Page 8577
Authors
Tomonori Hoshi ORCID
Institute of Tropical Medicine, Nagasaki University, Japan, School of Tropical Medicine and Global Health, Nagasaki University, Japan
Erina Ishigaki ORCID
Institute of Tropical Medicine, Nagasaki University, Japan, London School of Hygiene & Tropical Medicine, London, UK, Graduate School of Biomedical Sciences, Nagasaki University, Japan
Satoshi Kaneko ORCID
Institute of Tropical Medicine, Nagasaki University, Japan, School of Tropical Medicine and Global Health, Nagasaki University, Japan, Graduate School of Biomedical Sciences, Nagasaki University, Japan, DEJIMA Infectious Disease Research Alliance, Nagasaki University, Japan
Editor
Frederick Boehm ORCID
Tags
epidemiology infectious disease open data Japan Institute for Health Security

GitHub Events

Total
  • Watch event: 2
  • Public event: 1
  • Push event: 50
  • Pull request event: 8
  • Create event: 3
Last Year
  • Watch event: 2
  • Public event: 1
  • Push event: 50
  • Pull request event: 8
  • Create event: 3

Packages

  • Total packages: 1
  • Total downloads:
    • cran 172 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: jpinfect

Acquiring and Processing Data from Japan Institute for Health Security

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 172 Last month
Rankings
Dependent packages count: 26.4%
Dependent repos count: 32.5%
Average: 48.5%
Downloads: 86.6%
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • dplyr >= 1.1.4 imports
  • future >= 1.34.0 imports
  • future.apply >= 1.11.3 imports
  • httr >= 1.0.0 imports
  • magrittr >= 2.0.3 imports
  • readr >= 2.1.5 imports
  • readxl >= 1.4.5 imports
  • stats >= 4.4.3 imports
  • stringi >= 1.8.7 imports
  • stringr >= 1.5.1 imports
  • tidyr >= 1.3.1 imports
  • tidyselect >= 1.2.1 imports
  • utils * imports
  • knitr * suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests