Documentation
¶
Overview ¶
Package parser converts scraped course and scheduling inputs into structured Nebula API schema documents.
Index ¶
- Variables
- func ANDMatcher(group string, subgroups []string) interface{}
- func ChoiceMatcher(group string, subgroups []string) interface{}
- func ConsentMatcher(group string, subgroups []string) interface{}
- func CoreCompletionMatcher(group string, subgroups []string) interface{}
- func CoreMatcher(group string, subgroups []string) interface{}
- func CourseMatcher(group string, subgroups []string) interface{}
- func CourseMinGradeMatcher(group string, subgroups []string) interface{}
- func GPAMatcher(group string, subgroups []string) interface{}
- func GroupTagMatcher(group string, subgroups []string) interface{}
- func LimitMatcher(group string, subgroups []string) interface{}
- func MajorMatcher(group string, subgroups []string) interface{}
- func MajorMinorMatcher(group string, subgroups []string) interface{}
- func MinorMatcher(group string, subgroups []string) interface{}
- func ORMatcher(group string, subgroups []string) interface{}
- func OtherMatcher(group string, subgroups []string) interface{}
- func Parse(inDir string, outDir string, csvPath string, skipValidation bool)
- func ParseAcademicCalendars(inDir string, outDir string)
- func ParseAstra(inDir string, outDir string)
- func ParseCometCalendar(inDir string, outDir string)
- func ParseMapLocations(inDir string, outDir string)
- func ParseMazevo(inDir string, outDir string)
- func SubstitutionMatcher(parseFnc func(string, []string) interface{}) func(string, []string) interface{}
- func ThrowawayMatcher(group string, subgroups []string) interface{}
- type InputData
- type Matcher
- type SourceData
Constants ¶
This section is empty.
Variables ¶
var ( // Sections maps section IDs to the associated section records. Sections = make(map[primitive.ObjectID]*schema.Section) // Courses maps catalog identifiers to course definitions. Courses = make(map[string]*schema.Course) // Professors maps professor names to professor documents. Professors = make(map[string]*schema.Professor) // CourseIDMap maps course IDs to their catalog keys. CourseIDMap = make(map[primitive.ObjectID]string) // ProfessorIDMap maps professor IDs to their lookup keys. ProfessorIDMap = make(map[primitive.ObjectID]string) // ReqParsers maps course IDs to requisite parser functions. ReqParsers = make(map[primitive.ObjectID]func()) // GradeMap stores grade distributions keyed by semester and section identifier. GradeMap map[string]map[string][]int )
var ANDRegex = regexp.MustCompile(`(?i)\s+and\s+`)
var BUILDINGS_CATEGORY_IDS = []int{42138, 42141}
BUILDINGS_CATEGORY_IDS lists category identifiers for academic, administrative, and housing buildings on Concept3D.
var DefaultBuildings = map[string]string{
"Activity Center": "AB",
"Activity Center Bookstore": "ACB",
"Administration": "AD",
"Edith and Peter O’Donnell Jr. Athenaeum": "APC",
"Edith O'Donnell Arts and Technology Building": "ATC",
"Lloyd V. Berkner Hall": "BE",
"Bioengineering and Sciences Building": "BSB",
"Classroom Building": "CB",
"Callier Center Richardson": "CR",
"Callier Center Addition": "CRA",
"Davidson-Gundy Alumni Center": "DGA",
"Dining Hall West": "DHW",
"Engineering and Computer Science North": "ECSN",
"Engineering and Computer Science South": "ECSS",
"Engineering and Computer Science West": "ECSW",
"Energy Plant": "EP",
"Founders Annex": "FA",
"Facilities Management": "FM",
"Founders North": "FN",
"Founders Building": "FO",
"Cecil H. Green Hall": "GR",
"Karl Hoblitzelle Hall": "HH",
"Erik Jonsson Academic Center": "JO",
"Naveen Jindal School of Management": "JSOM",
"Eugene McDermott Library": "MC",
"Modular Lab 1": "ML1",
"Modular Lab 2": "ML2",
"North Office Building": "NB",
"North Lab": "NL",
"Police": "PD",
"Physics Annex": "PHA",
"Physics Building": "PHY",
"Natural Science and Engineering Research Lab": "RL",
"Research and Operations Center": "ROC",
"Research and Operations Center West": "ROW",
"Service Building": "SB",
"Sciences Building": "SCI",
"Safety and Grounds": "SG",
"Student Learning Center": "SLC",
"Student Services Building Addition": "SSA",
"Student Services Building": "SSB",
"Student Union": "SU",
"Student Union Food Court": "SUFC",
"Synergy Park North": "SPN",
"Synergy Park North 2": "SP2",
"University Theatre": "TH",
"Visitor Center": "VC",
"Waterview Science and Technology Center": "WSTC",
"Andromeda Hall & University Housing Office": "RHA",
"Capella Hall": "RHC",
"Helix Hall": "RHH",
"Sirius Hall": "RHS",
"Vega Hall": "RHV",
"Recreation Center West": "RCW",
"SP/N Gallery": "SP2",
}
Some events have only the building name, not the abbreviation Maps building names to their abbreviations
var DefaultValid []string = []string{
"AB",
"ACB",
"AD",
"APC",
"ATC",
"BE",
"BSB",
"CB",
"CR",
"CRA",
"DGA",
"DHW",
"ECSN",
"ECSS",
"ECSW",
"EP",
"FA",
"FM",
"FN",
"FO",
"GR",
"HH",
"JO",
"JSOM",
"MC",
"ML1",
"ML2",
"NB",
"NL",
"PD",
"PHA",
"PHY",
"RL",
"ROC",
"ROW",
"SB",
"SCI",
"SG",
"SLC",
"SSA",
"SSB",
"SU",
"SUFC",
"SPN",
"SP2",
"TH",
"VC",
"WSTC",
"RHA",
"RHC",
"RHH",
"RHS",
"RHV",
"RCW",
}
Valid building abreviations for checking
var Matchers []Matcher
Matchers contains the ordered collection of matcher rules applied during requisite parsing. NOTE: PARENTHESES ARE OF HIGHEST PRECEDENCE! (This is due to groupParens() handling grouping of parenthesized text before parsing begins)
var ORRegex = regexp.MustCompile(`(?i)\s+or\s+`)
Functions ¶
func ANDMatcher ¶
ANDMatcher parses conjunction-separated requisites into an AND collection requirement.
func ChoiceMatcher ¶
ChoiceMatcher converts a subgroup collection into a mutually exclusive choice requirement.
func ConsentMatcher ¶
ConsentMatcher captures grantor consent requirements from requisite text.
func CoreCompletionMatcher ¶
CoreCompletionMatcher indicates completion of a specific core category without an hour requirement.
func CoreMatcher ¶
CoreMatcher creates a requirement for completion of a specific core course count.
func CourseMatcher ¶
CourseMatcher returns a course requirement with the default minimum grade expectation.
func CourseMinGradeMatcher ¶
CourseMinGradeMatcher returns a course requirement enforcing a minimum grade when an ICN is found.
func GPAMatcher ¶
GPAMatcher represents GPA-based prerequisites.
func GroupTagMatcher ¶
GroupTagMatcher resolves stack-referenced groups by index.
func LimitMatcher ¶
LimitMatcher produces a limit requirement that caps allowable credit hours.
func MajorMatcher ¶
MajorMatcher produces a major-specific requirement.
func MajorMinorMatcher ¶
MajorMinorMatcher builds an OR collection spanning both major and minor requirements.
func MinorMatcher ¶
MinorMatcher produces a minor-specific requirement.
func ORMatcher ¶
ORMatcher parses disjunction-separated requisites into an OR collection requirement.
func OtherMatcher ¶
OtherMatcher wraps unmatched text in an OtherRequirement.
func Parse ¶
Parse loads scraped course artifacts, applies parsing and validation, and persists structured results.
func ParseAcademicCalendars ¶
func ParseAstra ¶
ParseAstra reads Astra scrape output and produces structured multi-building event JSON files.
func ParseCometCalendar ¶
func ParseMapLocations ¶
ParseMapLocations filters Concept3D location exports to building records and writes normalized JSON output.
func ParseMazevo ¶
ParseMazevo reads Mazevo scrape output and emits normalized multi-building event JSON.
func SubstitutionMatcher ¶
func SubstitutionMatcher(parseFnc func(string, []string) interface{}) func(string, []string) interface{}
SubstitutionMatcher returns a matcher that replaces a subgroup with parseFnc's result before parsing the outer group. For example, "(OPRE 3360 or STAT 3360 or STAT 4351), and JSOM majors and minors only" becomes "... and @N".
func ThrowawayMatcher ¶
ThrowawayMatcher marks text that should be ignored during requisite evaluation.
Types ¶
type InputData ¶
type InputData struct {
Fields string `json:"fields"`
Data [][]interface{} `json:"data"`
}
InputData describes the raw Astra export payload containing fields metadata and row values.
type SourceData ¶
type SourceData struct {
Bookings []map[string]interface{} `json:"bookings"`
}
SourceData represents the Mazevo API response containing booking records.