-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
114 lines (75 loc) · 2.54 KB
/
Copy pathmain.py
File metadata and controls
114 lines (75 loc) · 2.54 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
import os
import csv
from tkinter import filedialog, messagebox
from tkinter import *
from algo import run_matching
class Project:
title: str
track: str
# skills = list of str
skills: list
# list of Student objects
students: list
class Student:
name: str
uin: int
# preferences = {rank : project_title}
preferences: dict
# compatibility = {project_title : score}
compatibility: dict
track = str
# skills = list of str
skills: list
# research_interest = list of str
research_interest: list
relevant: bool
addition_details: str
# list of all projects
projects = []
# list of students
students = []
def readProjectCsv():
messagebox.showinfo("Select Project CSV File", "Select Project CSV File")
csv_path = filedialog.askopenfilename(
initialdir="/", title="Select Project CSV File", filetypes=(("csv files", "*.csv"), ("all files", "*.*")))
with open(csv_path) as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
next(readCSV)
for row in readCSV:
proj = Project()
proj.title = row[1]
proj.track = row[2]
proj.skills = row[3].split(', ')
for skill in row[4].split(', '):
proj.skills.append(skill)
proj.skills.remove('')
proj.students = []
projects.append(proj)
def readStudentCsv():
# gui to select file
messagebox.showinfo("Select Student CSV File", "Select Student CSV File")
csv_path = filedialog.askopenfilename(
initialdir="/", title="Select Student CSV File", filetypes=(("csv files", "*.csv"), ("all files", "*.*")))
# print
with open(csv_path) as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
next(readCSV)
for row in readCSV:
person = Student()
person.name = row[1]
person.uin = row[2]
person.preferences = {1: row[3], 2: row[4], 3: row[5]}
person.track = row[6]
person.skills = row[7].split(', ')
person.research_interest = row[8].split(', ')
person.relevant = (row[9] == 'Yes' and row[10] != "")
if (person.relevant):
person.addition_details = row[10]
person.compatibility = {}
for proj in projects:
person.compatibility.update({proj.title: 0.0})
students.append(person)
if __name__ == '__main__':
readProjectCsv()
readStudentCsv()
run_matching(students, projects)