forked from ArturoAmaya/ExploratoryCurricularAnalytics
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDebugOutput.jl
74 lines (67 loc) · 1.67 KB
/
DebugOutput.jl
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
"""
Output a JSON file with the specified curriculum to stdout.
julia DebugOutput.jl 2016 BI29
julia DebugOutput.jl 2016 BI29 SI
"""
module DebugOutput
include("Output.jl")
import CurricularAnalytics: pre, co
import JSON
import .Output: colleges, output, plans, termname
is_curriculum = length(ARGS) == 2
degree_plan = if is_curriculum
year, major = ARGS
degree_plans = output(parse(Int, year), major)
curriculum_college = first(
college
for college in ["TH", "WA", "SN", "MU", "FI", "RE", "SI", "EI"]
if college ∈ keys(degree_plans) && !(college == "SN" && year < 2020)
)
degree_plans[curriculum_college]
else
year, major, college = ARGS
output(Int(year), major)[college]
end
courses = Dict(
course.id => course
for term in degree_plan.terms
for course in term.courses
if !is_curriculum || course.prefix == "" || course.institution != "DEPARTMENT"
)
println(JSON.json(Dict(
"type" => if is_curriculum
"curriculum"
else
"degree_plan"
end,
"terms" => [
[
Dict(
"course_name" => course.name,
"subject" => course.prefix,
"number" => course.num,
"units" => course.credit_hours,
)
for course in term.courses
if !is_curriculum || course.prefix == "" || course.institution != "DEPARTMENT"
]
for term in degree_plan.terms
],
"prereqs" => [
Dict(
"requisite" => courses[prereq].name,
"satisfies" => course.name,
"type" => if type == pre
"prereq"
elseif type == co
"coreq"
else
"other"
end,
)
for (course_id, course) in courses
for (prereq, type) in course.requisites
if prereq ∈ keys(courses)
],
)))
end