reminders.R 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. # #email reminder app
  2. #
  3. # #1 survey analysis
  4. #
  5. # #read google doc
  6. #
  7. # library (googlesheets)
  8. # gs_auth()
  9. #
  10. # PIlist = gs_url ("https://docs.google.com/spreadsheets/d/1jVBj0RBZ4zFwtL1dcy-D9UA_QRvkGhX8s5_sWI8toEk/edit#gid=390395480")
  11. #
  12. # data= googlesheets::gs_read_csv(PIlist, skip =2)
  13. #
  14. # remind = data[data$`Data Survey`== "0",]
  15. #
  16. # text2= ""
  17. # for (i in c(1:15)) {
  18. # text =paste0("<a href='mailto:", remind$Email[i], "?subject=SFB1315-data&body=Dear Prof. ",remind$`Last name`[i],", '> ",i,remind$`Last name`[i]," </a>")
  19. # text2 = paste0 (text2, text, collapse = "<br>")
  20. # }
  21. #
  22. #
  23. #
  24. #
  25. # 2 image and orcid
  26. library (readr)
  27. library(dplyr)
  28. newlist<- read_csv("~/Documents/Seafile/SFB1315info/newlistfromgoogle.csv")
  29. peoplelist_respori <- read_delim("~/Documents/Seafile/SFB1315info/allpeople.csv",
  30. "\t", escape_double = FALSE, trim_ws = TRUE)
  31. peoplelist= right_join( peoplelist_respori, newlist, by=c("email"= "Email"))
  32. peoplelist_sub = peoplelist[!is.na(peoplelist$SFBgroup),]
  33. peoplelist_sub$project_responsible[is.na(peoplelist_sub$project_responsible)] <- "FALSE"
  34. groups = unique(peoplelist_sub$SFBgroup)
  35. ## this one is sent only to the responsible person
  36. text2 = ""
  37. peoplelist_resp <- subset(peoplelist_sub, peoplelist_sub$project_responsible == TRUE)
  38. for (group in groups){
  39. #group = "Z"
  40. footer = ""
  41. peoplelist_group <- peoplelist_resp[peoplelist_resp$SFBgroup == group,]
  42. if (nrow(peoplelist_group) == 0){
  43. #peoplelist_group <- peoplelist_sub[peoplelist_sub$SFBgroup == group,]
  44. peoplelist_group <- peoplelist_sub %>% filter(grepl (group, Project))
  45. footer= "PS: I would only need to send this email to one person, if you indicate a person of contact for the creation of the project page for your group."
  46. }
  47. emails = paste0(peoplelist_group$email, collapse = ",")
  48. text_mail = paste0("
  49. The website will soon go live, I extended the
  50. ", footer)
  51. text =paste0("<a href='mailto:", emails,
  52. "?subject=making SFB1315-output.de awesome&body=Dear members of project ",group,",", gsub('&NewLine;','%0D%0A',textutils::HTMLencode(text_mail))
  53. ," '> ",
  54. group," </a>")
  55. text2 = paste0 (text2, text, sep = "<br>")
  56. }
  57. # ## this one sent to everyone !
  58. # text2 = ""
  59. # peoplelist_resp <- peoplelist_sub
  60. # for (group in groups){
  61. # #group = "Z"
  62. # footer = "Best regards,"
  63. # peoplelist_group <- peoplelist_resp[peoplelist_resp$SFBgroup == group,]
  64. # if (nrow(peoplelist_group) == 0){
  65. # peoplelist_group <- peoplelist_sub[peoplelist_sub$SFBgroup == group,]
  66. # footer= "Best regards,"
  67. # }
  68. #
  69. # emails = paste0(peoplelist_group$email, collapse = ",")
  70. # text_mail = paste0("
  71. #
  72. # Please visit https://deploy-preview-3--adoring-tereshkova-f0b719.netlify.app/project/",group," .
  73. #
  74. # This page will present you and your project, including (after login) the SmartFigures related to your project. This new version of the website will go live on JUNE 1st, contact me if you are not happy with the project page or the personal page design.
  75. #
  76. # The new version of the smartfigure gallery went live this week. You are now able to create your own group (for example for your lab), and each figure can be shared with different groups.
  77. # I will be creating new accounts for PIs (I did it already for phds and postdocs last year) with access to the 'sfb1315 Members' sharing group. You will be able to sign in with this email address, the default password is 'resultgallery' (if you do not have access by tomorrow, drop me an email).
  78. #
  79. #
  80. # Walkthrough to add content for:
  81. # - your project smartfigure gallery: https://www.sfb1315-output.de/post/smartfigure-preview/
  82. # - your personal page: https://www.sfb1315-output.de/post/using-orcid/
  83. #
  84. # ", footer)
  85. #
  86. # text =paste0("<a href='mailto:", emails,
  87. # "?subject=DEADLINE, awesome SFB1315-output.de in June&body=Dear members of project ",group,",", gsub('&NewLine;','%0D%0A',textutils::HTMLencode(text_mail))
  88. # ," '> ",
  89. # group," </a>")
  90. #
  91. # text2 = paste0 (text2, text, sep = "<br>")
  92. #
  93. #
  94. # }
  95. text2 = ""
  96. peoplelist_resp <- subset(peoplelist_sub, peoplelist_sub$project_responsible == TRUE)
  97. for (group in groups){
  98. #group = "Z"
  99. footer = ""
  100. peoplelist_group <- data.frame()
  101. if (nrow(peoplelist_group) == 0){
  102. #peoplelist_group <- peoplelist_sub[peoplelist_sub$SFBgroup == group,]
  103. peoplelist_group <- peoplelist_sub %>% filter(grepl (group, Project))
  104. #footer= "PS: I would only need to send this email to one person, if you indicate a person of contact for the creation of the project page for your group."
  105. }
  106. emails = paste0(peoplelist_group$email, collapse = ",")
  107. text_mail = paste0("
  108. Please accept my apologies for having used an outdated personel list.
  109. I updated the website according to the latest spreadsheet curated by Marylu : https://deploy-preview-3--adoring-tereshkova-f0b719.netlify.app/project/",group," .
  110. The website lauch was reported to give you time to check it, maybe you want to sent me a figure for the project thumbnail.
  111. NB you can add content for:
  112. - your project smartfigure gallery: https://www.sfb1315-output.de/post/smartfigure-preview/
  113. - your personal page (including image): https://www.sfb1315-output.de/post/using-orcid/
  114. ", footer)
  115. text =paste0("<a href='mailto:", emails,
  116. "?subject=making SFB1315-output.de awesome&body=Dear members of project ",group,",", gsub('&NewLine;','%0D%0A',textutils::HTMLencode(text_mail))
  117. ," '> ",
  118. group," </a>")
  119. text2 = paste0 (text2, text, sep = "<br>")
  120. }
  121. fileConn<-file("remind.html")
  122. writeLines(c(text2), fileConn)
  123. close(fileConn)