Skip to content

Commit

Permalink
Merge pull request #44 from EMODnet/develop
Browse files Browse the repository at this point in the history
Check now distinguish between obilogical quantifications and other va…
  • Loading branch information
rubenpp7 authored Feb 5, 2024
2 parents d2b7735 + 6784616 commit d873df3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
24 changes: 20 additions & 4 deletions R/checkdataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -576,19 +576,35 @@ checkdataset = function(Event = NULL, Occurrence = NULL, eMoF = NULL, IPTreport
select (level,field, row ,message)



if ( sum(is.na(eMoF$occurrenceID)) != nrow(eMoF) ){
mof_oc_Value_err <- suppressWarnings(eMoF %>% mutate (level = 'error',
field = 'measurementValue',
row = row_number(),
message = 'Biological quantitification of 0 while occurrenceStatus is present') %>%
inner_join (fncols(Occurrence, c("occurrenceStatus")) %>% filter (is.na(occurrenceStatus) | occurrenceStatus == 'present' ) %>%
select (occurrenceID),
by = 'occurrenceID') %>%
mutate(measurementValue = as.numeric(measurementValue)) %>%
filter (measurementValue == 0 &
measurementTypeID %in% BODCquantity) %>%
select (level,field, row ,message))
} else {mof_oc_Value_err <-NULL }


if ( sum(is.na(eMoF$occurrenceID)) != nrow(eMoF) ){
mof_oc_Value0 <- suppressWarnings(eMoF %>% mutate (level = 'error',
mof_oc_Value_war <- suppressWarnings(eMoF %>% mutate (level = 'warning',
field = 'measurementValue',
row = row_number(),
message = 'Biological value of 0 while occurrenceStatus is present') %>%
inner_join (fncols(Occurrence, c("occurrenceStatus")) %>% filter (is.na(occurrenceStatus) | occurrenceStatus == 'present' ) %>%
select (occurrenceID),
by = 'occurrenceID') %>%
mutate(measurementValue = as.numeric(measurementValue)) %>%
filter ( measurementValue == 0 ) %>%
filter (measurementValue == 0 &
!measurementTypeID %in% BODCquantity ) %>%
select (level,field, row ,message))
} else {mof_oc_Value0 <-NULL }
} else {mof_oc_Value_war <-NULL }

mof_oc_dubs <- eMoF %>% filter (!is.na(occurrenceID), !is.na(measurementTypeID)) %>%
select (occurrenceID, measurementTypeID) %>%
Expand Down Expand Up @@ -685,7 +701,7 @@ checkdataset = function(Event = NULL, Occurrence = NULL, eMoF = NULL, IPTreport

# Preparing general_issues table: Overview of all issues

emoferror <- rbind(emoferror, mof_ValueNull, mof_oc_Value0, mof_oc_dubs,
emoferror <- rbind(emoferror, mof_ValueNull, mof_oc_Value_war, mof_oc_Value_err, mof_oc_dubs,
if(exists("mof_ev_dubs")) mof_ev_dubs,
if(exists("mof_noInstrument")) mof_noInstrument,
if(exists("mof_noSamplingdescriptor")) mof_noSamplingdescriptor
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ The tool is based on and builds on top of the <a href="https://github.com/iobis/
| Check if there are duplicated measurementTypeIDs linked to the same occurrenceID / Does the same measurement occurs more than once for the same occurrenceID? | Duplicate eMoF record linked to occurrence | IPTreport\$dtb\$general_issues | Ideally a given occurrenceID can be linked to the same measurementTypeID only once. E.g. It doesn't make sense to say that one same occurrenceID contains adults in one record but larvae in another record, it must be or either adults or larvae or both, but all expressed in only one record. |
| Is any BODC vocabulary term used as measurementUnitID deprecated? | This measurementUnitID is deprecated | IPTreport\$dtb\$mof_issues | It is not recommended using deprecated vocabulary terms, when possible, the updated version should be used. |
| Check if measurementValue is NULL | MeasurementValue of Null | IPTreport\$dtb\$general_issues | The measurementValue field must always be populated in every record of the eMoF table. The record would be incoherent if it misses the measurementValue. |
| Check if an occurrence related measurementValue is 0 while that occurrence has occurrenceStatus = "present" | Biological value of 0 while occurrenceStatus is present | IPTreport\$dtb\$general_issues | If an occurrence is labelled as present, as existing, most measurements related to it must be higher than 0. E.g. It doesn't make sense that an existing fish weights 0 grams or is 0 centimetres long. |
| Check if an occurrence related measurementValue is 0 while that occurrence has occurrenceStatus = "present" for biological quantifications | Biological quantification of 0 while occurrenceStatus is present | IPTreport\$dtb\$general_issues | If an occurrence is labelled as present, as existing, quantifications related to it must be higher than 0. E.g. It doesn't make sense that an existing fish weights 0 grams or is 0 centimetres long. |
| Check if an occurrence related measurementValue is 0 while that occurrence has occurrenceStatus = "present" | Biological value of 0 while occurrenceStatus is present | IPTreport\$dtb\$general_issues | If an occurrence is labelled as present, as existing, most measurements related to it must be higher than 0. E.g. This is a warning because it could be an unregistered quantification, but it could also be a qualitative parameter, in which case it would not be a problem. |
| Is any BODC vocabulary term used as measurementValueID deprecated? | This measurementValueID is deprecated | IPTreport\$dtb\$mof_issues | It is not recommended using deprecated vocabulary terms, when possible, the updated version should be used. |
| Checks if the content of the datasetName field differs from the Title of the IPT resource | datasetName is slightly different from the title of the IPT resource | IPTreport\$dtb\$general_issues | The title and the name of a dataset should be the same. Therefore, the title of the IPT resource should be the same than the datasetName. |
| Checks if datasetName contains more than one unique values | datasetName contains more than one unique values, excluding NA values | IPTreport\$dtb\$general_issues | One dataset should contain only one name and therefore only one datasetName |
Expand Down
2 changes: 1 addition & 1 deletion man/BODCbiometrics.Rd

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

0 comments on commit d873df3

Please sign in to comment.