Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User account page #654

Draft
wants to merge 58 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
ad4e625
Add check for signup major
DarknessUnder Oct 4, 2022
4119d5e
change major input box from a text field to a select;
dorian451 Oct 6, 2022
d5438f9
add majors table
dorian451 Oct 14, 2022
1d989e7
steal majors list from the course_suggestions branch
dorian451 Oct 14, 2022
0368c40
add ability to upload majors
dorian451 Oct 14, 2022
b27125b
fix /api/majors to actually use the fastapi correctly;
dorian451 Oct 18, 2022
dd74956
make it cleaner; only one api request
dorian451 Oct 18, 2022
0704a0c
remove deug logging from signup page
dorian451 Oct 25, 2022
20a50f1
add script to generate majors.json
dorian451 Oct 25, 2022
d0e72db
add example bash script for python script
dorian451 Oct 25, 2022
66d2c95
add api stuff for handling the new majors format
dorian451 Oct 25, 2022
2632f81
make api return majors all at once as json
dorian451 Nov 7, 2022
f814480
separate degree picker into its own component
dorian451 Nov 8, 2022
2072822
Add user account page to router and navbar;
dorian451 Nov 8, 2022
172c64b
refactor user page, make it less messy
dorian451 Nov 8, 2022
45fca2d
preliminary work in turning each input into a mini form for validatio…
dorian451 Nov 11, 2022
116169e
flesh out user page a bit more
dorian451 Nov 13, 2022
c895617
clean up the text styling a bit
dorian451 Nov 14, 2022
27c4e01
make information actually editable
dorian451 Nov 15, 2022
a881725
allow login component to disallow signing up
dorian451 Nov 15, 2022
a3c6914
make changes visible to user, add resest button
dorian451 Nov 18, 2022
014129f
make updating user require a password
dorian451 Nov 20, 2022
8c9d2c0
add ability to submit modifications to user
dorian451 Nov 21, 2022
8635676
make wrong password notifs autohide because they're annoying
dorian451 Nov 21, 2022
a5cc4f7
make degree picker modal statically rendered
dorian451 Nov 21, 2022
bc3204e
blank password on modal close
dorian451 Nov 21, 2022
790d26c
add ability to change password
dorian451 Nov 22, 2022
e46e24a
make new passwords meet the same requirements as the original one
dorian451 Nov 22, 2022
6774081
change how new passwords are rendered
dorian451 Nov 22, 2022
c1871d3
make submit button less girthy
dorian451 Dec 9, 2022
ff95f23
apparently I forgot to add the migration file a while ago
dorian451 Dec 9, 2022
633b209
inital support for mulitple majors
dorian451 Feb 10, 2023
af001cc
remove random '`' on the top of the file
dorian451 Feb 14, 2023
34215af
remove random '`' on the bottom of the file
dorian451 Feb 14, 2023
5702ccb
make the buttons less ugly
dorian451 Feb 14, 2023
2a8cef2
add a little space between the major selects
dorian451 Feb 17, 2023
830df04
[CodeFactor] Apply fixes to commit 2a8cef2
code-factor Feb 17, 2023
86756fe
accidentally committed too many things
dorian451 Feb 17, 2023
8a617cc
make checking whether a valid major option is selected more robust
dorian451 Feb 24, 2023
95bd426
set the amount of majors back to 1 when changing degree type
dorian451 Feb 24, 2023
70f06d4
fix major list formatting on the user account page
dorian451 Feb 24, 2023
2eae1b8
actually utilize reactively setting elements in array to improve perf…
dorian451 Feb 28, 2023
a0d9bb2
fix formatting and remove testing output in user page
dorian451 Feb 28, 2023
d33a2e9
add autofocus and ability to press escape to revert changes on fields…
dorian451 Feb 28, 2023
da33cc8
make the reset changes button close all current editing sessions in t…
dorian451 Feb 28, 2023
df5cffe
clarify function of reset button
dorian451 Feb 28, 2023
e53e0b4
optimizations on major selection
dorian451 Mar 24, 2023
6693afc
remove duplicate get_student_courses since it is causing problems
dorian451 Mar 28, 2023
cc3d553
Merge branch 'master' into userAccountPage
dorian451 Apr 7, 2023
2b71b65
user page - inital work on fetching course history
dorian451 Apr 7, 2023
465511b
Merge branch 'userAccountPage'
ethan2917 Sep 22, 2023
719adbd
Revert "Merge branch 'userAccountPage'"
ethan2917 Sep 26, 2023
3f04ef7
Revert "Revert "Merge branch 'userAccountPage'""
ethan2917 Sep 26, 2023
c97d23b
Fixed multiple head issue from fast-forwarding
ethan2917 Oct 3, 2023
e822e3b
Altered user page layout for better accessibility
ethan2917 Oct 11, 2023
1d5b29d
Added "Delete Account" button to page
ethan2917 Oct 20, 2023
7f00f3c
Merge 'master' into userAccountPage
ethan2917 Oct 24, 2023
42a0750
Linked delete button to backend delete api
ethan2917 Oct 27, 2023
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
647 changes: 647 additions & 0 deletions rpi_data/Degree_Tamplates/2022_major.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions rpi_data/get-current-majors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
DEST=majors-2022.json python3 modules/rpi-parse-majors.py
123 changes: 123 additions & 0 deletions rpi_data/majors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"Baccalaureate": [
"Accelerated Science, Technology, and Society (Law) B.S./J.D.",
"Aeronautical Engineering Curriculum",
"Applied Physics",
"Architecture",
"Biological Neuroscience",
"Biology",
"Biomedical Engineering",
"Biotechnology and Health Economics",
"Building Sciences B.S.",
"Business Analytics",
"Business and Management",
"Chemical Engineering",
"Chemistry - Chemical Biology Track",
"Chemistry - Industrial Chemistry Track",
"Chemistry B.S.",
"Civil Engineering",
"Cognitive Science",
"Communication, Media, and Design",
"Computer and Systems Engineering",
"Computer Science",
"Design, Innovation, and Society",
"Design, Innovation, and Society/Mechanical Engineering",
"Economics",
"Electrical Engineering",
"Electronic Arts",
"Engineering Core Curriculum",
"Engineering Science",
"Environmental Engineering",
"Environmental Science",
"Games and Simulation Arts and Sciences",
"Geology",
"Hydrogeology",
"Industrial and Management Engineering",
"Information Technology and Web Science",
"Materials Engineering",
"Mathematics",
"Mechanical Engineering Curriculum",
"Music",
"Nuclear Engineering Curriculum",
"Philosophy",
"Physician-Scientist",
"Physics",
"Program for Graduates of Naval Nuclear Power Training Command's Nuclear Power School",
"Psychological Science",
"Science, Technology, and Society",
"Sustainability Studies"
],
"Masters": [
"Accelerated Weekend MBA Program",
"Applied Mathematics M.S.",
"Architectural Sciences (Concentration in Architectural Acoustics) M.S.",
"Architectural Sciences (Concentration in Built Ecologies) M.S.",
"Architectural Sciences M.S (Concentration in Lighting)",
"Astronomy M.S.",
"Biochemistry and Biophysics, M.S.",
"Biology M.S.",
"Biomedical Engineering M.S./M.Eng.",
"Chemical Engineering M.Eng.",
"Chemical Engineering M.S.",
"Chemistry M.S.",
"Civil and Environmental Engineering M.Eng.",
"Civil and Environmental Engineering M.S.",
"Cognitive Science M.S.",
"Communication and Rhetoric M.S. ",
"Computer Science M.S.",
"Critical Game Design, M.S.",
"Earth and Environmental Sciences Five-Year B.S.-M.S. Program",
"Economics M.S.",
"Electrical, Computer and Systems Engineering M.S.",
"Environmental Science M.S.",
"Geology M.S.",
"Industrial and Management Engineering M.S./M.Eng.",
"Information Technology M.S.",
"Lighting M.S.",
"Master of Architecture - Professional Program",
"Master of Business Administration",
"Master of Engineering Program in Systems Engineering and Technology Management",
"Master of Science in Architecture Program",
"Master of Science in Business Analytics",
"Master of Science in Engineering Science (Hartford)",
"Master of Science in Management",
"Master of Science in Quantitative Finance and Risk Analytics",
"Master of Science in Supply Chain Management",
"Master of Science in Technology Commercialization and Entrepreneurship",
"Materials Engineering M.Eng.",
"Materials Engineering M.S.",
"Mathematics M.S.",
"Mechanical Engineering M.Eng. (Hartford)",
"Mechanical, Aerospace, and Nuclear Engineering M.Eng.",
"Mechanical, Aerospace, and Nuclear Engineering M.S.",
"Physics M.S.",
"Science and Technology Studies M.S.",
"Systems Engineering and Technology Management M.Eng. (Hartford)"
],
"Doctoral": [
"Architectural Sciences (Concentration in Architectural Acoustics) Ph.D.",
"Architectural Sciences (Concentration in Built Ecologies) Ph.D.",
"Architectural Sciences (Concentration in Lighting) Ph.D.",
"Biochemistry and Biophysics, Ph.D.",
"Biology Ph.D.",
"Biomedical Engineering, Ph.D.",
"Chemical Engineering Ph.D.",
"Chemistry Ph.D.",
"Civil and Environmental Engineering Ph.D.",
"Cognitive Science Ph.D.",
"Communication and Rhetoric Ph.D.",
"Computer Science Ph.D.",
"Critical Game Design, Ph.D.",
"Electrical, Computer and Systems Engineering B.S.-Ph.D. Program",
"Electrical, Computer and Systems Engineering, Ph.D.",
"Electronic Arts Ph.D.",
"Geology Ph.D. ",
"Management Ph.D.",
"Materials Engineering Ph.D.",
"Mathematics Ph.D.",
"Mechanical, Aerospace, and Nuclear Engineering, Ph.D.",
"Ph.D. Decision Sciences and Engineering Systems",
"Physics Ph.D.",
"Science and Technology Studies Ph.D."
]
}
23 changes: 20 additions & 3 deletions rpi_data/modules/fetch_catalog_course_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import unicodedata
import re
import regex #https://www.dataquest.io/blog/regex-cheatsheet/
import json
import json
from datetime import date
from time import time
from threading import Lock
Expand Down Expand Up @@ -106,6 +106,7 @@
def __init__(self, api_key):
self.search_endpoint = "http://rpi.apis.acalog.com/v2/search/courses"
self.course_detail_endpoint = "http://rpi.apis.acalog.com/v2/content?options[full]=1&method=getItems&type=courses"
self.program_detail_endpoint = "https://rpi.apis.acalog.com/v2/search/programs?method=search&options[limit]=0"
self.catalog_detail_endpoint = "http://rpi.apis.acalog.com/v2/content?key=3eef8a28f26fb2bcc514e6f1938929a1f9317628&format=xml&method=getCatalogs"
self.api_key = api_key
self.api_response_format = "xml"
Expand Down Expand Up @@ -156,7 +157,6 @@
self._catalog_root = match.group("root")
self._course_details_xml_strs.append(allow_for_extension_regex.sub("", course_details_xml_str))


