-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
213 lines (171 loc) · 7.97 KB
/
models.py
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
# -----------------------------------------------------------------
class Authentication(db.Model):
__bind_key__ = "login"
__tablename__ = "authenticate"
login_id = db.Column(db.Integer, primary_key=True)
first_name = db.Column(db.String(25))
last_name = db.Column(db.String(25))
username = db.Column(db.String(25))
password = db.Column(db.String(25))
class SelectedCohort(db.Model):
__bind_key__ = "login"
__tablename__ = "cohort_selected"
record_id = db.Column(db.Integer, primary_key=True)
cohort_id = db.Column(db.Integer)
# -----------------------------------------------------------------
class Cohort(db.Model):
__bind_key__ = "gradebook"
__tablename__ = "cohort"
cohort_id = db.Column(db.Integer, primary_key=True)
cohort_name = db.Column(db.String(25))
location = db.Column(db.String(50))
start_date = db.Column(db.Date)
end_date = db.Column(db.Date)
#current_unit or units_complete # is this needed???
class Person(db.Model):
__bind_key__ = "gradebook"
__tablename__ = "person"
person_id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
role = db.Column(db.String(50)) # TA, SSM, Instructor, Student
class Email(db.Model):
__bind_key__ = "gradebook"
__tablename__ = "email"
email_id = db.Column(db.Integer, primary_key=True)
person_id = db.Column(db.Integer, db.ForeignKey("person.person_id"))
email = db.Column(db.String(50))
date_added = db.Column(db.Date)
class Github(db.Model): #merge github with person?
__bind_key__ = "gradebook"
__tablename__ = "github"
# github_id = Column(Integer, primary_key=True)
person_id = db.Column(db.Integer, db.ForeignKey('person.person_id'), primary_key=True) # foreign key
github_username = db.Column(db.String(50))
class Student(db.Model):
__bind_key__ = "gradebook"
__tablename__ = "student"
student_id = db.Column(db.Integer, primary_key=True)
person_id = db.Column(db.Integer, db.ForeignKey('person.person_id'), primary_key=True)
cohort_id = db.Column(db.Integer, db.ForeignKey('cohort.cohort_id'), primary_key=True)
# -----------------------------------------------------------------
class Unit(db.Model):
__bind_key__ = "gradebook"
__tablename__ = "unit"
unit_id = db.Column(db.Integer, primary_key=True)
cohort_id = db.Column(db.Integer, db.ForeignKey('cohort.cohort_id'), primary_key=True)
unit_number = db.Column(db.Integer)
unit_name = db.Column(db.String(50))
unit_start = db.Column(db.Date)
unit_due = db.Column(db.Date)
hw_submissions = db.Column(db.Integer)
students_enrolled = db.Column(db.Integer)
unit_required = db.Column(db.Boolean)
context_code = db.Column(db.String)
career_assignment_bool = db.Column(db.Boolean)
graded_assignments = db.Column(db.String)
# from session_details api
# do I connect this to the unit_id
class Session(db.Model):
__bind_key__ = "gradebook"
__tablename__ = 'session'
session_id = db.Column(db.Integer, primary_key=True)
cohort_id = db.Column(db.Integer, db.ForeignKey('cohort.cohort_id'), primary_key=True)
session_name = db.Column(db.String(25))
unit_id = db.Column(db.Integer)
session_number = db.Column(db.Integer)
session_chapter = db.Column(db.String(10))
session_start = db.Column(db.Date)
zoom_url = db.Column(db.String(50))
# ------------------------------------------------------------------------
# how to set this up so I can have a list of updated questions
class Survey(db.Model):
__bind_key__ = "gradebook"
__tablename__ = "survey"
question_id = db.Column(db.Integer, primary_key=True)
question_text = db.Column(db.String(200))
date_added = db.Column(db.Date)
class SurveySet(db.Model):
__bind_key__ = "gradebook"
__tablename__ = "surveyset"
feedback_id = db.Column(db.Integer, primary_key=True) # foreign key
question_id = db.Column(db.Integer, db.ForeignKey('survey.question_id'), primary_key=True) # foreign key
question_number = db.Column(db.Integer)
class Week(db.Model):
__bind_key__ = "gradebook"
__tablename__="week"
week_id = db.Column(db.Integer, primary_key=True)
cohort_id = db.Column(db.Integer, db.ForeignKey('cohort.cohort_id'), primary_key=True)
week_end_date = db.Column(db.Date)
current_unit = db.Column(db.Integer, db.ForeignKey('unit.unit_id'))
previous_session = db.Column(db.Integer, db.ForeignKey('session.session_id'))
# Maybe add student_name to this table
# why is this by email address and not student name or ID
class Feedback(db.Model):
__bind_key__ = "gradebook"
__tablename__ = 'feedback'
# Here we define columns for the table person
# Notice that each column is also a normal Python instance attribute.
feedback_id = db.Column(db.Integer, db.ForeignKey('surveyset.feedback_id'))
student_id = db.Column(db.Integer, db.ForeignKey('student.student_id'), primary_key=True) # foreign key
week = db.Column(db.Integer, db.ForeignKey('week.week_id'), primary_key=True) # is this the same as unit?
submission_date = db.Column(db.Date)
overall_satisfaction = db.Column(db.Integer)
pace = db.Column(db.Integer)
academic_support = db.Column(db.Integer)
outside_class_productivity = db.Column(db.Integer)
instructor_engagement = db.Column(db.Integer)
instructor_clarity = db.Column(db.Integer)
instructor_knowledge = db.Column(db.Integer)
homework_feedback = db.Column(db.Integer)
outside_class_time_spent = db.Column(db.Integer)
class_comments = db.Column(db.String(250))
instructional_support_comments = db.Column(db.String(250))
# from attendance api, no sessions, one table
# maybe make compound key from session and name
class Attendance(db.Model):
__bind_key__ = "gradebook"
__tablename__ = "attendance"
session_id = db.Column(db.Integer, db.ForeignKey('session.session_id'), primary_key=True)
student_id = db.Column(db.Integer, db.ForeignKey('student.student_id'), primary_key=True)
present = db.Column(db.Boolean)
pending = db.Column(db.Boolean)
# from grade api
# no sessions, one table
# unit_name could come from unit table and this be a foreign key
class Grade(db.Model):
__bind_key__ = "gradebook"
__tablename__ = 'grade'
# grade_id = Column(Integer, primary_key=True) # probably not needed
unit_id = db.Column(db.Integer, db.ForeignKey('unit.unit_id'), primary_key=True)
student_id = db.Column(db.Integer, db.ForeignKey('student.student_id'), primary_key=True)
hw_submitted = db.Column(db.Boolean)
hw_grade = db.Column(db.String(10))
# from session details api
# why is this by student ID an not name????
class Arrival(db.Model):
__bind_key__ = "gradebook"
__tablename__ = "arrival"
student_id = db.Column(db.Integer, db.ForeignKey('student.student_id'), primary_key=True)
session_id = db.Column(db.Integer, db.ForeignKey('session.session_id'), primary_key=True)
arrival_time = db.Column(db.Integer)
class Submissions(db.Model):
__bind_key__ = "gradebook"
__tablename__ = "submission"
unit_id = db.Column(db.Integer, db.ForeignKey('unit.unit_id'), primary_key=True)
student_id = db.Column(db.Integer, db.ForeignKey('student.student_id'), primary_key=True)
first_name = db.Column(db.String)
last_name = db.Column(db.String)
# email = Column(String)
submission_status = db.Column(db.Boolean)
submission_date = db.Column(db.Date)
submission_notes = db.Column(db.String)
grade = db.Column(db.String)
feedback = db.Column(db.String)
plagiarism = db.Column(db.Boolean)
class AttendanceStatus(db.Model):
__bind_key__ = "gradebook"
__tablename__ = 'attendance_status'
bin = db.Column(db.Integer, primary_key=True)
label = db.Column(db.String)