From 22eac77c05b99fa85db93f14f8ade1a7e9a456cb Mon Sep 17 00:00:00 2001 From: jmhatch Date: Tue, 13 Oct 2026 14:11:32 -0400 Subject: [PATCH 1/3] Ctrl H for MDEB to MDAT --- ...e_mdeb_data.yaml => update_mdat_data.yaml} | 13 +++++------ .../{find_mdeb_data.R => find_mdat_data.R} | 18 +++++++-------- data-raw/{get_mdeb_data.R => get_mdat_data.R} | 22 +++++++++---------- ...b_for_package.R => get_mdat_for_package.R} | 18 +++++++-------- pkgdown/_pkgdown.yml | 4 ++-- 5 files changed, 36 insertions(+), 39 deletions(-) rename .github/workflows/{update_mdeb_data.yaml => update_mdat_data.yaml} (84%) rename data-raw/{find_mdeb_data.R => find_mdat_data.R} (78%) rename data-raw/{get_mdeb_data.R => get_mdat_data.R} (72%) rename data-raw/{get_mdeb_for_package.R => get_mdat_for_package.R} (80%) diff --git a/.github/workflows/update_mdeb_data.yaml b/.github/workflows/update_mdat_data.yaml similarity index 84% rename from .github/workflows/update_mdeb_data.yaml rename to .github/workflows/update_mdat_data.yaml index dfae773..d845cac 100644 --- a/.github/workflows/update_mdeb_data.yaml +++ b/.github/workflows/update_mdat_data.yaml @@ -1,4 +1,4 @@ -name: pull-data-from-MDEB-data-hub +name: pull data from MDAT data hub on: workflow_dispatch: @@ -32,7 +32,6 @@ jobs: with: r-version: '4.2.0' - - name: Install system dependencies uses: r-lib/actions/setup-r-dependencies@v2 @@ -40,21 +39,19 @@ jobs: run: | sudo apt update sudo apt-get install libcurl4-openssl-dev libgit2-dev libudunits2-dev -# sudo apt-get install libgdal-dev libcurl4-gnutls-dev libgit2-dev libudunits2-dev libharfbuzz-dev libfribidi-dev shell: bash - - + - name: Install packages run: | install.packages(c("remotes","here","httr2","jsonlite","dplyr","glue")) remotes::install_github("NEFSC/NEFSC-Spatial") shell: Rscript {0} - - name: Pull MDEB data and save to repo + - name: Pull MDAT data and save to repo run: | options(timeout = 60 * 60 * 6) - source(here::here("data-raw/get_mdeb_for_package.R")) - get_mdeb_for_package(overwrite = TRUE) + source(here::here("data-raw/get_mdat_for_package.R")) + get_mdat_for_package() shell: Rscript {0} # Create the Pull Request from dev if changes are detected diff --git a/data-raw/find_mdeb_data.R b/data-raw/find_mdat_data.R similarity index 78% rename from data-raw/find_mdeb_data.R rename to data-raw/find_mdat_data.R index 7abe795..cae6a1e 100644 --- a/data-raw/find_mdeb_data.R +++ b/data-raw/find_mdat_data.R @@ -1,9 +1,9 @@ -#' Find available data hosted on the MDEB (Marine Development and Ecology Branch) GIS Data Hub +#' Find available data hosted on the MDAT (Marine Development and Advanced Technology Program) GIS Data Hub #' hosted on NOAA's Geoplatform #' #' @description #' This function retrieves the data available on the -#' \href{https://mdeb-nefsc-noaa.hub.arcgis.com/}{MDEB GIS Data Hub}. +#' \href{https://mdeb-nefsc-noaa.hub.arcgis.com/}{MDAT GIS Data Hub}. #' #' @return A tibble with the following columns: #' \item{title}{Name of the NOAA Geoplatform feature service} @@ -13,21 +13,21 @@ #' #' @examples #' # Retrieve a list of available data -#' mdeb_data <- find_mdeb_data() -#' mdeb_data +#' mdat_data <- find_mdat_data() +#' mdat_data #' #' @export -find_mdeb_data <- function() { - # url of the MDEB GIS Data Hub search API - mdeb_hub <- "https://mdeb-nefsc-noaa.hub.arcgis.com/api/search/v1/collections/all/items" +find_mdat_data <- function() { + # url of the MDAT GIS Data Hub search API + mdat_hub = "https://mdeb-nefsc-noaa.hub.arcgis.com/api/search/v1/collections/all/items" # scrape json to get all feature services - catalog_items <- mdeb_hub |> + catalog_items <- mdat_hub |> jsonlite::fromJSON() # count the number of available services num_items <- catalog_items$numberMatched # pull all feature service items (API default = 10) - catalog_items_v2 <- paste0(mdeb_hub, "?limit=", num_items) |> + catalog_items_v2 <- paste0(mdat_hub, "?limit=", num_items) |> jsonlite::fromJSON() # extract metadata properties available_datasets <- catalog_items_v2$features$properties |> diff --git a/data-raw/get_mdeb_data.R b/data-raw/get_mdat_data.R similarity index 72% rename from data-raw/get_mdeb_data.R rename to data-raw/get_mdat_data.R index 5105966..faf780b 100644 --- a/data-raw/get_mdeb_data.R +++ b/data-raw/get_mdat_data.R @@ -1,45 +1,45 @@ -#' Get data from the MDEB (Marine Development and Ecology Branch) GIS Data Hub -#' hosted on NOAA's Geoplatform +#' Get data from the MDAT (Marine Development and Advanced Technology Program) GIS Data Hub +#' hosted on NOAA's GeoPlatform #' #' @description -#' This function retrieves data from the \href{https://mdeb-nefsc-noaa.hub.arcgis.com/}{MDEB GIS Data Hub}. +#' This function retrieves data from the \href{https://mdeb-nefsc-noaa.hub.arcgis.com/}{MDAT GIS Data Hub}. #' #' @param dataset_name Name of the dataset to retrieve. #' @param dataset_id ID of the dataset layer to retrieve. #' #' @section Available data: #' The list of available data and corresponding REST URLs -#' can be found by running `find_mdeb_data()`. +#' can be found by running `find_mdat_data()`. #' #' @return An sf data.frame-like object #' #' @examples -#' # Pull EcoMon Survey strata from MDEB GIS Data Hub -#' ecomon_strata <- get_mdeb_data(dataset_name = "Ecosystem Monitoring Survey", dataset_id = 1) +#' # Pull EcoMon Survey strata from MDAT GIS Data Hub +#' ecomon_strata <- get_mdat_data(dataset_name = "Ecosystem Monitoring Survey", dataset_id = 1) #' # Plot the data #' plot(ecomon_strata) #' #' @export -get_mdeb_data <- function(dataset_name = NULL, dataset_id = NULL) { +get_mdat_data <- function(dataset_name = NULL, dataset_id = NULL) { # check if dataset_name, dataset_id is NULL if (is.null(dataset_name) || is.null(dataset_id)) { message( "Neither dataset_name or id can be NULL. To find the list of available datasets, please use run - find_mdeb_data()." + find_mdat_data()." ) return() } - allData <- find_mdeb_data() + allData <- find_mdat_data() set <- allData |> dplyr::filter(title == dataset_name, id == dataset_id) if (nrow(set) == 0) { stop( - "Data set not found. To find the list of available datasets, please use run - find_mdeb_data()" + "Data set not found. To find the list of available datasets, please run + find_mdat_data()" ) } diff --git a/data-raw/get_mdeb_for_package.R b/data-raw/get_mdat_for_package.R similarity index 80% rename from data-raw/get_mdeb_for_package.R rename to data-raw/get_mdat_for_package.R index df8c84b..e319fea 100644 --- a/data-raw/get_mdeb_for_package.R +++ b/data-raw/get_mdat_for_package.R @@ -1,24 +1,24 @@ -#' Pull all content from MDEB data hub and create sf objects +#' Pull all content from MDAT data hub and create sf objects #' #' Pulls the data and converts to sf, then saves as part of the package #' #' #' -source(here::here("data-raw/find_mdeb_data.R")) -source(here::here("data-raw/get_mdeb_data.R")) -source(here::here("data-raw/generate_roxygen_mdeb.R")) +source(here::here("data-raw/find_mdat_data.R")) +source(here::here("data-raw/get_mdat_data.R")) +source(here::here("data-raw/generate_roxygen_mdat.R")) -get_mdeb_for_package <- function(overwrite = FALSE) { - # find all the data set on the MDEB HUB - datasets <- find_mdeb_data() +get_mdat_for_package <- function(overwrite = FALSE) { + # find all the data set on the MDAT HUB + datasets <- find_mdat_data() # loop through each and save as rda file. # also create documentation for each dataset for (ids in 1:nrow(datasets)) { dataset <- datasets[ids, ] message("Processing: ", dataset$title) - data <- get_mdeb_data(dataset$title, dataset$id) + data <- get_mdat_data(dataset$title, dataset$id) if (!is.null(data)) { # Save the data as an R object in the package dataset_name <- tolower(gsub("SMIT_", "", dataset$name)) @@ -52,7 +52,7 @@ get_mdeb_for_package <- function(overwrite = FALSE) { ) } # Generate Roxygen data doc - generate_roxygen_mdeb( + generate_roxygen_mdat( dataset_name = paste0(dataset_name, '.rda'), title = dataset$title, description = modified_dataset_description diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index fe9f505..bda7f5b 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -42,8 +42,8 @@ navbar: articles: text: Articles menu: - - text: MDEB Datasets - href: articles/mdeb_datasets.html + - text: MDAT Datasets + href: articles/mdat_datasets.html - text: Team Members href: articles/teamMembers.html From 0e9891dd545f2fd841a15f09a39a377c271bd03a Mon Sep 17 00:00:00 2001 From: jmhatch Date: Tue, 13 Oct 2026 14:18:03 -0400 Subject: [PATCH 2/3] Address formatting issue, = to <- --- data-raw/find_mdat_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-raw/find_mdat_data.R b/data-raw/find_mdat_data.R index cae6a1e..6c18db5 100644 --- a/data-raw/find_mdat_data.R +++ b/data-raw/find_mdat_data.R @@ -20,7 +20,7 @@ find_mdat_data <- function() { # url of the MDAT GIS Data Hub search API - mdat_hub = "https://mdeb-nefsc-noaa.hub.arcgis.com/api/search/v1/collections/all/items" + mdat_hub <- "https://mdeb-nefsc-noaa.hub.arcgis.com/api/search/v1/collections/all/items" # scrape json to get all feature services catalog_items <- mdat_hub |> jsonlite::fromJSON() From 510da94fd70a71d21f8df35426a59342a487ca3c Mon Sep 17 00:00:00 2001 From: jmhatch <35869229+jmhatch@users.noreply.github.com> Date: Tue, 13 Oct 2026 14:34:59 -0400 Subject: [PATCH 3/3] Update .github/workflows/update_mdat_data.yaml Co-authored-by: Andy Beet <22455149+andybeet@users.noreply.github.com> --- .github/workflows/update_mdat_data.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_mdat_data.yaml b/.github/workflows/update_mdat_data.yaml index d845cac..653b272 100644 --- a/.github/workflows/update_mdat_data.yaml +++ b/.github/workflows/update_mdat_data.yaml @@ -51,7 +51,7 @@ jobs: run: | options(timeout = 60 * 60 * 6) source(here::here("data-raw/get_mdat_for_package.R")) - get_mdat_for_package() + get_mdat_for_package(overwrite = TRUE) shell: Rscript {0} # Create the Pull Request from dev if changes are detected