Beispiel #1
0
def main(majorParser, files, faculty="Math", DropTable=False):
    dbc = DatabaseSender()
    if DropTable:
        dbc.execute("DELETE FROM {req} WHERE YEAR='{year}'".format(
            req=dbc.requirements_table, year=CALENDAR_YEAR))
        # dbc.create_requirements()

    for file in files:
        print("CURRENT FILE PARSING : " + file)
        parser = majorParser()
        parser.load_file(file)

        # print(parser)

        link = get_link(file)
        # Parser requirement is a list of MajorReq Object
        dbc.insert_requirements(parser.requirement, faculty, link,
                                CALENDAR_YEAR)
        dbc.commit()

    dbc.close()
Beispiel #2
0
from CommunicationParsing.MathCommunication import Communications
from Database.DatabaseSender import DatabaseSender

if __name__ == "__main__":
    com = Communications()
    com.load_file("MathReq.html")

    dbc = DatabaseSender()

    dbc.execute("DROP TABLE IF EXISTS " + dbc.communications_table + ";")
    dbc.create_communications()

    list1 = com.get_list1()
    list2 = com.get_list2()

    successes = 0
    failures = 0
    for code in list1:
        if dbc.insert_communication(code, 1):
            successes += 1
        else:
            failures += 1
        dbc.commit()

    for code in list2:
        if dbc.insert_communication(code, 2):
            successes += 1
        else:
            failures += 1
        dbc.commit()
Beispiel #3
0
from BreadthDepthParsing.Breadth import Breadth
from Database.DatabaseSender import DatabaseSender

if __name__ == "__main__":
    breadth = Breadth()
    file = "Breadth_and_depth.html"

    dbc = DatabaseSender()
    dbc.create_breadth()

    breadth.load_file(file)

    length = breadth.get_length()

    success = 0
    failure = 0
    for i in range(length):
        if dbc.insert_breadth(breadth.get_row(i)):
            success += 1
        else:
            failure += 1
        dbc.commit()

    print("Successes:", success)
    print("Failures: ", failure)

    dbc.close()
Beispiel #4
0
if __name__ == "__main__":
    course_codes = {'PACS', 'MATBUS', 'HLTH', 'ME', 'ARBUS', 'MSCI', 'ACTSC', 'CHE', 'CHEM', 'STAT',
                    'CS', 'CO', 'GENE', 'EMLS', 'FINE', 'AMATH', 'BIOL', 'PMATH', 'LS', 'AFM', 'ENGL', 'KIN',
                    'SE', 'SPCOM', 'PSYCH', 'SYDE', 'MATH', 'INTEG', 'MTE', 'ECON', 'ECE', 'PHYS',
                    'MUSIC', 'HRM', 'ASL', 'ANTH', 'AHS', 'APPLS', 'ARABIC', 'AE', 'ARCH', 'ARTS', 'AVIA',
                    'BME', 'BASE', 'BET', 'CDNST', 'CHINA', 'CMW', 'CIVE', 'CLAS', 'COGSCI', 'COMM', 'COOP',
                    'CROAT', 'CI', 'DAC', 'DUTCH', 'EARTH', 'EASIA', 'ENBUS', 'ERS', 'ENVE', 'ENVS', 'FR',
                    'GSJ', 'GEOG', 'GEOE', 'GER', 'GERON', 'GBDA', 'GRK', 'HIST', 'HRTS', 'HUMSC', 'INDG',
                    'INDEV', 'INTST', 'ITAL', 'ITALST', 'JAPAN', 'JS', 'KIN', 'KOREA', 'LAT', 'LS',
                    'MGMT', 'MNS', 'MTHEL', 'ME', 'MTE', 'MEDVL', 'MENN', 'MOHAWK', 'NE', 'OPTOM', 'PHARM',
                    'PHIL', 'PLAN', 'PSCI', 'PORT', 'PD', 'PDARCH', 'PDPHRM', 'REC', 'RS', 'RUSS', 'REES',
                    'SCI', 'SCBUS', 'SMF', 'SDS', 'SVENT', 'SOCWK', 'SWREN', 'STV', 'SOC', 'SPAN', 'SI',
                    'THPERF', 'UNIV', 'VCULT'}

    dbc = DatabaseSender()

    dbc.execute("DROP TABLE " + dbc.course_table + " CASCADE;")
    dbc.execute("DROP TABLE " + dbc.prereqs_table + ";")
    dbc.execute("DROP TABLE " + dbc.antireqs_table + ";")

    dbc.create_courses()
    dbc.create_prereqs()
    dbc.create_antireqs()

    for code in course_codes:
        parser = CourseParser()

        try:
            fp = urllib.request.urlopen("http://www.ucalendar.uwaterloo.ca/2021/COURSE/course-" + code + ".html")
            mybytes = fp.read()
