initial commit
This commit is contained in:
48
.gitignore
vendored
Normal file
48
.gitignore
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# Miscellaneous
|
||||||
|
*.class
|
||||||
|
*.log
|
||||||
|
*.pyc
|
||||||
|
*.swp
|
||||||
|
.DS_Store
|
||||||
|
.atom/
|
||||||
|
.buildlog/
|
||||||
|
.history
|
||||||
|
.svn/
|
||||||
|
migrate_working_dir/
|
||||||
|
|
||||||
|
# IntelliJ related
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# The .vscode folder contains launch configuration and tasks you configure in
|
||||||
|
# VS Code which you may wish to be included in version control, so this line
|
||||||
|
# is commented out by default.
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# Flutter/Dart/Pub related
|
||||||
|
**/doc/api/
|
||||||
|
**/ios/Flutter/.last_build_id
|
||||||
|
.dart_tool/
|
||||||
|
.flutter-plugins
|
||||||
|
.flutter-plugins-dependencies
|
||||||
|
.packages
|
||||||
|
.pub-cache/
|
||||||
|
.pub/
|
||||||
|
/build/
|
||||||
|
pubspec.lock
|
||||||
|
|
||||||
|
# Symbolication related
|
||||||
|
app.*.symbols
|
||||||
|
|
||||||
|
# Obfuscation related
|
||||||
|
app.*.map.json
|
||||||
|
|
||||||
|
# Android Studio will place build artifacts here
|
||||||
|
/android/app/debug
|
||||||
|
/android/app/profile
|
||||||
|
/android/app/release
|
||||||
|
|
||||||
|
# KDE Specific Files
|
||||||
|
.directory
|
||||||
42
menu.csv
Normal file
42
menu.csv
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
Unnamed: 0,Unnamed: 1,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY,SUNDAY
|
||||||
|
,,2023-08-28 00:00:00,2023-08-29 00:00:00,2023-08-30 00:00:00,2023-08-31 00:00:00,2023-09-01 00:00:00,2023-09-02 00:00:00,2023-09-03 00:00:00
|
||||||
|
,,2023-09-04 00:00:00,2023-09-05 00:00:00,2023-09-06 00:00:00,2023-09-07 00:00:00,2023-09-08 00:00:00,2023-09-09 00:00:00,2023-09-10 00:00:00
|
||||||
|
BREAKFAST,,,,,,,,
|
||||||
|
BREAKFAST,BREAKFAST 1,Onion tomato uttapam,Aloo Onion Paratha,idli,Vermicilli Upma,Pesarattu,Podi Masala dosa,aloo gobi paratha
|
||||||
|
,BREAKFAST 2,,Cut fruits,Uddin vada,Dhokla,Rawa Upma,Poha,
|
||||||
|
,SAMBAR OR KETCHUP,sambar,,veg sambar,,,veg sambar,
|
||||||
|
,CURD,,Curd,,,,,Curd
|
||||||
|
,CHUTNEY,coconut chutney,Peanut Garlic chutney,Coconut chutney ,coconut chutney,Green chutney,coconut chutney,Mint Chutney
|
||||||
|
,EGG,Boiled egg,,Boiled egg,,Omlette,,
|
||||||
|
,JUICE/MILK SHAKE,,,,,,,Pineapple Juice
|
||||||
|
LUNCH,,,,,,,,
|
||||||
|
LUNCH,INDIAN BREAD,Dal CHAPATI,METHI CHAPATI,BEETROOT POORI,Pudina chapati,AJWAIN CHAPATI,Chapati,BHATURE
|
||||||
|
,VEG GRAVY,Kadai Vegetable,Mix Veg Gravy,ALOO BHAJJI,Aloo Drumstick Curry,Veg Jalfrezi,Bhindi Aloo,PINDI CHOLE
|
||||||
|
,VEG DRY/ STARTERS,Cabbage Poriyal,Gobi mutter,Carrot beans poriyal,Bhindi Do Pyaza,Chow chow Poriyal,Egg Curry/Soyabean Curry,HARA BHARA KEBAB
|
||||||
|
,FLAVORED RICE,Curd rice,Jeera rice,Bisibilla Bhat,Hyderabadi dum biryani,Green Peas pulao,Pongal,VEG PULAO
|
||||||
|
,PLAIN RICE,Plain Rice,Plain Rice,Plain Rice,Plain Rice,Plain Rice,Plain Rice,Plain Rice
|
||||||
|
,DAL,Dal Tadka,Arhar daal,yellow urad daal,hara moong daal,Dal Tadka,Toor daal,DAL PANCHMEL
|
||||||
|
,SAMBAR OR RASAM,Pepper Rasam,Vegetable Sambhar,Coriander jeera Rasam,pumpkin sambar,Rasam,Carrot sambhar,Garlic rasam
|
||||||
|
,CURD BASE,Lemonade,CURD,Curd,Burani raita,curd,Curd,Sweet Lassi
|
||||||
|
,SALAD/SPROUTS,Green Salad,Sprouts Salad,Chickpea Salad,GREEN SALAD,Green Salad,VEG CORN SALAD,ONION\CHILLI\LEMON
|
||||||
|
,SWEETS,Rasgulla,Dry fruit Barfi, Ice Cream,Assoreted PASTRY,Ras malai, Icecream,GulabJamun
|
||||||
|
SNACKS,,,,,,,,
|
||||||
|
SNACKS,SNACKS,Pani puri,Dal Pakwan,Mix Bhajiya,Pav Bhaji,Misal Pav,Kachori,Samosa
|
||||||
|
,ACCOMPANIMENTS,,,Ketchup ,Lemon+Onion,,Imly Chutney,
|
||||||
|
,TEA/COFFEE/MILK,TEA/COFFEE/MILK,TEA/COFFEE/MILK,TEA/COFFEE/MILK,TEA/COFFEE/MILK,TEA/COFFEE/MILK,TEA/COFFEE/MILK,TEA/COFFEE/MILK
|
||||||
|
DINNER,,,,,,,,
|
||||||
|
DINNER,INDIAN BREAD,methi chapati,Ajwain chapati,Tawa Paratha,Ajwain Chapati,TAWA PARATHA,AJWAIN CHAPATI,METHI CHAPATI
|
||||||
|
,VEG GRAVY,mix veg curry,Methi mutter Malai,,Aloo Gobi Mutter,Achari Subzi,Corn Masala,
|
||||||
|
,VEG DRY/ STARTERS,Aloo Jeera,Aalo Gobi 65,HONEY CHILLI POTATO,VEG MANCHURIAN,Tawa Vegetables,Pudina aalo tikki,Kadai Veg
|
||||||
|
,FLAVORED RICE,Veg shezwaan noodles,Achari dum biryani,Jeera Mutter Pulao,Veg pulao,,Fried Rice,MEXICAN RICE
|
||||||
|
,PLAIN RICE,Rice,Rice,PLAIN RICE,Rice,PLAIN RICE,PLAIN RICE,PLAIN RICE
|
||||||
|
,DAL,Yellow Dal Tadka ,Rajma Masala,DAL MAKHANI,Live Dal Tadka,Masoor daal,LOBIA MASALA,GREEN MOONG DAL
|
||||||
|
,SAMBAR OR RASAM,tamarind sambar,onion sambar,Drumstick SAMBAR,Methi leaves sambar,vendakkai Sambar,Veg Rasam,Tamarind sambhar
|
||||||
|
,CURD BASE,Curd,Boondi raita,mix veg raita,CURD,MIX VEG RAITA,Boondi raita,Plain ButterMilk
|
||||||
|
,SALAD/SPROUTS,Green salad,Pasta Salad,Sprouts Salad,punjabi Salad,GREEN SALAD,Russian Salad,Green Salad
|
||||||
|
,SWEETS,Badushah,Jalebi+rabri,Rasmalai,Marble Cake,Rasgulla, Shrikhand,Moti Malai
|
||||||
|
,PANEER,,,Panner Butter Masala,,Kadhai Paneer\Veg Biryani,,Paneer Kurchan
|
||||||
|
,CHICKEN,,,Chicken Butter masala,,Chicken Biryani,,Chicken Kurchan
|
||||||
|
,,,,,,,,
|
||||||
|
,"Daily breakfast will have bread (white, brown), butter, jam, black coffee, milk, tea",,,,,,,
|
||||||
|
,"Lunch and dinner will have papad/fryums, pickle, saunf, sugar and salt",,,,,,,
|
||||||
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
numpy
|
||||||
|
pandas
|
||||||
77
scrapeToJson.py
Normal file
77
scrapeToJson.py
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
import pandas
|
||||||
|
import numpy
|
||||||
|
import datetime
|
||||||
|
import json
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
ALLDAYS = [
|
||||||
|
"SUNDAY",
|
||||||
|
"MONDAY",
|
||||||
|
"TUESDAY",
|
||||||
|
"WEDNESDAY",
|
||||||
|
"THURSDAY",
|
||||||
|
"FRIDAY",
|
||||||
|
"SATURDAY",
|
||||||
|
]
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# mainData = pandas.read_excel("menu.ods")
|
||||||
|
mainData = pandas.read_csv("menu.csv")
|
||||||
|
breaksLoc = numpy.where(
|
||||||
|
pandas.isna(mainData.drop("Unnamed: 0", axis="columns")).all(1).to_numpy()
|
||||||
|
== True
|
||||||
|
)[0]
|
||||||
|
print(breaksLoc)
|
||||||
|
rowNames = mainData["Unnamed: 1"].to_numpy()
|
||||||
|
# Item names: x[x["Unnamed: 1"]=="BREAKFAST 1"]["MONDAY"].item()
|
||||||
|
# print(breaksLoc)
|
||||||
|
finalData = {"menu": {}, "dates": {}, "items": {}}
|
||||||
|
for sesNum, ses in enumerate(["bf", "ln", "sk", "dn"]):
|
||||||
|
finalData["items"][ses] = mainData["Unnamed: 1"].to_list()[
|
||||||
|
breaksLoc[sesNum] + 1 : breaksLoc[sesNum + 1]
|
||||||
|
]
|
||||||
|
for dayNumber, eachDay in enumerate(ALLDAYS):
|
||||||
|
print(eachDay)
|
||||||
|
for aDate in mainData[eachDay][: breaksLoc[0]]:
|
||||||
|
# print(type(aDate))
|
||||||
|
# aDate = str(aDate.to_pydatetime().date().strftime("%d-%m-%Y"))
|
||||||
|
aDate = str(
|
||||||
|
datetime.datetime.strptime(aDate, "%Y-%m-%d %H:%M:%S")
|
||||||
|
.date()
|
||||||
|
.strftime("%d-%m-%Y")
|
||||||
|
)
|
||||||
|
finalData["dates"][aDate] = str(dayNumber)
|
||||||
|
# print(finalData, rowNames, breaksLoc)
|
||||||
|
|
||||||
|
currentMenu = {"bf": {}, "ln": {}, "sk": {}, "dn": {}}
|
||||||
|
for i, ses in enumerate(["BREAKFAST", "LUNCH", "SNACKS", "DINNER"]):
|
||||||
|
# print(ses)
|
||||||
|
for item in rowNames[breaksLoc[i] + 1 : breaksLoc[i + 1]]:
|
||||||
|
part = (
|
||||||
|
mainData.loc[breaksLoc[i] + 1 : breaksLoc[i + 1]]
|
||||||
|
.loc[mainData["Unnamed: 1"] == item][eachDay]
|
||||||
|
.item()
|
||||||
|
)
|
||||||
|
if isinstance(part, float) and (part is numpy.nan):
|
||||||
|
part = "MT"
|
||||||
|
|
||||||
|
# print(f"{item}: {part}")
|
||||||
|
if "egg" in part.strip().lower() or "omlet" in part.strip().lower():
|
||||||
|
print(f"EGG Found, {part} at {ses}")
|
||||||
|
eggy = "EGG"
|
||||||
|
elif "chicken" in part.strip().lower():
|
||||||
|
eggy = "NON"
|
||||||
|
print(f"Chicken Found, {part} at {ses}")
|
||||||
|
else:
|
||||||
|
eggy = "VEG"
|
||||||
|
currentMenu[list(currentMenu.keys())[i]][item] = {
|
||||||
|
"name": part.strip().title(),
|
||||||
|
"eggy": eggy,
|
||||||
|
}
|
||||||
|
# print()
|
||||||
|
finalData["menu"][dayNumber] = currentMenu
|
||||||
|
# print(finalData)
|
||||||
|
with open("out.json", "w+") as jsonWriter:
|
||||||
|
json.dump(finalData, jsonWriter)
|
||||||
|
with open("out.txt", "w+") as hashWriter:
|
||||||
|
hashWriter.write(hashlib.md5(json.dumps(finalData).encode("utf-8")).hexdigest())
|
||||||
Reference in New Issue
Block a user