Return paths to the two fictional hospital MRFs bundled with cmsmrf for
learning and experimentation. They do not describe real hospital prices or
contracts, and they do not cover every possible CMS source structure.
Value
A visible named character vector of installed, readable JSON paths.
mrf_example() returns basic then detailed; selection returns one
named path. An invalid name or missing installed resource raises an
error.
Details
"basic" is a small, readable disclosure showing hospital context,
services, billing codes, charges, and negotiated dollar amounts. It is
useful for tracing source values into extracted records. "detailed"
shows broader source structure: repeated service records, multiple codes
and charges, drug information, modifiers, contract provisions, percentage
and algorithm negotiated terms, and historical allowed-amount information.
Use these paths directly with mrf_inspect() and mrf_parse(). The full
relational contract is in the data-model vignette.
Examples
# Find both bundled sources, then select and inspect one.
paths <- mrf_example()
paths
#> basic
#> "/home/runner/work/_temp/Library/cmsmrf/examples/hospital-basic.json"
#> detailed
#> "/home/runner/work/_temp/Library/cmsmrf/examples/hospital-detailed.json"
mrf_example("detailed")
#> detailed
#> "/home/runner/work/_temp/Library/cmsmrf/examples/hospital-detailed.json"
mrf_inspect(mrf_example("detailed"))
#> $file_path
#> [1] "/home/runner/work/_temp/Library/cmsmrf/examples/hospital-detailed.json"
#>
#> $file_name
#> [1] "hospital-detailed.json"
#>
#> $file_size_bytes
#> [1] 7605
#>
#> $hospital_name
#> [1] "Fictional Maplebrook Regional Hospital"
#>
#> $declared_version
#> [1] "3.0.0"
#>
#> $supported_schema_version
#> [1] "3.0.0"
#>
#> $supported_version
#> [1] TRUE
#>
#> $last_updated_on
#> [1] "2026-11-15"
#>
#> $location_name_count
#> [1] 2
#>
#> $hospital_address_count
#> [1] 2
#>
#> $type_2_npi_count
#> [1] 2
#>
#> $service_count
#> [1] 4
#>
#> $has_financial_aid_policy
#> [1] TRUE
#>
#> $has_contract_provisions
#> [1] TRUE
#>
#> $has_modifiers
#> [1] TRUE
#>
# Extract both sources to a temporary, persistent DuckDB database.
database <- tempfile(fileext = ".duckdb")
mrf_parse(paths, database, quiet = TRUE)
# Reopen independently to inspect relations, records, and outcomes.
con <- DBI::dbConnect(duckdb::duckdb(), dbdir = database, read_only = TRUE)
#> duckdb keeps downloaded extensions and secrets in a temporary directory:
#> ℹ /tmp/Rtmpf0ZR8c/duckdb
#> This is removed when the R session ends.
#> • Extensions are re-downloaded each session.
#> • Secrets are lost.
#> ℹ Run duckdb(shared_home = TRUE) (or create ~/.duckdb) to keep them (suitable for most users).
#> ℹ Run duckdb(shared_home = FALSE) to accept the temporary directory (and silence this message).
#> ℹ See ?duckdb_storage for details and alternatives.
DBI::dbListTables(con)
#> [1] "charge" "charge_modifier" "contract_provision"
#> [4] "database_metadata" "diagnostic" "file_location"
#> [7] "file_npi" "file_summary" "modifier"
#> [10] "modifier_payer" "mrf_file" "payer_charge"
#> [13] "service" "service_code" "service_drug"
#> [16] "source_file"
DBI::dbGetQuery(con, "SELECT file_id, hospital_name FROM mrf_file ORDER BY file_id")
#> file_id hospital_name
#> 1 1 Fictional Willowmere Community Hospital
#> 2 2 Fictional Maplebrook Regional Hospital
DBI::dbGetQuery(con, paste0(
"SELECT file_id, service_id, description FROM service ",
"ORDER BY file_id, service_id LIMIT 6"
))
#> file_id service_id description
#> 1 1 1 Complete blood count with differential
#> 2 1 2 Chest X-ray, two views
#> 3 2 1 Brain MRI without contrast
#> 4 2 2 Single-dose antineoplastic infusion medication, one vial
#> 5 2 3 Brain MRI without contrast
#> 6 2 4 Inpatient semiprivate room and board, per day
DBI::dbGetQuery(con, "SELECT file_id, status FROM source_file ORDER BY file_id")
#> file_id status
#> 1 1 success
#> 2 2 success
DBI::dbGetQuery(con, paste0(
"SELECT file_id, row_count FROM file_summary ",
"WHERE relation_name = 'service' ORDER BY file_id"
))
#> file_id row_count
#> 1 1 2
#> 2 2 4
DBI::dbDisconnect(con)
unlink(database)