Beispiel #5
0
    files.append("TableII.html")

    #Need to Investigate
    filesToIgnore = [
        "ENG-Software-Engineering.html",
        "MATH-Math-or-Fin-Analysis-Risk-Mgt-Degree-Reqmnt.html",
        "MATH-Mathematical-Optimization1.html",
        "MATH-Math-or-Chartered-Professional-Accountancy-co.html"
    ]
    filesToIgnore = ["/ProgramSpecs/" + f for f in filesToIgnore]

    #files = ["/ProgramSpecs/MATH-Combinatorics-and-Optimization-Minor2.html"] #use this for single files

    #TODO parse which specialization is under which major

    dbc = DatabaseSender()

    dbc.execute("DROP TABLE" + " IF EXISTS " + dbc.requirements_table + " ;")
    dbc.create_requirements()

    for file in files:
        if (file in filesToIgnore): continue
        print("CURRENT FILE PARSING : " + file)
        parser = MajorParser()
        parser.load_file(file)

        print(parser)

        # Parser requirement is a list of MajorReq Object
        dbc.insert_requirements(parser.requirement)
        dbc.commit()
Beispiel #6
0
if __name__ == "__main__":
    course_codes = {'PACS', 'MATBUS', 'HLTH', 'ME', 'ARBUS', 'MSCI', 'ACTSC', 'CHE', 'CHEM', 'STAT',
                    'CS', 'CO', 'GENE', 'EMLS', 'FINE', 'AMATH', 'BIOL', 'PMATH', 'LS', 'AFM', 'ENGL', 'KIN',
                    'SE', 'SPCOM', 'PSYCH', 'SYDE', 'MATH', 'INTEG', 'MTE', 'ECON', 'ECE', 'PHYS',
                    'MUSIC', 'HRM', 'ASL', 'ANTH', 'AHS', 'APPLS', 'ARABIC', 'AE', 'ARCH', 'ARTS', 'AVIA',
                    'BME', 'BASE', 'BET', 'CDNST', 'CHINA', 'CMW', 'CIVE', 'CLAS', 'COGSCI', 'COMM', 'COOP',
                    'CROAT', 'CI', 'DAC', 'DUTCH', 'EARTH', 'EASIA', 'ENBUS', 'ERS', 'ENVE', 'ENVS', 'FR',
                    'GSJ', 'GEOG', 'GEOE', 'GER', 'GERON', 'GBDA', 'GRK', 'HIST', 'HRTS', 'HUMSC', 'INDG',
                    'INDEV', 'INTST', 'ITAL', 'ITALST', 'JAPAN', 'JS', 'KIN', 'KOREA', 'LAT', 'LS',
                    'MGMT', 'MNS', 'MTHEL', 'ME', 'MTE', 'MEDVL', 'MENN', 'MOHAWK', 'NE', 'OPTOM', 'PHARM',
                    'PHIL', 'PLAN', 'PSCI', 'PORT', 'PD', 'PDARCH', 'PDPHRM', 'REC', 'RS', 'RUSS', 'REES',
                    'SCI', 'SCBUS', 'SMF', 'SDS', 'SVENT', 'SOCWK', 'SWREN', 'STV', 'SOC', 'SPAN', 'SI',
                    'THPERF', 'UNIV', 'VCULT'}

    dbc = DatabaseSender()

    dbc.execute("DROP TABLE IF EXISTS " + dbc.antireqs_table + ";")
    dbc.execute("DROP TABLE IF EXISTS " + dbc.prereqs_table + ";")
    dbc.execute("DROP TABLE IF EXISTS " + dbc.communications_table + ";")
    dbc.execute("DROP TABLE IF EXISTS " + dbc.breadth_table + ";")
    dbc.execute("DROP TABLE IF EXISTS " + dbc.course_table + ";")

    dbc.create_courses()
    dbc.create_prereqs()
    dbc.create_antireqs()

    for code in course_codes:
        parser = CourseParser()

        try:
Beispiel #7
0
def main(majorParser, files, faculty="Math", DropTable=False):
    dbc = DatabaseSender()
    if DropTable:
        dbc.execute("DROP TABLE IF EXISTS " + dbc.requirements_table + ";")
        dbc.create_requirements()

    for file in files:
        print("CURRENT FILE PARSING : " + file)
        parser = majorParser()
        parser.load_file(file)

        # print(parser)

        link = get_link(file)
        # Parser requirement is a list of MajorReq Object
        dbc.insert_requirements(parser.requirement, faculty, link)
        dbc.commit()

    dbc.close()