Skip to content

Commit

Permalink
ark_taxonomy pin
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewallenbruce committed Nov 22, 2024
1 parent 7343591 commit f4b3999
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 51 deletions.
14 changes: 10 additions & 4 deletions data-raw/nucc_files.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ parse_nucc_csvs <- function(path) {

purrr::walk(nucc_paths, parse_nucc_csvs)

##################### ARCHIVE
# ARCHIVE
archive::archive_write_files(
archive = here::here("data-raw/raw/nucc_taxonomy.tar.xz"),
files = c(
Expand All @@ -92,6 +92,12 @@ archive::archive_write_files(
)
)

fs::dir_delete(
glue::glue("{here::here()}/data-raw/raw/csvs")
)
# fs::dir_delete(glue::glue("{here::here()}/data-raw/raw/csvs"))

archive::archive(file = here::here("data-raw/raw/nucc_taxonomy.tar.xz"))

readr::read_csv(
file = archive::archive_read(archive = here::here("data-raw/raw/nucc_taxonomy.tar.xz"), file = 1L),
show_col_types = FALSE,
col_types = "c",
name_repair = janitor::make_clean_names)
51 changes: 28 additions & 23 deletions data-raw/nucc_pins.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,34 @@ source(here::here("data-raw", "pins_internal.R"))

cleaned_csvs <- fs::dir_info(glue::glue("{here::here()}/data-raw/clean/csvs"))$path

tx_100 <- readr::read_csv(
file = tools::file_path_sans_ext(cleaned_csvs[1]),
id = "filename",
show_col_types = FALSE,
col_types = "c",
name_repair = janitor::make_clean_names
) |>
dplyr::reframe(
release = basename(filename),
version,
release_date,
code,
grouping = type,
classification,
specialization,
definition,
notes
)
cols <- c(
"version",
"release_date",
"code",
"grouping",
"grouping" = "type",
"classification",
"specialization",
"definition",
"notes"
)

read_clean_csvs <- function(x) {
readr::read_csv(
file = tools::file_path_sans_ext(x),
show_col_types = FALSE,
col_types = "c",
name_repair = janitor::make_clean_names) |>
dplyr::select(
dplyr::any_of(cols))
}

ark_taxonomy <- purrr::map(cleaned_csvs[1:20], read_clean_csvs) |>
purrr::list_rbind()

pin_update(
tx_100,
name = "tax_v_10.0",
title = "Taxonomy Codeset v10.0",
description = "Health Care Provider Taxonomy Code Set, Version 10.1, Released 2010-01-01",
force = TRUE
ark_taxonomy,
name = "ark_taxonomy",
title = "NUCC Taxonomy Archive",
description = "Health Care Provider Taxonomy Code Set Archive"
)
6 changes: 2 additions & 4 deletions inst/extdata/pins/_pins.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
tax_v_10.0:
- tax_v_10.0/20241122T094232Z-7a358/
tax_v_10.1:
- tax_v_10.1/20241122T093658Z-1ced0/
ark_taxonomy:
- ark_taxonomy/20241122T213627Z-edbae/
Binary file not shown.
10 changes: 10 additions & 0 deletions inst/extdata/pins/ark_taxonomy/20241122T213627Z-edbae/data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
file: ark_taxonomy.qs
file_size: 722364
pin_hash: edbaea85d09bbffa
type: qs
title: NUCC Taxonomy Archive
description: Health Care Provider Taxonomy Code Set Archive
tags: ~
urls: ~
created: 20241122T213627Z
api_version: 1
10 changes: 0 additions & 10 deletions inst/extdata/pins/tax_v_10.0/20241122T094232Z-7a358/data.txt

This file was deleted.

Binary file not shown.
10 changes: 0 additions & 10 deletions inst/extdata/pins/tax_v_10.1/20241122T093658Z-1ced0/data.txt

This file was deleted.

Binary file not shown.

0 comments on commit f4b3999

Please sign in to comment.