Build a Query for an Endpoint
Examples
build(
endpoint("drug_state"),
query(year = 2022:2024,
state = any_of("GA", "NY")))
#> Found 873.6 K ▶ Total 15.6 M ▶ Pages 110
#> <class_response>
#> @ alias : chr "drug_state"
#> @ title : chr "State Drug Utilization Data"
#> @ param :List of 3
#> .. $ 2024: chr "state"
#> .. $ 2023: chr "state"
#> .. $ 2022: chr "state"
#> @ year : int [1:3] 2024 2023 2022
#> @ string: chr [1:3] "https://data.medicaid.gov/api/1/datastore/query/61729e5a-7aa8-448c-8903-ba3e0cd0ea3c/0?count=true&results=true&"| __truncated__ ...
#> @ limit : int 8000
#> @ found : int [1:3] 262185 286759 324621
#> @ total : int [1:3] 5205065 5277298 5164804
#> @ pages : int [1:3] 33 36 41
#> @ error : logi [1:3] FALSE FALSE FALSE
build(
endpoint("enroll_prov"),
query(enrlmt_id = "I20040309000221"))
#> <class_response>
#> @ alias : chr "enroll_prov"
#> @ title : chr "Medicare Fee-For-Service Public Provider Enrollment"
#> @ param : chr "ENRLMT_ID"
#> @ year : int 2025
#> @ string: chr "https://data.cms.gov/data-api/v1/dataset/2457ea29-fc82-48b0-86ec-3b0755de7515/data-viewer/stats?offset=0&size=1"| __truncated__
#> @ limit : int 5000
#> @ found : int 1
#> @ total : int 2894910
#> @ pages : int 1
#> @ error : logi FALSE
build(
collection("dialysis"),
query(state = "AL"))
#> ! No query for dial_nation
#> $dial_listing
#> <class_response>
#> @ alias : chr "dial_listing"
#> @ title : chr "Dialysis Facility - Listing by Facility"
#> @ param : chr "state"
#> @ year : int 2025
#> @ string: chr "https://data.cms.gov/provider-data/api/1/datastore/query/23ew-n7w9/0?count=true&results=true&offset=0&limit=1&c"| __truncated__
#> @ limit : int 1500
#> @ found : int 178
#> @ total : int 7561
#> @ pages : int 1
#> @ error : logi FALSE
#>
#> $dial_nation
#> <class_response>
#> @ alias : chr "dial_nation"
#> @ title : chr "Dialysis Facility - National Averages"
#> @ param : chr(0)
#> @ year : int 2025
#> @ string: chr "https://data.cms.gov/provider-data/api/1/datastore/query/2rkq-ygai/0"
#> @ limit : int 1500
#> @ found : int 0
#> @ total : int 1
#> @ pages : int 0
#> @ error : logi FALSE
#>
#> $dial_state
#> <class_response>
#> @ alias : chr "dial_state"
#> @ title : chr "Dialysis Facility - State Averages"
#> @ param : chr "state"
#> @ year : int 2025
#> @ string: chr "https://data.cms.gov/provider-data/api/1/datastore/query/2fpu-cgbb/0?count=true&results=true&offset=0&limit=1&c"| __truncated__
#> @ limit : int 1500
#> @ found : int 1
#> @ total : int 56
#> @ pages : int 1
#> @ error : logi FALSE
#>
build(
endpoint("dial_facility"),
query(
state = "GA",
city = "Atlanta",
provcity = "Atlanta",
provider_name = starts_with("C"),
provname = starts_with("C")
)
)
#> Found 15.3 K ▶ Total 65.2 M ▶ Pages 6
#> <class_response>
#> @ alias : chr "dial_facility"
#> @ title : chr "Medicare Dialysis Facilities"
#> @ param :List of 6
#> .. $ 2025: chr [1:3] "state" "Provider_Name" "city"
#> .. $ 2024: chr [1:3] "state" "Provider_Name" "city"
#> .. $ 2023: chr [1:3] "state" "Provider_Name" "city"
#> .. $ 2022: chr [1:3] "state" "Provider_Name" "city"
#> .. $ 2021: chr [1:3] "State" "Provider Name" "City"
#> .. $ 2020: chr [1:3] "state" "provname" "provcity"
#> @ year : int [1:6] 2025 2024 2023 2022 2021 2020
#> @ string: chr [1:6] "https://data.cms.gov/data-api/v1/dataset/7d4e7bd1-f08a-4fca-8085-6af24026a19a/data/stats?offset=0&size=1&filter"| __truncated__ ...
#> @ limit : int 5000
#> @ found : int [1:6] 3663 3628 2514 2203 1809 1452
#> @ total : int [1:6] 11985275 11679243 11716732 10821385 9701304 9289559
#> @ pages : int [1:6] 1 1 1 1 1 1
#> @ error : logi [1:6] FALSE FALSE FALSE FALSE FALSE FALSE
build(
endpoint("qppe"),
query(
year = 2021:2023,
practice_state_or_us_territory = any_of("GA", "FL"),
practice_size = less_than(10, or_equal = TRUE)
)
)
#> Found 28.3 K ▶ Total 1.8 M ▶ Pages 7
#> <class_response>
#> @ alias : chr "qppe"
#> @ title : chr "Quality Payment Program Experience"
#> @ param :List of 3
#> .. $ 2023: chr [1:2] "practice state or us territory" "practice size"
#> .. $ 2022: chr [1:2] "practice state or us territory" "practice size"
#> .. $ 2021: chr [1:2] "practice state or us territory" "practice size"
#> @ year : int [1:3] 2023 2022 2021
#> @ string: chr [1:3] "https://data.cms.gov/data-api/v1/dataset/3545dc8e-7037-41ee-8a1d-9f3198fe4927/data/stats?offset=0&size=1&filter"| __truncated__ ...
#> @ limit : int 5000
#> @ found : int [1:3] 8003 8710 11580
#> @ total : int [1:3] 524998 624200 698730
#> @ pages : int [1:3] 2 2 3
#> @ error : logi [1:3] FALSE FALSE FALSE
build(
endpoint("hc_quality"),
query(state = any_of("Georgia", "Alabama"),
year = 2020:2023))
#> Found 820 ▶ Total 17.1 K ▶ Pages 4
#> <class_response>
#> @ alias : chr "hc_quality"
#> @ title : chr "Child and Adult Health Care Quality Measures"
#> @ param :List of 4
#> .. $ 2023: chr "state"
#> .. $ 2022: chr "state"
#> .. $ 2021: chr "state"
#> .. $ 2020: chr "state"
#> @ year : int [1:4] 2023 2022 2021 2020
#> @ string: chr [1:4] "https://data.medicaid.gov/api/1/datastore/query/e85033c7-367e-467e-9e81-8e85048102b8/0?count=true&results=true&"| __truncated__ ...
#> @ limit : int 8000
#> @ found : int [1:4] 271 195 185 169
#> @ total : int [1:4] 5662 4206 3830 3450
#> @ pages : int [1:4] 1 1 1 1
#> @ error : logi [1:4] FALSE FALSE FALSE FALSE
build(
endpoint("pdc_clinician"),
query(
provider_first_name = starts_with("An"),
provider_last_name = contains("JE"),
state = any_of("CA", "GA", "NY")))
#> <class_response>
#> @ alias : chr "pdc_clinician"
#> @ title : chr "National Downloadable File"
#> @ param : chr [1:3] "provider_last_name" "provider_first_name" "state"
#> @ year : int 2025
#> @ string: chr "https://data.cms.gov/provider-data/api/1/datastore/query/mj5m-pzi6/0?count=true&results=true&offset=0&limit=1&c"| __truncated__
#> @ limit : int 1500
#> @ found : int 61
#> @ total : int 2829975
#> @ pages : int 1
#> @ error : logi FALSE