Skip to content

Commit

Permalink
Legacy code
Browse files Browse the repository at this point in the history
  • Loading branch information
akhil-ganesan committed Dec 9, 2023
1 parent bd29994 commit 9f91985
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 0 deletions.
Binary file added __pycache__/scheduler.cpython-311.pyc
Binary file not shown.
29 changes: 29 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from flask import Flask, render_template, request, jsonify
import scheduler

app = Flask(__name__)

# Initial checklist items as an array
checklist_items = scheduler.prereq_chain.keys()

@app.route('/')
def index():
return render_template('index.html', checklist_items=checklist_items)

@app.route('/process_data', methods=['POST'])
def process_data():
selected_items = request.json['selected_items']

# Call your Python program with selected_items and get the result
result = process_items(selected_items)

return jsonify(result=result)

def process_items(selected_items):
# Your Python program logic here
# Example: concatenate selected items into a comma-separated string
result = ', '.join(scheduler.courseVisualizer(selected_items))
return result

if __name__ == '__main__':
app.run(debug=True)
43 changes: 43 additions & 0 deletions scheduler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
prereq_chain = {"MATH 1552": ["MATH 1551"],
"CS 1371": [],
"PHYS 2211": ["MATH 1552"],
"PHYS 2212": ["PHYS 2211"],
"MATH 1551": [],
"MATH 1553": ["MATH 1551"],
"BMED 1000": [],
"BMED 2110": ["CHEM 1211K", "MATH 1552", "BMED 1000"],
"COE 2001": ["MATH 1552", "PHYS 2211"],
"MATH 2551": ["MATH 1552", "MATH 1553"],
"MATH 2552": ["MATH 1552", "MATH 1553"],
"CHEM 1211K": [],
"BMED 2250": ["BMED 2110"],
"BMED 2310": ["BMED 2110", "BMED 2250", "PHYS 2211"],
"BMED 3100": ["CHEM 1315"],
"BMED 3110": ["BMED 3100", "BMED 2400", "BMED 3410", "CS 1371"],
"BMED 3310": ["BMED 2110", "MATH 2551", "MATH 2552", "CS 1371", "PHYS 2211"],
"BMED 3410": ["COE 2001", "MATH 2551"],
"BMED 3520": ["BMED 3100", "BMED 2110", "MATH 2552", "CS 1371"],
"BMED 3600": ["BMED 3100"],
"BMED 3610": ["BMED 2310", "BMED 2400", "BMED 3600"],
"BMED 4000": ["BMED 1000", "BMED 2310"],
"BMED 4602": ["BMED 2310", "BMED 3110"],
"CHEM 1315": ["CHEM 1211K"],
"BMED 2400": ["MATH 1552", "CS 1371"],
"MSE 2001": ["CHEM 1211K"],
"ECE 3710": ["PHYS 2212"],
"ECE 3741": ["ECE 3710"]
}

def courseVisualizer(coursework):
takeable = []
for course in prereq_chain.keys():
if course not in coursework:
prereqs = prereq_chain.get(course)
canTake = True
for req in prereqs:
if req not in coursework:
canTake = False
if (canTake):
takeable.append(course)

return takeable
82 changes: 82 additions & 0 deletions static/css/stylesheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/* styles.css */

body {
font-family: 'Arial', sans-serif;
background-color: #333; /* Dark theme background color */
color: #fff; /* Dark theme text color */
transition: background-color 0.3s, color 0.3s;
padding: 50px; /* Add padding to the body */
}

h1, h2 {
color: inherit; /* Inherit text color from the body */
text-align: center;
}

button {
text-align: center;
}

form {
margin-bottom: 20px;
}

label {
display: inline-block;
margin-bottom: 5px;
}

#checklistForm {
column-count: 3; /* Adjust the number of columns as needed */
align-items: center;
}

#checklistForm input[type="checkbox"] {
margin-bottom: 10px;
}

#result {
margin-top: 20px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
background-color: #444; /* Dark theme result background color */
color: #fff; /* Dark theme result text color */
text-align: center;
}

/* Light theme styles (overrides dark theme styles when body has .light-theme class) */
body.light-theme {
background-color: #fff;
color: #333;
}

body.light-theme h1, body.light-theme h2 {
color: inherit;
}

body.light-theme #result {
background-color: #fff;
color: #333;
}

/* Responsive adjustments for smaller screens */
@media screen and (max-width: 768px) {
#checklistForm {
column-count: 1; /* Change to a single column for smaller screens */
}
}

/* Responsive adjustments for medium screens */
@media screen and (min-width: 769px) and (max-width: 1024px) {
#checklistForm {
column-count: 2; /* Change to two columns for medium-sized screens */
}
}

/* Responsive adjustments for larger screens */
@media screen and (min-width: 1025px) {
#checklistForm {
column-count: 3; /* Change to three columns for larger screens */
}
}
73 changes: 73 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Web App</title>

<link rel="stylesheet" href="{{ url_for('static', filename='css/stylesheet.css') }}">

</head>
<body>
<h1>Georgia Tech Biomedical Engineering Degree Visualizer</h1>

<div style="text-align:center;">
<button onclick="toggleLightTheme()">Toggle Theme</button>
</div>

<p>To use this application, check the courses you have credit for below. Then,
the app will display which courses you can take based on prerequisites. Note this
only includes courses in the core BME curriculum (and their STEM course pre-requisites),
not general institute requirements such as humanities and social science classes.
</p>

<h2>Past Coursework</h2>
<form id="checklistForm">
{% for item in checklist_items %}
<input type="checkbox" id="{{ item }}" name="items[]" value="{{ item }}">
<label for="{{ item }}"> {{ item }}</label><br>
{% endfor %}
</form>

<h2>Courses You Can Take</h2>
<div id="result"></div>

<script>
document.getElementById('checklistForm').addEventListener('change', function() {
updateResult();
});

// Call updateResult on page load
window.addEventListener('load', function() {
updateResult();
// toggleLightTheme();
});

function updateResult() {
var selectedItems = Array.from(document.querySelectorAll('input[name="items[]"]:checked'))
.map(function (checkbox) {
return checkbox.value;
});

fetch('/process_data', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ selected_items: selectedItems }),
})
.then(response => response.json())
.then(data => {
document.getElementById('result').innerText = data.result;
});
}

// JavaScript to toggle themes
function toggleLightTheme() {
document.body.classList.toggle('light-theme');
}

</script>

</body>
</html>

0 comments on commit 9f91985

Please sign in to comment.