#' @export
#' @title Function which checks that the organisation unit provided is valid
#'
#' @description Validates that the supplied UID is a valid operating unit UID
#'
#' @inheritParams datim_validation_params
#'
#' @return Returns a vector of organisation unit UIDs
#' @note
#' remapOUs(foo,"https://www.datim.org","admin",
#' "district","code","id","Ab12345678")
#' will remap organisation units specified as codes to UIDs
checkOperatingUnit <- function(organisationUnit = NA,
d2session = dynGet("d2_default_session",
inherits = TRUE)) {
if (is.na(organisationUnit)) {
organisationUnit <- d2session$user_orgunit
}
sites <- getValidOperatingUnits(d2session = d2session)
organisationUnit %in% sites$id
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.