-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail_users_helper.R
58 lines (44 loc) · 2 KB
/
email_users_helper.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# COHHIO_HMIS
# Copyright (C) 2019 Coalition on Homelessness and Housing in Ohio (COHHIO)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details at
# <https://www.gnu.org/licenses/>.
# optionally, edit the issue vector to include the flag number and/or whatever
# the issue is so that when you export the data, you know what these providers
# have in common.
# then replace the Provider IDs of the providers_in_question vector to get a list of
# all users (default and not) who have access to those providers.
library(tidyverse)
library(readxl)
issue <- "did i email you about movein dates and exit dates?"
# What group of providers has the issue -----------------------------------
providers_in_question <- c(
2260
)
# Grabbing all users associated with these Provider IDs -------------------
# can't join in EDAGroupID because the IDs out of ART are wrong
users <- read_xlsx("data/RMisc2.xlsx",
sheet = 15,
range = cell_cols("B:E"))
Project <- read_xlsx("data/RMisc2.xlsx",
sheet = 3)
providers <- read_xlsx("data/RMisc2.xlsx",
sheet = 16,
range = cell_cols("B:D")) %>%
filter(ProjectID %in% providers_in_question) %>%
left_join(Project[c("ProjectID", "ProjectName")], by = "ProjectID")
associated_users <- providers %>%
left_join(users, by = c("EDAGroup" = "EDAGroupName")) %>%
mutate(Issue = issue) %>%
select(ProjectID, ProjectName, UserName, UserEmail, Issue) %>%
filter(!is.na(UserName)) %>%
unique()
write_csv(associated_users, "email_the_users.csv")