forked from gist-helper/meals_data-parsing_hyoinjeong
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meal.py
132 lines (111 loc) · 4.94 KB
/
meal.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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
class Meal:
bldgType: int
langType: int
dateType: int
kindType: int
bldg: str
date: str
kind: str
menu: str
special: str
def __init__(self, bldgType, langType, dateType, kindType,
bldg, date, kind, menu, special) -> None:
self.bldgType = bldgType
self.langType = langType
self.dateType = dateType
self.kindType = kindType
self.bldg = bldg
self.date = date
self.kind = kind
self.menu = menu
self.special = special
class MealWrapper:
meal: Meal
def __init__(self) -> None:
self.meal = Meal()
# constant
KOR = 0
ENG = 1
BLDG1_1ST = 0
BLDG1_2ND = 1
BLDG2_1ST = 2
BREAKFAST = 0
LUNCH = 1
DINNER = 2
SPECIAL = 3
DATE_LEN = 10
DATE_1st = ["Mon", "Tue", "Wed", "Thr", "Fri"] # 1학 요일
DATE_2nd = ["Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sun"] # 2학 요일
# kind of meal
MEAL_KIND_KOR = ["조식", # 0
"중식", # 1
"석식"] # 2
MEAL_KIND_ENG = ["Breakfast", # 0
"Lunch", # 1
"Dinner"] # 2
# kind of building according to building type
BLDG_KIND_KOR = ["1학생회관 1층", # 0
"1학생회관 2층", # 1
"2학생회관 1층"] # 2
BLDG_KIND_ENG = ["Student Union Bldg.1 1st floor", # 0
"Student Union Bldg.1 2nd floor", # 1
"Student Union Bldg.2 1st floor"] # 2
# excel column according to building type
# EXCEL_COL_BLDG0 = ["A", "B", "Mon", "Mon", "Tue", "Tue", "Wed", "Wed", "Thr", "Thr", "Fri", "Fri"] # Bldg.1 1st
# EXCEL_COL_BLDG1 = ["A", "Mon", "Tue", "Wed", "Thr", "Fri"] # Bldg.1 2nd
# EXCEL_COL_BLDG2 = ["A", "B", "C", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sun"] # Bldg.2 1st
'''
column 예외 존재 (2023.2.6의 1학1층한글 엑셀보면 쓸모없는 col이 있을 수 있음)
이를 위해 요일 있는 행의 index로 접근
'''
EXCEL_COL_BLDG0 = [2, 7]
EXCEL_COL_BLDG0_EXCEPT = []
EXCEL_COL_BLDG1 = [1, 6]
EXCEL_COL_BLDG2 = [3, 10]
DATE_INDEX_BLDG0 = 5 # Bldg.1 1st
DATE_INDEX_BLDG1 = 1 # Bldg.1 2nd
DATE_INDEX_BLDG2 = 5 # Bldg.2 1st
# INDEX_ENDPOINTS_BLDG0 = [[5, 15], [15, 22], [23, 30], [22, 23]] # Bldg.1 1st
# 2023.03.27 식단부터 조식에 '즉석라면코너' 신설됨 -> constant로 관리. 따로 파싱 row 안만듦.
# INDEX_ENDPOINTS_BLDG0 = [[6, 16], [17, 25], [26, 33], [25, 26]] # Bldg.1 1st
# 2023.12.24 dinner 메뉴 하나 줄음
INDEX_ENDPOINTS_BLDG0 = [[6, 16], [17, 25], [26, 32], [25, 26]] # Bldg.1 1st
# 2023.05.06 조식 '즉석라면코너' 삭제됨
# INDEX_ENDPOINTS_BLDG0 = [[5, 15], [15, 22], [23, 30], [22, 23]] # Bldg.1 1st
INDEX_ENDPOINTS_BLDG1 = [[0, 0], [2, 12], [0, 0], [0, 0]] # Bldg.1 2nd
INDEX_ENDPOINTS_BLDG1_EXCEPT = [4, 6] # 1학2층 엑셀은 숨겨진 행(5,7번) 존재하고 dummy 들어가있어 제외해야함.
# INDEX_ENDPOINTS_BLDG2 = [[2, 12], [12, 20], [22, 29], [20, 22]] # Bldg.2 1st
# 2023.03.06 식단부터 조식 메뉴 1개 줄었음.
# INDEX_ENDPOINTS_BLDG2 = [[2, 11], [11, 18], [20, 27], [18, 20]] # Bldg.2 1st
# 2023.03.13 식단부터 조식은 되돌아오고, 중식 메뉴 1개 줄었음.
# INDEX_ENDPOINTS_BLDG2 = [[2, 12], [12, 19], [21, 28], [19, 21]] # Bldg.2 1st
# 2023.03.20 식단의 메뉴 바뀜.
# INDEX_ENDPOINTS_BLDG2 = [[2, 11], [11, 18], [20, 27], [18, 20]] # Bldg.2 1st
# 2023.11.25 2학 영양사님 바뀌셔서 양식 바뀜
INDEX_ENDPOINTS_BLDG2 = [[6, 15], [17, 24], [24, 31], [15, 17]] # Bldg.2 1st
# allergy type according to allergy code
ALGY_1_ING_KOR = ["난류", "우유", "메밀", "대두", "땅콩", "밀",
"새우", "돼지고기", "닭고기", "쇠고기", "오징어",
"고등어", "조개류", "토마토", "아황산염"]
ALGY_1_ING_ENG = ["egg", ",milk", "buckwheat", "soybean", "peanut", "wheat",
"shrimp", "pork", "chicken", "beef", "squid",
"mackerel", "shellfish", "tomato", "sulgite"]
ALGY_2_ING_KOR = ["계란류", "우유", "메밀", "땅콩", "대두",
"밀", "고등어", "게", "새우", "돼지고기",
"복숭아", "토마토", "아황산류", "호두", "닭고기",
"쇠고기", "오징어", "조개류", "잣"]
ALGY_2_ING_ENG = ["egg", "milk", "buckwheat", "peanut", "soybean",
"wheat", "mackerel", "crab", "shrimp", "pork",
"peach", "tomato", "sulgite", "walnut", "chicken",
"beef", "squid", "shellfish", "pine nut"]
# [langType]
ALGY_ING_1 = [ALGY_1_ING_KOR, ALGY_1_ING_ENG]
ALGY_ING_2 = [ALGY_2_ING_KOR, ALGY_2_ING_ENG]
# [langType][kindType]
MEAL_KIND = [MEAL_KIND_KOR, MEAL_KIND_ENG]
# [langType][bldgType]
BLDG_KIND = [BLDG_KIND_KOR, BLDG_KIND_ENG]
# [bldgType]
EXCEL_COL_BLDG = [EXCEL_COL_BLDG0, EXCEL_COL_BLDG1, EXCEL_COL_BLDG2]
DATE_INDEX = [DATE_INDEX_BLDG0, DATE_INDEX_BLDG1, DATE_INDEX_BLDG2]
INDEX_ENDPOINTS = [INDEX_ENDPOINTS_BLDG0, INDEX_ENDPOINTS_BLDG1, INDEX_ENDPOINTS_BLDG2]