Documentation talk:LTHub/Canvas/UploadGradestoFSC

From UBC Wiki

Contents

Thread titleRepliesLast modified
why isn't this automated?017:22, 19 December 2018

why isn't this automated?

Routine tasks like this should really be automated. These instructions should be embarrassing for anyone who can program and works on canvas for UBC. Below is a short R script I use to convert .csv files downloaded from Canvas to a .csv file that can be uploaded to FSC.

   df <- read.csv("EXPORTED_FROM_CANVAS.csv")
   df$percentgrade =
     ceiling(as.numeric(levels(df$Current.Score)[df$Current.Score]))
   df <- df[!is.na(df$ID) &  df$Student != "Test Student",]
   subj_course_section <- unique(levels(df$Section)[df$Section])
   stopifnot(length(subj_course_section)==1)
   scs = strsplit(subj_course_section, " ")1
   toFSC <- data.frame(Session=format(Sys.time(), "%YW"),
                       Campus="UBC",
                       Subject=scs[1],
                       Course=scs[2],
                       Section=scs[3],
                       Student.Number=df$Student.Number,
                       Percent.Grade=df$percentgrade,
                       Standing="",
                       Standing.Reason="")
   names(toFSC) <- gsub("\\."," ",names(toFSC))
   write.csv(toFSC,"toFSC.csv",row.names=FALSE,quote=FALSE,na="")
PaulSchrimpf1 (talk)17:22, 19 December 2018