Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
clarion: print warning if there are multiple unique_ids; only use fir…
…st unique_id
  • Loading branch information
HendrikSchultheis committed Mar 21, 2019
1 parent 0bf0b7f commit b1f9438
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/clarion.R
Expand Up @@ -56,7 +56,7 @@ Clarion <- R6::R6Class("Clarion",
# return unique_id
# if no type return first feature
if (is.element("type", names(self$metadata))) {
return(self$metadata[type == "unique_id"][["key"]])
return(self$metadata[type == "unique_id"][["key"]][1])
} else {
return(self$metadata[level == "feature"][["key"]][1])
}
Expand Down Expand Up @@ -201,6 +201,10 @@ Clarion <- R6::R6Class("Clarion",
if (!is.element("unique_id", self$metadata[["type"]])) {
stop("Metadata: No unique_id defined in type! Please define a unique_id.")
}
# case: multiple unique_ids
if (sum(is.element(self$metadata[["type"]], "unique_id")) > 1) {
warning("Metadata: Found multiple unique_ids! Only first will be used.")
}
# case: type = array but no delimiter
if (is.element("array", self$metadata[["type"]]) && !is.element("delimiter", names(self$header))) {
stop("Found type=array but no delimiter! Columns with multi-value fields require delimiter (in header) and type=array (in metadata).")
Expand Down

0 comments on commit b1f9438

Please sign in to comment.