Skip to content

Commit

Permalink
Merge pull request #26 from pranavanba/RMHDR-257-fix-other-device-typ…
Browse files Browse the repository at this point in the history
…e-filtering

RMHDR-257 Fix parsing and filtering of device type strings
  • Loading branch information
pranavanba authored Jun 3, 2024
2 parents 12e4b5b + 17a9948 commit 0efc5fe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/process-data/participant_devices.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ df_joined <-
summarise(type = toString(sort(unique(type)))) %>%
mutate(concept = "mhp:device") %>%
rename(value = type) %>%
mutate(value = ifelse({grepl(", Apple Watch|Apple Watch, ", value)}, "Apple Watch", value)) %>%
filter(value != "Other") %>%
mutate(value = case_when(
stringr::str_detect(value, stringr::regex("Apple Watch", ignore_case = TRUE)) ~ "Apple Watch",
stringr::str_detect(value, stringr::regex("Garmin", ignore_case = TRUE)) ~ "Garmin",
stringr::str_detect(value, stringr::regex("Polar", ignore_case = TRUE)) ~ "Polar",
stringr::str_detect(value, stringr::regex("HRM808S", ignore_case = TRUE)) ~ "HRM808S",
.default = value
)) %>%
filter(!stringr::str_detect(value, stringr::regex("Other", ignore_case = TRUE))) %>%
select(all_of(c("participantidentifier", "concept", "value"))) %>%
ungroup()

Expand Down

0 comments on commit 0efc5fe

Please sign in to comment.