Skip to content

Commit 39f5972

Browse files
committed
v0.1.122 Added validation_occurrencestatus_notstandard data check
1 parent e31468a commit 39f5972

8 files changed

+151
-1
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: bdchecks
22
Title: Biodiversity Data Checks
33
Description: Supplies a set of functions to perform and manage data checks for biodiversity data.
4-
Version: 0.1.121
4+
Version: 0.1.122
55
Date: 2019-12-22
66
License: GPL-3 | file LICENSE
77
URL: https://github.com/bd-R/bdchecks

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export(dc_validation_month_notstandard)
4141
export(dc_validation_occurrenceid_empty)
4242
export(dc_validation_occurrenceid_notstandard)
4343
export(dc_validation_occurrencestatus_empty)
44+
export(dc_validation_occurrencestatus_notstandard)
4445
export(dc_validation_order_notfound)
4546
export(dc_validation_phylum_notfound)
4647
export(dc_validation_scientificname_empty)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#' @rdname dc_validation_occurrencestatus_notstandard
2+
#'
3+
#' @param TARGET a vector of occurrenceStatus information. To pass it must be
4+
#' within given reference dictionary.
5+
#' @param sources a vector of available sources.
6+
#'
7+
dc_validation_occurrencestatus_notstandard <- function(
8+
TARGET = NULL,
9+
sources = c(
10+
"present",
11+
"absent"
12+
)
13+
) {
14+
result <- TARGET %>%
15+
gsub(" ", "", .) %>% # Remove possible spaces
16+
gsub("_| |\\.|-", "", .) %>% # Remove seperators
17+
tolower()
18+
result <- result %in% sources
19+
return(perform_dc_missing(result, TARGET))
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#'
2+
#' Data check validation_occurrencestatus_notstandard Check if occurrenceStatus is specified source authority service.
3+
#'
4+
#' This data check answers: "Is occurrenceStatus within given source authority list?" question.\cr Data check will pass if \strong{The value for occurrenceStatus is present and correct.} and will fail if \strong{The value for occurrenceStatus is missing or incorrect.}.\cr Dimension of this data check is \strong{} and it's flagging type is: \strong{FLAG}\cr Example of entries that will pass: \code{occurrenceStatus=present}, such data check would return \code{TRUE}.\cr Example of entries that will fail: \code{occurrenceStatus=observed}, such data check would return \code{FALSE}.
5+
#' @name dc_validation_occurrencestatus_notstandard
6+
#' @format An object of class function to perform a specific data check.
7+
#' @references None
8+
#' @examples
9+
#' perform_dc(data_bats, 'validation_occurrencestatus_notstandard')
10+
#' @section samplePassData:
11+
#' The value for occurrenceStatus is present and correct.
12+
#' @section sampleFailData:
13+
#' The value for occurrenceStatus is missing or incorrect.
14+
#' @section targetDWCField:
15+
#' occurrenceStatus
16+
#' @section checkCategory:
17+
#' occurrence
18+
#' @importFrom magrittr %>%
19+
#' @export
20+
#' @keywords vocabulary,validation
21+
NULL

R/sysdata.rda

114 Bytes
Binary file not shown.

inst/extdata/data_check.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -2210,3 +2210,50 @@ DC_validation_dateidentified_notstandard:
22102210
output_standard_fail: not_compliant
22112211
output_standard_missing: internal_prerequisites_not_met
22122212
merge_targets: FALSE
2213+
DC_validation_occurrencestatus_notstandard:
2214+
name: validation_occurrencestatus_notstandard
2215+
meta:
2216+
information:
2217+
description: Check if occurrenceStatus is specified source authority service.
2218+
question: Is occurrenceStatus within given source authority list?
2219+
darwin_core_class: occurrence
2220+
data_quality_dimension: conformance
2221+
dimension: other
2222+
output: validation
2223+
severity:
2224+
warning: invalid
2225+
resolution:
2226+
record: single_record
2227+
term:
2228+
keywords: vocabulary,validation
2229+
guid: 7af25f1e-a4e2-4ff4-b161-d1f25a5c3e47
2230+
example:
2231+
pass: The value for occurrenceStatus is present and correct.
2232+
fail: The value for occurrenceStatus is missing or incorrect.
2233+
input_pass: occurrenceStatus=present
2234+
input_fail: occurrenceStatus=observed
2235+
output_pass: TRUE
2236+
output_fail: FALSE
2237+
pseudocode: |
2238+
occurrenceStatus %in% reference
2239+
source:
2240+
resource: https://github.com/tdwg/bdq/issues/116
2241+
reference: http://rs.tdwg.org/dwc/terms/index.htm#occurrenceStatus
2242+
creator:
2243+
creation:
2244+
maintainer: Povilas Gibas
2245+
modification: 2019-12-22
2246+
notes:
2247+
input:
2248+
target: occurrenceStatus
2249+
target2:
2250+
dependency:
2251+
dependency_type: internal
2252+
data_checks:
2253+
rpackages:
2254+
data:
2255+
output:
2256+
output_standard_pass: compliant
2257+
output_standard_fail: not_compliant
2258+
output_standard_missing: internal_prerequisites_not_met
2259+
merge_targets: FALSE

inst/extdata/data_test.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -495,3 +495,15 @@ validation_dateidentified_notstandard:
495495
- [Orange, irrelevent, fail]
496496
- ["", missing, fail]
497497
comment:
498+
validation_occurrencestatus_notstandard:
499+
data:
500+
- [occurrenceStatus, type, expected]
501+
- [present, correct, pass]
502+
- [absent, correct, pass]
503+
- [Present, correct, pass]
504+
- [ABSENT, correct, pass]
505+
- [' present ', correct, pass]
506+
- [Observed, incorrect, fail]
507+
- [-2000, irrelevent, fail]
508+
- ["", missing, fail]
509+
comment:

man/dc_validation_occurrencestatus_notstandard.Rd

+49
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)