Queens-Hacks/qcumber-data — pull request #1 by uniphil (2013-11-26 06:49:07+00:00)
Title: Proposed database structure

Intro
======
This is an initial rough port from the current method of storing things. I don't claim to be an expert on database structure so feel free to change it around. This is meant to be the starting point so eventually we can come up with a structure that works and work can be started on the actual scraping.

Structure
======
```
All:
last_update: datetime
overriden: bool #true if manually changed

PastExam(key=url):
year: string
url: string

# Relations
course: Course

Textbook(key=isbn_10,isbn_13):
title: string
url: string
authors: string
required: bool
isbn_10: string(10)
isbn_13: string(13)

new_price: int
new_available: int
used_price: int
used_available: int

Subject(key=abbreviation):
title: string(255)
abbreviation: string(4)

# Relations
courses: [Course]

Course(key=subject, number):
title: string(255)
description: string
number: string
career: Career
grading: Grading
units: float
components: [{type(string: required(bool)}] #{"Lecture": "Required", "Laboratory": "Optional"}

enrollment_reqs: string
add_consent: bool #string? ("Department Consent Required")
drop_consent: bool #string? ("Department Consent Required")

# Add in CEAB stuff?

# Relations
subject: Subject
sections: [Section]
textbooks: [Textbook]
prev_exams: [PastExam]

# Parsed enrollment_reqs. See https://github.com/ChrisCooper/QcumberD/pull/90
# req = {items: [Course|req], type: "and/or"}
prereq: [req]
coreq: [req]
recommend: [req]
exclusions: [req]

Section(key=course, year, season, index):
solus_id: string #001-LAB (>>>8867<<<)
index: string #>>>001<<>>LAB<<< (8867)
session: string
open: bool

# Term
year: string
season: Season

# Detailed info - optional (deep scrape)
class_curr: int
class_max: int
wait_curr: int
wait_max: int

# Relations
course: Course
components: [SectionComponent]

SectionComponents(key=section, day, start_time, end_time):
start_date: date
end_date: date
day: DayOfWeek
start_time: time
end_time: time

# Relations
section: Section
instructors: [Instructor]

Instructor(key=name):
name: string

# Relations:
section_components: [SectionComponent]

#Constants:
#See: https://github.com/ChrisCooper/QcumberD/blob/master/course_catalog/fixtures/initial_data.json

Season(key=name):
name: string #"Fall", "Winter"

DayOfWeek(key=abbreviation):
name: string #"Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday"
abbreviation: string #"Mo/Tu/We/Th/Fr/Su/Sa"
order: int #0/1/2/3/4/5/6

SectionType(key=abbreviation):
abbreviation: string # "STD", "CLN", "COR"..
name: string # "..."

Career(key=name):
name: string # "Graduate", "Undergraduate", ...

Grading(key=name):
name: string # "Graded", "Pass/Fail", "Non-Graded Component", ...
```