-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
96 lines (77 loc) · 3.28 KB
/
config.py
File metadata and controls
96 lines (77 loc) · 3.28 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
"""
Configuration settings for the USA Swimming scraper
"""
import os
class Config:
"""Configuration constants and settings"""
# USA Swimming Data Hub URLs
BASE_URL = "https://prodswimsdatahub-ui.swimsmember.org/datahub/usas/timeseventrank"
INDIVIDUAL_SEARCH_URL = "https://prodswimsdatahub-ui.swimsmember.org/datahub/usas/individualsearch"
RELAY_SEARCH_URL = "https://prodswimsdatahub-ui.swimsmember.org/datahub/usas/timesrelayeventrank"
MEET_SEARCH_URL = "https://prodswimsdatahub-ui.swimsmember.org/datahub/usas/meetsearch"
# Request settings
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
DEFAULT_DELAY = 1.0 # seconds between requests
REQUEST_TIMEOUT = 30 # seconds
# Scraping limits
MAX_RESULTS_DEFAULT = 100
MAX_PAGES_DEFAULT = 10
# Available courses
COURSES = ['SCY', 'SCM', 'LCM']
# Available genders
GENDERS = ['Female', 'Male', 'Mixed']
# Common age groups
AGE_GROUPS = [
'Open', '10 & Under', '11-12', '13-14', '15-16', '17-18', '19 & Over',
'7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '18 & Under'
]
# Time standards
TIME_STANDARDS = [
'Olympic Trials', 'Olympic Trials Wave II', 'Olympic Trials Wave I',
'Summer Nationals', 'Winter US Open', 'Summer Juniors', 'Winter Juniors',
'Futures', 'AAAA', 'AAA', 'AA', 'A', 'BB', 'B', 'Slower Than B'
]
# Zones
ZONES = ['Central', 'Eastern', 'Southern', 'Western']
# Common swimming events
EVENTS_SCY = [
'50 FR SCY', '100 FR SCY', '200 FR SCY', '500 FR SCY', '1000 FR SCY', '1650 FR SCY',
'50 BK SCY', '100 BK SCY', '200 BK SCY',
'50 BR SCY', '100 BR SCY', '200 BR SCY',
'50 FL SCY', '100 FL SCY', '200 FL SCY',
'100 IM SCY', '200 IM SCY', '400 IM SCY'
]
EVENTS_SCM = [
'50 FR SCM', '100 FR SCM', '200 FR SCM', '400 FR SCM', '800 FR SCM', '1500 FR SCM',
'50 BK SCM', '100 BK SCM', '200 BK SCM',
'50 BR SCM', '100 BR SCM', '200 BR SCM',
'50 FL SCM', '100 FL SCM', '200 FL SCM',
'100 IM SCM', '200 IM SCM', '400 IM SCM'
]
EVENTS_LCM = [
'50 FR LCM', '100 FR LCM', '200 FR LCM', '400 FR LCM', '800 FR LCM', '1500 FR LCM',
'50 BK LCM', '100 BK LCM', '200 BK LCM',
'50 BR LCM', '100 BR LCM', '200 BR LCM',
'50 FL LCM', '100 FL LCM', '200 FL LCM',
'200 IM LCM', '400 IM LCM'
]
ALL_EVENTS = EVENTS_SCY + EVENTS_SCM + EVENTS_LCM
# Export settings
DEFAULT_EXPORT_DIR = "exports"
@classmethod
def get_available_years(cls):
"""Get available competition years"""
current_year = 2025
return [str(year) for year in range(1994, current_year + 1)]
@classmethod
def validate_course(cls, course: str) -> bool:
"""Validate if course is valid"""
return course in cls.COURSES
@classmethod
def validate_gender(cls, gender: str) -> bool:
"""Validate if gender is valid"""
return gender in cls.GENDERS
@classmethod
def validate_event(cls, event: str) -> bool:
"""Validate if event is valid"""
return event in cls.ALL_EVENTS