Learn R Programming

healthyR.data (version 1.2.0)

get_cms_meta_data: Retrieve CMS Metadata Links from CMS

Description

This function sends a request to the specified CMS data URL, retrieves the JSON data, and processes it to create a tibble with relevant information about the datasets.

Usage

get_cms_meta_data(
  .title = NULL,
  .modified_date = NULL,
  .keyword = NULL,
  .identifier = NULL,
  .data_version = "current",
  .media_type = "all"
)

Value

A tibble with data links and relevant metadata about the datasets.

Arguments

.title

This can be a title that is used to search the data.

.modified_date

This can be a date in the format of "YYYY-MM-DD"

.keyword

This can be a keyword that is used to search the data.

.identifier

This can be an identifier that is used to search the data.

.data_version

This can be one of three different choices: "current", "archive", or "all". The default is "current" and if you make a choice that does not exist then it will default to "current".

.media_type

This can be one of three different choices: "all", "csv", "API", or "other". The default is "all" and if you make a choice that does not exist then it will default to "all".

Author

Steven P. Sanderson II, MPH

Details

The function fetches JSON data from the CMS data URL and extracts relevant fields to create a tidy tibble. It selects specific columns, handles nested lists by unnesting them, cleans column names, and processes dates and media types to make the data more useful for analysis. The columns in the returned tibble are:

  • title

  • description

  • landing_page

  • modified

  • keyword

  • described_by

  • fn

  • has_email

  • identifier

  • start

  • end

  • references

  • distribution_description

  • distribution_title

  • distribution_modified

  • distribution_start

  • distribution_end

  • media_type

  • data_link

See Also

https://data.cms.gov/data.json

Other Meta Data: get_provider_meta_data()

Examples

Run this code
library(dplyr)

# Fetch and process metadata from the CMS data URL
get_cms_meta_data(
  .keyword = "nation",
  .title = "Market Saturation & Utilization State-County"
) |>
  glimpse()

Run the code above in your browser using DataLab