Skip to content

Commit

Permalink
include dataseries in label
Browse files Browse the repository at this point in the history
  • Loading branch information
EhrmannS committed Jan 10, 2024
1 parent a97d81b commit f9f730b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ importFrom(dplyr,everything)
importFrom(dplyr,filter)
importFrom(dplyr,full_join)
importFrom(dplyr,group_by)
importFrom(dplyr,if_any)
importFrom(dplyr,if_else)
importFrom(dplyr,inner_join)
importFrom(dplyr,left_join)
Expand Down
7 changes: 2 additions & 5 deletions R/get_concept.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ get_concept <- function(..., external = FALSE, matches = FALSE, ontology = NULL)
if(matches){
externalConcepts <- ontology@concepts$external %>%
separate_wider_delim(cols = id, names = c("dataseries", "nr"), delim = "_", cols_remove = FALSE) %>%
# rowwise() %>%
# mutate(label = paste0(label, " [", dataseries, "]")) %>%
rowwise() %>%
mutate(label = paste0(label, "><", dataseries)) %>%
select(extID = id, extLabel = label)

toOut <- ontology@concepts$harmonised %>%
Expand All @@ -69,9 +69,6 @@ get_concept <- function(..., external = FALSE, matches = FALSE, ontology = NULL)
separate_rows(external, sep = " \\| ") %>%
separate_wider_delim(cols = external, names = "extID", delim = ".", too_many = "drop") %>%
left_join(externalConcepts, by = "extID") %>%
# group_by(across(all_of(c("id", "label", "class", "has_broader", "description", "match")))) %>%
# summarise(extLabel = paste0(na.omit(extLabel), collapse = " | ")) %>%
# ungroup() %>%
pivot_wider(id_cols = c("id", "label", "class", "has_broader", "description"), names_from = match,
values_from = extLabel, values_fn = ~paste0(na.omit(.x), collapse = " | ")) %>%
mutate(across(where(is.character), ~na_if(x = ., y = "")))
Expand Down

0 comments on commit f9f730b

Please sign in to comment.