-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
70 lines (55 loc) · 1.84 KB
/
app.py
File metadata and controls
70 lines (55 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from flask import Flask, render_template, jsonify
import json
import os
app = Flask(__name__)
# Function to load JSON data
def load_data():
json_path = os.path.join(app.root_path, "static", "data.json")
with open(json_path) as f:
return json.load(f)
@app.route("/")
@app.route("/homepage")
def homepage():
return render_template("homepage.html")
@app.route("/about")
def about():
return render_template("about.html")
@app.route("/qualifications")
def coursework():
return render_template("qualifications.html")
@app.route("/projects")
def projects():
return render_template("projects.html")
@app.route("/health_metrics")
def health_metrics():
return render_template("health_metrics.html")
@app.route("/montecarlo")
def montecarlo():
return render_template("montecarlo.html")
@app.route("/sleepanalysis")
def sleepanalysis():
return render_template("sleepanalysis.html")
@app.route("/group_project")
def groupproject():
return render_template("group_project.html")
@app.route("/get_data")
def get_data():
data = load_data()
# Create a mapping: Courses -> Skills
course_to_skills = {course: skills for course, skills in data["courses"].items()}
# Create a mapping: Education Methods -> Skills (indirect via courses)
education_to_skills = {}
for method, courses in data["education_methods"].items():
related_skills = set()
for course in courses:
if course in course_to_skills:
related_skills.update(course_to_skills[course])
education_to_skills[method] = list(related_skills)
# Return structured data including all mappings
return jsonify({
"education_methods": data["education_methods"],
"courses": data["courses"],
"education_to_skills": education_to_skills
})
if __name__ == "__main__":
app.run(debug=True)