Title: R Interface to Access UKHSA Dashboard Data
Version: 0.1.1
Description: Programmatic interface to access data from the UK Health Security Agency (UKHSA) Data Dashboard API. The package was originally based on the 'ukcovid19' package by Pouria Hadjibagheri and has been substantially rewritten and extended. For more information on the API, see https://ukhsa-dashboard.data.gov.uk/access-our-data.
URL: https://github.com/silverfoxdoc/ukhsadatR
BugReports: https://github.com/silverfoxdoc/ukhsadatR/issues
License: MIT + file LICENSE
Copyright: Ollie Lloyd
Depends: R (≥ 4.3)
Imports: httr2, jsonlite, utils
Suggests: testthat, knitr, rmarkdown
VignetteBuilder: knitr
Encoding: UTF-8
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-06-18 05:57:08 UTC; ollie
Author: Ollie Lloyd ORCID iD [aut, cre, cph], Pouria Hadjibagheri [ctb] (Author of the original 'ukcovid19' package.)
Maintainer: Ollie Lloyd <o.lloyd@doctors.org.uk>
Repository: CRAN
Date/Publication: 2025-06-18 07:50:02 UTC

Get Data

Description

Iteratively runs get_paginated_data to download all results and combine them into a data.frame.

Usage

get_data(
  theme = NULL,
  sub_theme = NULL,
  topic = NULL,
  geography_type = NULL,
  geography = NULL,
  metric = NULL
)

Arguments

theme

the largest overall topical subgroup of data. For example infectious_disease.

sub_theme

a topical subgroup associated with the parent theme. For example respiratory.

topic

categorical subgroup associated with the selected theme and sub_theme. For example, COVID-19.

geography_type

the overarching area type for the intended geography. For example Nation.

geography

the selected area under the geography_type. For example England.

metric

the type of data being selected. For example COVID-19_testing_PCRcountByDay.

Details

For further information on the UKHSA dashboard API please visit the API documentation.

          If any input argument is left NULL or invalid, a list of possible values for that parameter is
                   returned.

Value

           data.frame containing the query results

Examples

get_data(
  theme = "infectious_disease",
  sub_theme = "respiratory",
  topic = "COVID-19",
  geography_type = "Nation",
  geography = "England",
  metric = "COVID-19_cases_casesByDay"
)

Get Paginated Data

Description

Generates API query URL and retrieves paginated data.

Usage

get_paginated_data(
  theme = NULL,
  sub_theme = NULL,
  topic = NULL,
  geography_type = NULL,
  geography = NULL,
  metric = NULL,
  page_number = 1,
  page_size = 365
)

Arguments

theme

the largest overall topical subgroup of data. For example infectious_disease.

sub_theme

a topical subgroup associated with the parent theme. For example respiratory.

topic

categorical subgroup associated with the selected theme and sub_theme. For example, COVID-19.

geography_type

the overarching area type for the intended geography. For example Nation.

geography

the selected area under the geography_type. For example England.

metric

the type of data being selected. For example COVID-19_testing_PCRcountByDay.

page_number

define which page of data to retrieve

page_size

define number of results returned per page. Maximum supported size is 365.

Details

          If any input argument is left NULL or invalid, a list of possible values for that parameter is
                   returned.

Value

           list containing the query structure and results

Examples

get_paginated_data(
  theme = "infectious_disease",
  sub_theme = "respiratory",
  topic = "COVID-19",
  geography_type = "Nation",
  geography = "England",
  metric = "COVID-19_cases_casesByDay",
  page_number = 2
)