Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
14f9d4b
Add RawPEClass for PE classes
psvenk Jan 22, 2026
1786fe9
add tabs for different class types
dtemkin1 Jan 22, 2026
9c66bf1
add pe parsing code
dtemkin1 Jan 23, 2026
381d7ba
add pe data to package
dtemkin1 Jan 23, 2026
c6e6afd
restore original
dtemkin1 Jan 23, 2026
c41a4f0
start slapping the two together
dtemkin1 Jan 23, 2026
cd1caab
fix type
dtemkin1 Jan 23, 2026
ad0125f
Standardize quarter naming convention
psvenk Jan 23, 2026
56051b2
also this
dtemkin1 Jan 23, 2026
693a423
put all of these together (will add PE ones rn)
dtemkin1 Jan 23, 2026
be6ef3d
Merge branch 'pe' of https://github.com/sipb/hydrant into pe
dtemkin1 Jan 23, 2026
db5b6a0
Actually add the file back
psvenk Jan 23, 2026
a05d18e
fix type
dtemkin1 Jan 23, 2026
8f9efb7
move export calendar
dtemkin1 Jan 23, 2026
64e5c72
move some things out of tab
dtemkin1 Jan 23, 2026
a091480
Move SelectedActivities out of Academic tab
psvenk Jan 23, 2026
fc50980
remove stack
dtemkin1 Jan 23, 2026
e45fb93
fix test
dtemkin1 Jan 23, 2026
5a8c7a3
change nonclass to custom activity
dtemkin1 Jan 23, 2026
0b85620
Default PE prereqs to "None"
psvenk Jan 23, 2026
259383b
Rename capacity to classSize
psvenk Jan 23, 2026
ef10b28
make pe class
dtemkin1 Jan 23, 2026
ca39ef5
Begin working on PE class table
psvenk Jan 23, 2026
1bd4469
Rename PEandWellness to PEClass
psvenk Jan 23, 2026
9608be6
fix constructor
dtemkin1 Jan 23, 2026
2dcdda4
Merge branch 'pe' of https://github.com/sipb/hydrant into pe
dtemkin1 Jan 23, 2026
f10f0d7
take off without unmount
dtemkin1 Jan 23, 2026
c71c5fe
grab pe classes
dtemkin1 Jan 23, 2026
532ad14
dont use tabs for older terms
dtemkin1 Jan 23, 2026
ad3f659
simplify
dtemkin1 Jan 23, 2026
7aee341
change pe data structure
dtemkin1 Jan 23, 2026
f19a731
fix tsc issue
dtemkin1 Jan 23, 2026
4722a45
VERY TEMPORARY
dtemkin1 Jan 23, 2026
957d28d
fix and format
dtemkin1 Jan 23, 2026
62ac223
make activity sections
dtemkin1 Jan 23, 2026
fa578b5
fix tests
dtemkin1 Jan 23, 2026
77e56d9
fix activity buttons here
dtemkin1 Jan 23, 2026
1d7d8a4
Get PEClassTable working with PE classes
psvenk Jan 23, 2026
fd412ce
fix type error
dtemkin1 Jan 23, 2026
04f1b7a
Show PE classes on schedule
psvenk Jan 23, 2026
db9f9dc
inflate deflate
dtemkin1 Jan 23, 2026
b64ffef
Merge branch 'pe' of https://github.com/sipb/hydrant into pe
dtemkin1 Jan 23, 2026
ac6937c
also in state
dtemkin1 Jan 23, 2026
849ed03
fix serialization
dtemkin1 Jan 23, 2026
41a67c4
move flags
dtemkin1 Jan 23, 2026
a02b240
format
dtemkin1 Jan 23, 2026
e0ebe14
Make sorting by fee work
psvenk Jan 23, 2026
6129bdf
Show descriptions for PE classes
psvenk Jan 23, 2026
7e65c3a
Add information from PE&W
psvenk Jan 23, 2026
1a0426a
Update banner text
psvenk Jan 23, 2026
5f3cf29
Format
psvenk Jan 23, 2026
cdb411a
fix banner last changes
dtemkin1 Jan 23, 2026
96ca83b
fix fast refresh
dtemkin1 Jan 23, 2026
ab6d180
put all raw type stuff together
dtemkin1 Jan 23, 2026
29fd58c
add daper to thanks
dtemkin1 Jan 23, 2026
dacccd0
add pe warning
dtemkin1 Jan 23, 2026
ee4bb92
Merge branch 'main' of https://github.com/sipb/hydrant into pe
dtemkin1 Jan 23, 2026
4af378f
Merge branch 'main' of https://github.com/sipb/hydrant into pe
dtemkin1 Jan 23, 2026
c2b5b5d
remove transition
dtemkin1 Jan 23, 2026
4d06210
get descriptions from pe website
dtemkin1 Jan 23, 2026
df41cd5
more wellness classes
dtemkin1 Jan 23, 2026
246dc5b
add icons for wellness and pirate
dtemkin1 Jan 23, 2026
961bd19
add scuba start and end time
dtemkin1 Jan 23, 2026
ccb304a
move banner message
dtemkin1 Jan 23, 2026
2766e24
make tabs smaller
dtemkin1 Jan 23, 2026
e8f3688
move section out
dtemkin1 Jan 23, 2026
bee34ea
Add building numbers for PE classes
psvenk Jan 24, 2026
5ba3123
abstract away sections
dtemkin1 Jan 24, 2026
1e7b3aa
Merge branch 'pe' of https://github.com/sipb/hydrant into pe
dtemkin1 Jan 24, 2026
91240a0
remove unused const
dtemkin1 Jan 24, 2026
5b5df18
move to component state
dtemkin1 Jan 24, 2026
a8b3631
this part is class specific
dtemkin1 Jan 24, 2026
8741979
move logic a bit
dtemkin1 Jan 24, 2026
262957a
Merge branch 'main' of https://github.com/sipb/hydrant into pe
dtemkin1 Jan 24, 2026
22bfa33
change type structure of activity
dtemkin1 Jan 25, 2026
38a3c21
fix type issue
dtemkin1 Jan 25, 2026
52bedf4
fix references to non-class
dtemkin1 Jan 25, 2026
0a8d299
Ensure that PEFlags emojis are separated by space
psvenk Jan 25, 2026
0fecac4
Adjust getPEFlagEmoji to mirror getFlagImg
psvenk Jan 25, 2026
4895fc8
Display PEFlags in description
psvenk Jan 25, 2026
c2637c6
Make swim GIR a flag (and assign an emoji)
psvenk Jan 25, 2026
f964d04
Add filter for swim GIR
psvenk Jan 25, 2026
0ef3a97
package.py: generalize load_toml_data
psvenk Jan 25, 2026
e5578e5
Create overrides system for PE classes
psvenk Jan 25, 2026
873c696
Replace manual cleaning process
psvenk Jan 25, 2026
1ba6fed
Fix lint + remove superfluous comment
psvenk Jan 25, 2026
1461926
Move wellness/pirate check to backend
psvenk Jan 25, 2026
49c4c1c
Shift pirate check to names rather than numbers
psvenk Jan 25, 2026
bbb5422
Stop pylint from complaining about TODO comments
psvenk Jan 25, 2026
a7639b9
Merge branch 'main' of https://github.com/sipb/hydrant into pe
dtemkin1 Jan 25, 2026
5a329e2
Add colors for fee
psvenk Jan 26, 2026
00b0c20
Make currently selected tab clearer
psvenk Jan 26, 2026
1f6c130
clean up pe table
dtemkin1 Jan 26, 2026
38566f6
Display section numbers for PE classes
psvenk Jan 26, 2026
b33de51
Show PE section numbers when choosing section too
psvenk Jan 26, 2026
c0453cf
dry stuff out
dtemkin1 Jan 26, 2026
561c2e4
faster if size is none
dtemkin1 Jan 26, 2026
2f3f632
Merge branch 'main' of https://github.com/sipb/hydrant into pe
dtemkin1 Jan 26, 2026
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ dist-ssr

