get_cms_meta_data: Retrieve CMS Metadata Links from CMS

View source: R/meta-get-cms-data.R

get_cms_meta_dataR Documentation

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"
)

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".

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

Value

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

Author(s)

Steven P. Sanderson II, MPH

See Also

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

Other Meta Data: get_provider_meta_data()

Examples

library(dplyr)

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


healthyR.data documentation built on July 4, 2024, 5:07 p.m.