Skip to content

Commit

Permalink
Add dump to file to request_degreeworks
Browse files Browse the repository at this point in the history
  • Loading branch information
AaDalal committed Sep 29, 2023
1 parent af76e3d commit e78e424
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions backend/degree/scripts/request_degreeworks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from structs import DegreePlan
from tqdm import tqdm
import json
from pathlib import Path

with open("degreeworks_env.json") as f:
env = json.load(f)
Expand Down Expand Up @@ -2344,12 +2345,18 @@ def get_programs(timeout=30, year: int=2023) -> str:
return [program["key"] for program in res.json()[0]["goals"][1]["choices"]]


def write_dp(dp: DegreePlan, json: dict, dir: str | Path="degreeplans"):
with open(Path(
dir,
f"{dp.year}-{dp.program}-{dp.degree}-{dp.major}-{dp.concentration}"
)) as f:
json.dump(json, f, indent=4)

if __name__ == "__main__":
for year in range(2017, 2023 + 1):
print(year)
for program in get_programs(year=year):
print(program)
print("\t" + program)
for degree_plan in tqdm(degree_plans_of(program), year=year):
audit(degree_plan)


write_dp(degree_plan, audit(degree_plan))

0 comments on commit e78e424

Please sign in to comment.