# artifacts
scrapers/catalog.json
scrapers/fireroad-sem.json
scrapers/fireroad-presem.json
scrapers/fireroad-*.json
scrapers/cim.json
scrapers/pe-*.json
public/latest.json
public/i26.json

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ addopts = "--doctest-modules"
[tool.pylint.main]
max-line-length = 88
py-version = "3.8"
disable = "fixme"

[tool.hatch.build.targets.wheel]
packages = ["scrapers"]
3 changes: 3 additions & 0 deletions scrapers/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .cim import run as cim_run
from .fireroad import run as fireroad_run
from .package import run as package_run
from .pe import run as pe_run


def run():
Expand All @@ -25,6 +26,8 @@ def run():
catalog_run()
print("=== Update CI-M data ===")
cim_run()
print("=== Update PE data ===")
pe_run()
print("=== Packaging ===")
package_run()

Expand Down
71 changes: 45 additions & 26 deletions scrapers/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
from collections.abc import Iterable
from typing import Any

from .utils import get_term_info
from scrapers.pe import get_pe_quarters
from scrapers.utils import get_term_info

if sys.version_info >= (3, 11):
import tomllib
Expand All @@ -45,32 +46,34 @@ def load_json_data(json_path: str) -> Any:
return json.load(json_file)


def load_toml_data(overrides_dir: str, subpath=".") -> dict[str, Any]:
def load_toml_data(toml_path: str) -> dict[str, Any]:
"""
Loads data from the provided directory that consists exclusively of TOML files
Loads data from the provided TOML file, or directory that consists exclusively of
TOML files

Args:
overrides_dir (str): The directory to load from
subpath (str, optional): Load from a subdirectory. Defaults to ".".
toml_path (str): The file or directory to load from

Returns:
dict[str, Any]: The data contained within the directory
"""
overrides_path = os.path.join(package_dir, overrides_dir)
out: dict[str, Any] = {}

