-
Notifications
You must be signed in to change notification settings - Fork 1
/
howto
102 lines (85 loc) · 3.59 KB
/
howto
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
library(tidyverse)
## BIYOMUH
current_term <- "2020-2021 BAHAR"
readxl::read_excel("PC_tablo_rev.xlsx") %>%
pivot_longer(-c(Kodu,Ders,`Ders Tipi`), names_to = "PC", values_to = "PCgroup") %>%
filter(!is.na(PCgroup)) %>%
separate_rows(PCgroup,sep=",") %>%
mutate(PCgroup=str_trim(PCgroup),
PCgroup=str_to_lower(PCgroup)) %>%
unite("PC2", c(PC,PCgroup), sep = "") %>%
mutate(term=current_term, .before = Kodu) %>%
rename(PC=PC2,DersTipi=`Ders Tipi`) %>%
write_tsv("biyomuh-pc-list.tsv")
readxl::read_xlsx("PC_tablo_rev.xlsx", sheet = 2) %>%
mutate(pc_no = str_replace(`Program Çıktıları`,"\\s","\t")) %>%
separate(pc_no, sep = "\t", into=c("pc_no","pc_def")) %>%
mutate(pc_no = str_trim(pc_no), pc_no = str_remove(pc_no, "\\.")) %>%
mutate(pc_def = str_trim(pc_def)) %>%
mutate(rank=row_number(),.before = pc_no) %>%
select(rank, pc_no, pc_def) %>%
write_tsv("pc_def.tsv")
# importing data to sqlite, use biyomuh-sabit.db
# CREATE TABLE IF NOT EXISTS "pc_def"("pc_rank" INT, "pc_no" TEXT, "pc_def" TEXT);
# .mode tabs
# .import "pc_def.tsv" pc_def --skip 1
#
# .import "biyomuh-pc-list.tsv" pc_matriks --skip 1
### KIMYAMUH
kmm_temel <- readxl::read_excel("KimyaMuhendisligi-PROGRAM CIKTILARI MATRİSİ.xlsx",1, skip = 2) %>%
filter(!is.na(...2)) %>%
pivot_longer(-(1:2), names_to = "PC", values_to = "VAR") %>%
mutate(PC=round(as.numeric(PC),1)) %>%
filter(!is.na(VAR)) %>%
select(-VAR) %>%
mutate(term="2020-2021 BAHAR", DersTipi="Temel") %>%
select(term,Kodu=...1, Ders=...2, DersTipi, PC) %>%
filter(!is.na(Kodu))
kmm_secmeli <- readxl::read_excel("KimyaMuhendisligi-PROGRAM CIKTILARI MATRİSİ.xlsx",2, skip=1) %>%
filter(!is.na(...2)) %>%
pivot_longer(-(1:2), names_to = "PC", values_to = "VAR") %>%
mutate(PC=round(as.numeric(PC),1)) %>%
filter(!is.na(VAR)) %>%
select(-VAR) %>%
mutate(term="2020-2021 BAHAR", DersTipi="Seçmeli") %>%
select(term,Kodu=...1, Ders=...2, DersTipi, PC)
bind_rows(kmm_temel, kmm_secmeli) %>% write_tsv("kimyamuh-pc-list.tsv")
read_tsv("kimyamuh-pc-list.tsv") %>%
count(PC) %>%
mutate(pc_rank=row_number(), pc_def="TBD") %>%
select(pc_rank, pc_no=PC,pc_def) %>%
write_tsv("kimyamuh_pc_def.tsv")
# sqlite3 kimyamuh-sabit.db
# sqlite> .mode tabs
# sqlite> .import "kimyamuh_pc_def.tsv" pc_def --skip 1
# sqlite> .import "kimyamuh-pc-list.tsv" pc_matriks --skip 1
## METALURJI
# get content from http://www.bologna.yildiz.edu.tr/index.php?r=program/view&id=38&aid=25
# then clean and save
xclip -o | sed -e 's/^ *//' -e 's/PÇ-//' -e 's/) /\t/' | awk -F"\t" 'BEGIN{printf"pc_rank\tpc_no\tpc_def\n"} {printf"%s\t%s\t%s\n",NR,$1,$2}' > metalurji-pc-def.tsv
# also got the matrix info from same page, carried over to excel, removed non MEM lectures and saved as metalurji-muh-pc-matriks.xlsx
readxl::read_excel("metalurji-muh-pc-matriks.xlsx") |>
pivot_longer(-(1:2), names_to = "PC", values_to = "VAR") |>
filter(VAR!="-") |>
select(-VAR) |>
mutate(term="2020-2021 BAHAR", DersTipi="Temel") |>
select(term, Kodu=`ders kodu`, Ders=`ders adı`, DersTipi, PC) |>
filter(!is.na(Kodu)) |>
write_tsv("metalurji-pc-list.tsv")
# import data
sqlite3 metalurji-sabit.db
CREATE TABLE IF NOT EXISTS "pc_def"("pc_rank" INT, "pc_no" TEXT, "pc_def" TEXT);
.import "metalurji-pc-def.tsv" pc_def --skip 1
.import "metalurji-pc-list.tsv" pc_matriks
## EMPTY databases cause error, so generate an empy "failsafe" table in each department
CREATE TABLE `failsafe` (
`department` TEXT,
`term` TEXT,
`file` TEXT,
`course` TEXT,
`method` TEXT,
`PC` TEXT,
`student_no` TEXT,
`score` REAL,
`Puan` REAL
);