-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathparticipant.py
55 lines (46 loc) · 1.64 KB
/
participant.py
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
import json
import pathlib
import uuid
from dataclasses import dataclass
from typing import Dict, List, Literal
@dataclass
class Participant:
id: uuid.UUID # Unique identifier
# Personal data
name: str
email: str
age: int
year_of_study: Literal["1st year", "2nd year", "3rd year", "4th year", "Masters", "PhD"]
shirt_size: Literal["S", "M", "L", "XL"]
university: str
dietary_restrictions: Literal["None", "Vegetarian", "Vegan", "Gluten-free", "Other"]
# Experience and programming skills
programming_skills: Dict[str, int]
experience_level: Literal["Beginner", "Intermediate", "Advanced"]
hackathons_done: int
# Interests, preferences and constraints
interests: List[str]
preferred_role: Literal[
"Analysis", "Visualization", "Development", "Design", "Don't know", "Don't care"
]
objective: str
interest_in_challenges: List[str]
preferred_languages: List[str]
friend_registration: List[uuid.UUID]
preferred_team_size: int
availability: Dict[str, bool]
# Description of the participant
introduction: str
technical_project: str
future_excitement: str
fun_fact: str
def load_participants(path: str) -> List[Participant]:
if not pathlib.Path(path).exists():
raise FileNotFoundError(
f"The file {path} does not exist, are you sure you're using the correct path?"
)
if not pathlib.Path(path).suffix == ".json":
raise ValueError(
f"The file {path} is not a JSON file, are you sure you're using the correct file?"
)
return [Participant(**participant) for participant in json.load(open(path))]