def _course_xml_ids_to_url_params(self, all_ids_xml):
only_ids = SoupStrainer("id")
id_tags = BeautifulSoup(all_ids_xml, "xml", parse_only=only_ids).find_all("id")
Expand Down Expand Up @@ -270,6 +270,23 @@
tree = etree.parse(StringIO(courses_xml_str), parser)
tree.write("courses21.xml", pretty_print=True)
return self._get_all_courses(courses_xml_str)

def get_all_majors(self):
reqstr = self.program_detail_endpoint + f"&key={self.api_key}&catalog={self.catalog_id}&query=type:"
courses = {
"Baccalaureate":[],
"Masters":[],
"Doctoral":[]
}
for x in courses.keys():
res = req.get(reqstr + x)
tree = etree.parse(StringIO(res.content.decode().replace('encoding="utf-8"', '', 1)))

Check warning on line 283 in rpi_data/modules/fetch_catalog_course_info.py

View check run for this annotation

codefactor.io / CodeFactor

rpi_data/modules/fetch_catalog_course_info.py#L283

Using lxml.etree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace lxml.etree.parse with its defusedxml equivalent function. (B320)
root = tree.getroot()
for name in root.findall('./search/results/result/name'):
courses[x].append(name.text)

return courses


def main():
c = acalog_client(acalog_api_key)
Expand All @@ -278,4 +295,4 @@
dwrite_utf8_file(json.dumps(courses, indent=4), "courses21.json")