if not os.path.isdir(os.path.join(overrides_path, subpath)):
# directory doesn't exist, so we return an empty dict
toml_path = os.path.join(package_dir, toml_path)

if os.path.isfile(toml_path):
with open(toml_path, "rb") as toml_file:
return tomllib.load(toml_file)
elif os.path.isdir(toml_path):
# If the path is a directory, we load all TOML files in it
out = {}
with os.scandir(toml_path) as entries:
for entry in entries:
if entry.is_file() and entry.name.endswith(".toml"):
with open(entry.path, "rb") as toml_file:
out.update(tomllib.load(toml_file))
return out

# If the path is a directory, we load all TOML files in it
toml_dir = os.path.join(overrides_path, subpath)
for fname in os.listdir(toml_dir):
if fname.endswith(".toml"):
with open(os.path.join(toml_dir, fname), "rb") as toml_file:
out.update(tomllib.load(toml_file))

return out
else:
# Neither a file nor a directory exists as this path, so we return an empty dict
return {}


def merge_data(
Expand Down Expand Up @@ -118,6 +121,7 @@ def get_include(overrides: dict[str, dict[str, Any]]) -> set[str]:
return classes


# pylint: disable=too-many-locals
def run() -> None:
"""
The main entry point.
Expand All @@ -135,7 +139,7 @@ def run() -> None:

for sem in sem_types:
fireroad_sem = load_json_data(f"fireroad-{sem}.json")
overrides_sem = load_toml_data("overrides.toml.d", sem)
overrides_sem = load_toml_data(os.path.join("overrides.toml.d", sem))

# The key needs to be in BOTH fireroad and catalog to make it:
# If it's not in Fireroad, it's not offered in this semester (fall, etc.).
Expand All @@ -150,11 +154,17 @@ def run() -> None:
term_info = get_term_info(sem)
url_name = term_info["urlName"]

obj: dict[str, dict[str, Any] | str | dict[Any, dict[str, Any]]] = {
"termInfo": term_info,
"lastUpdated": now,
"classes": courses,
}
pe_data = {}
for quarter in get_pe_quarters(url_name):
pe_file = f"pe-q{quarter}.json"
pe_overrides_file = os.path.join("pe", f"pe-q{quarter}-overrides.toml")
if os.path.isfile(os.path.join(package_dir, pe_file)):
quarter_data = load_json_data(pe_file)
quarter_overrides = load_toml_data(pe_overrides_file)
pe_data[quarter] = merge_data(
datasets=[quarter_data, quarter_overrides],
keys_to_keep=set(quarter_data),
)

with open(
os.path.join(
Expand All @@ -163,7 +173,16 @@ def run() -> None:
mode="w",
encoding="utf-8",
) as file:
json.dump(obj, file, separators=(",", ":"))
json.dump(
{
"termInfo": term_info,
"lastUpdated": now,
"classes": courses,
"pe": pe_data,
},
file,
separators=(",", ":"),
)

print(f"{url_name}: got {len(courses)} courses")

Expand Down
Loading