Skip to content

Commit

Permalink
Merge branch 'main' into automatic-update-2023-11-22T03-16-12Z
Browse files Browse the repository at this point in the history
  • Loading branch information
PietrH committed Nov 29, 2023
2 parents 613ae81 + d9fceec commit 403eb56
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dwc_mapping.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ input_data %<>%
mutate(organism_quantity = case_when(
waarneming_type == "Vastgesteld (in m²)" |
waarneming_type == "Vastgesteld (aantal)" |
waarneming_type == "Secundair nest vastgesteld" ~ waarneming_kwantiteit,
waarneming_type == "Secundair nest vastgesteld" |
waarneming_type == "Secundair nest" |
waarneming_type == "Embryonest vastgesteld" |
waarneming_type == "Nest vastgesteld" |
waarneming_type == "Primair nest" |
waarneming_type == "Primair nest vastgesteld" ~ waarneming_kwantiteit,
TRUE ~ ""
))
```
Expand Down
15 changes: 15 additions & 0 deletions tests/test_dwc_occurrence.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ testthat::test_that(
testthat::expect_true(all(!is.na(organismQuantityType_values)))
})

testthat::test_that(
"an organsimQuantityType must have a corresponding organsimQuantity",
{
# there should be no cases where there is an organismQuantityType and no
# organismQuantity
testthat::expect_identical(
nrow(dplyr::filter(
dwc_occurrence,
!is.na(organismQuantityType) & is.na(organismQuantity)
)),
0L
)
}
)

testthat::test_that(
"organismQuantityType is one of the predefined values if not NA", {
values <- c("individual(s)", "square meter(s)", "nest")
Expand Down

0 comments on commit 403eb56

Please sign in to comment.