Skip to content

Commit

Permalink
Merge pull request #57 from IDEMSInternational/add_definitions_to_buc…
Browse files Browse the repository at this point in the history
…ket_

Add definitions data back to the bucket
  • Loading branch information
lilyclements authored Jan 16, 2024
2 parents 8ce07d2 + 62d9f09 commit 2557d7d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(add_definitions_to_bucket)
export(annual_rainfall_summaries)
export(annual_temperature_summaries)
export(crop_success_probabilities)
Expand Down
14 changes: 14 additions & 0 deletions R/add_definitions_to_bucket.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#' Add New Definitions to Google Cloud Storage Bucket
#'
#' This function adds a new definitions file with a timestamp to a specified Google Cloud Storage (GCS) bucket. The new definitions are sourced from a JSON file provided as input.
#'
#' @param country A character vector specifying the country or countries from which to get the definitions data. Options are `"mz"` and `"zm"`.
#' @param station_id A character string specifying the ID of the station for which to get the definitions data.
#' @param new_definitions A character vector specifying the path to the JSON file containing the new definitions.
#'
#' @export
#' @details
#' The function creates a timestamp in the format "YYYYMMDDHHMMSS" and appends it to the station_id to form the filename. It then reads the provided JSON file, creates a new JSON file with the timestamped filename, and uploads it to the specified GCS bucket.
add_definitions_to_bucket <- function(country, station_id, new_definitions){
return(epicsadata::add_definitions_to_bucket(country = country, station_id = station_id, new_definitions = new_definitions))
}
21 changes: 21 additions & 0 deletions man/add_definitions_to_bucket.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2557d7d

Please sign in to comment.