The Lunch Bot

Benji Gourdji’s Programming 2 Final

Junior Emily Simon stands in Starbucks, sipping a Chai Latte. She unlocks her phone and opens her texts, where she writes ‘Thursday’ and sends it to the number +1 (773) 692-4110. Within a second, she receives one back with the words ‘Tandoori chicken’ and various accoutrements she can choose from in the cafeteria that day. 

This number is known as a “Lunch Bot,” created by Junior Benji Gourdji for his Computer Programming 2 final last year. Gourdji has been involved in Robotics for a while, and he is now the lead programmer for Parker. For him, Programming 2 opened up what he could do with coding and let him try more techniques. 

The Lunch Bot supplies students with the lunch menu on any given school day if someone texts ‘Lunch,’ ‘Today,’ or ‘Caf’ to the phone number for that day’s lunch or ‘M,’ ‘T,’ ‘W,’ ‘Th,’ or ‘F’ to preview the lunches for the rest of the week. 

Gourdji’s first step was to import two libraries of information into Python. The first library was to scrape the menu PDF online using a webscrapign technique he had learned in Programming 2. 

He downloaded the library and plugged in the menu link posted on the portal. When Parker updates the menu, the program pulls the info in and recognizes different days of the week. If a student is asking for Monday, for example, the program will search for the word ‘Monday’ and send it out to the second library, which sends it out to the student in the form of a text. 

“There were certain elements that were harder, and the first was getting the actual PDF into Python and manipulating it,” Gourdji said. “When Parker posts it, the spacing isn’t perfect so Python will create random spaces between words that we had to recognize and fix while working with a text simulator.”

 According to Gourdji, programming the Bot took a lot of editing text. “We used this online texting service called Twilio, which was created for businesses to send out ads,” Gourdji said. “It has a lot of complexities, and the project took me about three weeks to complete.”

The program updates itself, but occasionally there is a bug in the spacing and Lee will update it manually. “When the cafeteria posts the menu they change the formatting so the program has to adapt to that week to week,” Upper School computer science teacher Aaron Lee said. “When it fails, I pull the data out of the PDF and get it into a usable format.”

Gourdji’s first idea was a project with Twitter, but someone had already done a project with it. Lee suggested that he do something with the lunch menu instead. 

“We were thinking, what are some things we can do for the school or supply information that people can’t readily access,” Lee said. “It’s easy to use, especially if you’re not connected to the Internet.” 

“It’s super helpful because sometimes I have to make a last minute decision on if I want to order lunch,” Emily Simon said. “It’s hard to log into the Portal and click on all of the links, so this is really convenient.” 

Students and faculty have used the Lunch Bot a few thousand times since the beginning of the year, with at least fifty texts each day. Each response costs a fraction of a penny, and the total amount the system has cost so far is around five dollars. 

“It’s so interesting how programming can actually apply to everyday life,” Simon said. “I’m really impressed with the computer programming skills because it seems so complex.”

“People get really excited when they use it, and they say, ‘I’m using your bot!’” Gourdji said. “I’m glad people like it and it’s helpful, but sometimes they’ll think that I know the lunch!”

For Lee, this is his favorite part of the project. “Anytime you can interact with the community is cool if it’s used,” Lee said. “I like that people use it.”

Gourdji doesn’t know if the program will work after he graduates next year. “If they change the ways they post the menu, it will throw the whole program off-kilter,” Gourdji said. “The next person will have to change and update it.”