Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions uploader/testdata/uploader.go/case_basic/courses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"_id": "67d07ee0c972c18731e23bee",
"subject_prefix": "BA",
"course_number": "1320",
"title": "Business in a Global World",
"description": "BA 1320 - Business in a Global World (3 semester credit hours) This course provides a primer on the impacts of globalization on business.",
"enrollment_reqs": "BA 1320 Repeat Restriction",
"school": "Naveen Jindal School of Management",
"credit_hours": "3",
"class_level": "Undergraduate",
"activity_type": "Lecture",
"grading": "Graded - Undergraduate",
"internal_course_number": "015444",
"prerequisites": null,
"corequisites": null,
"co_or_pre_requisites": null,
"sections": ["67d07ee0c972c18731e23bef"],
"lecture_contact_hours": "3",
"laboratory_contact_hours": "0",
"offering_frequency": "S",
"catalog_year": "24",
"attributes": null
}
]
15 changes: 15 additions & 0 deletions uploader/testdata/uploader.go/case_basic/professors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"_id": "67d07ee0c972c18731e23bf0",
"first_name": "Peter",
"last_name": "Lewin",
"titles": ["Primary Instructor"],
"email": "[email protected]",
"phone_number": "",
"office": {"building": "", "room": "", "map_uri": ""},
"profile_uri": "",
"image_uri": "",
"office_hours": null,
"sections": ["67d07ee0c972c18731e23bef"]
}
]
32 changes: 32 additions & 0 deletions uploader/testdata/uploader.go/case_basic/sections.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"_id": "67d07ee0c972c18731e23bef",
"section_number": "501",
"course_reference": "67d07ee0c972c18731e23bee",
"section_corequisites": null,
"academic_session": {
"name": "25S",
"start_date": "2025-01-21T00:00:00-06:00",
"end_date": "2025-05-16T00:00:00-05:00"
},
"professors": ["67d07ee0c972c18731e23bf0"],
"teaching_assistants": [],
"internal_class_number": "27195",
"instruction_mode": "Face-to-Face",
"meetings": [
{
"start_date": "2025-01-21T00:00:00-06:00",
"end_date": "2025-05-09T00:00:00-05:00",
"meeting_days": ["Tuesday", "Thursday"],
"start_time": "5:30pm",
"end_time": "6:45pm",
"modality": "",
"location": {"building": "JSOM", "room": "12.218", "map_uri": "https://locator.utdallas.edu/SOM_12.218"}
}
],
"core_flags": ["080", "090"],
"syllabus_uri": "https://dox.utdallas.edu/syl153033",
"grade_distribution": [],
"attributes": null
}
]
25 changes: 25 additions & 0 deletions uploader/testdata/uploader.go/case_edge/courses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"_id": "67d07ee0c972c18731e23bf4",
"subject_prefix": "AERO",
"course_number": "3320",
"title": "- Recitation",
"description": "- ()",
"enrollment_reqs": "",
"school": "Undergraduate Studies",
"credit_hours": "Non-Enroll",
"class_level": "Undergraduate",
"activity_type": "Laboratory - No Lab Fee",
"grading": "Graded - Undergraduate",
"internal_course_number": "000243",
"prerequisites": null,
"corequisites": null,
"co_or_pre_requisites": null,
"sections": ["67d07ee0c972c18731e23bf5"],
"lecture_contact_hours": "",
"laboratory_contact_hours": "",
"offering_frequency": "",
"catalog_year": "24",
"attributes": null
}
]
1 change: 1 addition & 0 deletions uploader/testdata/uploader.go/case_edge/professors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions uploader/testdata/uploader.go/case_edge/sections.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
25 changes: 25 additions & 0 deletions uploader/testdata/uploader.go/case_multiple/courses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"_id": "67d07ee0c972c18731e23be9",
"subject_prefix": "ACCT",
"course_number": "2301",
"title": "Introductory Financial Accounting",
"description": "ACCT 2301 - Introductory Financial Accounting (3 semester credit hours) An introduction to financial reporting...",
"enrollment_reqs": "ACCT 2301 Repeat Restriction",
"school": "Naveen Jindal School of Management",
"credit_hours": "3",
"class_level": "Undergraduate",
"activity_type": "Lecture",
"grading": "Graded - Undergraduate",
"internal_course_number": "000061",
"prerequisites": null,
"corequisites": null,
"co_or_pre_requisites": null,
"sections": ["67d07ee0c972c18731e23bea", "67d07ee0c972c18731e23bed"],
"lecture_contact_hours": "3",
"laboratory_contact_hours": "0",
"offering_frequency": "S",
"catalog_year": "24",
"attributes": null
}
]
15 changes: 15 additions & 0 deletions uploader/testdata/uploader.go/case_multiple/professors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"_id": "67d07ee0c972c18731e23beb",
"first_name": "Naim Bugra",
"last_name": "Ozel",
"titles": ["Primary Instructor (50%)"],
"email": "[email protected]",
"phone_number": "",
"office": {"building": "", "room": "", "map_uri": ""},
"profile_uri": "",
"image_uri": "",
"office_hours": null,
"sections": ["67d07ee0c972c18731e23bea", "67d07ee0c972c18731e23bed"]
}
]
66 changes: 66 additions & 0 deletions uploader/testdata/uploader.go/case_multiple/sections.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[
{
"_id": "67d07ee0c972c18731e23bea",
"section_number": "003",
"course_reference": "67d07ee0c972c18731e23be9",
"section_corequisites": null,
"academic_session": {
"name": "25S",
"start_date": "2025-01-21T00:00:00-06:00",
"end_date": "2025-05-16T00:00:00-05:00"
},
"professors": ["67d07ee0c972c18731e23beb"],
"teaching_assistants": [
{"first_name": "Galymzhan", "last_name": "Tazhibayev", "role": "Teaching Assistant", "email": "[email protected]"}
],
"internal_class_number": "27706",
"instruction_mode": "Face-to-Face",
"meetings": [
{
"start_date": "2025-01-21T00:00:00-06:00",
"end_date": "2025-05-09T00:00:00-05:00",
"meeting_days": ["Tuesday", "Thursday"],
"start_time": "10:00am",
"end_time": "11:15am",
"modality": "",
"location": {"building": "JSOM", "room": "2.717", "map_uri": "https://locator.utdallas.edu/SOM_2.717"}
}
],
"core_flags": [],
"syllabus_uri": "https://dox.utdallas.edu/syl152555",
"grade_distribution": [],
"attributes": null
},
{
"_id": "67d07ee0c972c18731e23bed",
"section_number": "001",
"course_reference": "67d07ee0c972c18731e23be9",
"section_corequisites": null,
"academic_session": {
"name": "25S",
"start_date": "2025-01-21T00:00:00-06:00",
"end_date": "2025-05-16T00:00:00-05:00"
},
"professors": ["67d07ee0c972c18731e23beb"],
"teaching_assistants": [
{"first_name": "Galymzhan", "last_name": "Tazhibayev", "role": "Teaching Assistant", "email": "[email protected]"}
],
"internal_class_number": "26595",
"instruction_mode": "Face-to-Face",
"meetings": [
{
"start_date": "2025-01-21T00:00:00-06:00",
"end_date": "2025-05-09T00:00:00-05:00",
"meeting_days": ["Tuesday", "Thursday"],
"start_time": "8:30am",
"end_time": "9:45am",
"modality": "",
"location": {"building": "JSOM", "room": "2.717", "map_uri": "https://locator.utdallas.edu/SOM_2.717"}
}
],
"core_flags": [],
"syllabus_uri": "https://dox.utdallas.edu/syl152552",
"grade_distribution": [],
"attributes": null
}
]
13 changes: 13 additions & 0 deletions uploader/testdata/uploader.go/case_relationship/courses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"_id": "67d07ee0c972c18731e23be9",
"subject_prefix": "ACCT",
"course_number": "2301",
"title": "Introductory Financial Accounting",
"school": "Naveen Jindal School of Management",
"credit_hours": "3",
"class_level": "Undergraduate",
"activity_type": "Lecture",
"sections": ["67d07ee0c972c18731e23bea", "67d07ee0c972c18731e23bed"]
}
]
18 changes: 18 additions & 0 deletions uploader/testdata/uploader.go/case_relationship/professors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"_id": "67d07ee0c972c18731e23beb",
"first_name": "Naim Bugra",
"last_name": "Ozel",
"titles": ["Primary Instructor (50%)"],
"email": "[email protected]",
"sections": ["67d07ee0c972c18731e23bea", "67d07ee0c972c18731e23bed"]
},
{
"_id": "67d07ee0c972c18731e23bec",
"first_name": "Jieying",
"last_name": "Zhang",
"titles": ["Primary Instructor (50%)"],
"email": "[email protected]",
"sections": ["67d07ee0c972c18731e23bea", "67d07ee0c972c18731e23bed"]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
38 changes: 38 additions & 0 deletions uploader/testdata/uploader.go/case_sorting/courses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[
{
"_id": "67d07ee0c972c18731e23be9",
"subject_prefix": "ACCT",
"course_number": "2301",
"title": "Introductory Financial Accounting",
"school": "Naveen Jindal School of Management",
"credit_hours": "3",
"class_level": "Undergraduate",
"activity_type": "Lecture",
"catalog_year": "24",
"sections": []
},
{
"_id": "67d07ee0c972c18731e23bee",
"subject_prefix": "BA",
"course_number": "1320",
"title": "Business in a Global World",
"school": "Naveen Jindal School of Management",
"credit_hours": "3",
"class_level": "Undergraduate",
"activity_type": "Lecture",
"catalog_year": "23",
"sections": []
},
{
"_id": "67d07ee0c972c18731e23bf1",
"subject_prefix": "BIOL",
"course_number": "6111",
"title": "Graduate Research Presentation",
"school": "School of Natural Sciences and Mathematics",
"credit_hours": "1",
"class_level": "Graduate",
"activity_type": "Lecture",
"catalog_year": "24",
"sections": []
}
]
1 change: 1 addition & 0 deletions uploader/testdata/uploader.go/case_sorting/professors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions uploader/testdata/uploader.go/case_sorting/sections.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
7 changes: 6 additions & 1 deletion uploader/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ import (

var filesToUpload [3]string = [3]string{"courses.json", "professors.json", "sections.json"}

// Wrapped for testability - can be replaced with mock in unit tests
var connectDBFunc = func() *mongo.Client {
return connectDB()
}

// Upload sends parsed JSON files to MongoDB and refreshes static aggregations.
func Upload(inDir string, replace bool, staticOnly bool) {
//Connect to mongo
client := connectDB()
client := connectDBFunc()

// Get 5 minute context
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
Expand Down
Loading