if __name__ == "__main__":
main()
main()
20 changes: 20 additions & 0 deletions rpi_data/modules/rpi-parse-majors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python
# coding: utf-8
# %%
import json
import pandas as pd
import os
from fetch_catalog_course_info import acalog_client as AcalogClient
from fetch_sis_course_info import sis_client as SisClient
from add_school_column import add_school_column

acalog_api_key = "3eef8a28f26fb2bcc514e6f1938929a1f9317628"

acalog_client = AcalogClient(acalog_api_key)

acalog_course_info_df = pd.DataFrame(acalog_client.get_all_courses())

destination = os.environ.get('DEST', 'out.json')

with open(destination.replace(".csv", ".json"), "w") as file:
json.dump(acalog_client.get_all_majors(), file)
13 changes: 6 additions & 7 deletions src/api/api_models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pydantic import BaseModel
from typing import Optional
from typing import List


class SessionPydantic(BaseModel):
Expand All @@ -19,16 +20,17 @@ class updateUser(BaseModel):
sessionID:str
email:str
phone:str
newPassword:str
major:str
password:str
newpassword:Optional[str] = None
major: List[str]
degree:str

class UserPydantic(BaseModel):
name: str
email: str
phone: str
password: str
major: str
major: List[str]
degree: str

class UserDeletePydantic(BaseModel):
Expand All @@ -44,7 +46,4 @@ class SubsemesterPydantic(BaseModel):
semester: Optional[str] = None

class DefaultSemesterSetPydantic(BaseModel):
default: str



default: str
Loading
Loading