diff --git a/.github/workflows/queue_for_grading.yaml b/.github/workflows/queue_for_grading.yaml
new file mode 100644
index 0000000..8b2ebca
--- /dev/null
+++ b/.github/workflows/queue_for_grading.yaml
@@ -0,0 +1,20 @@
+name: GitHub Actions Trigger Queue for Auto-Grading
+run-name: ${{ github.actor }} is submitting their 🏠 home 💪 work for 🤖 bot 🎓 grading on GitHub Actions 🚀
+on: [push]
+jobs:
+ Submit-For-Autograding:
+ runs-on: ubuntu-latest
+ env:
+ AZURE_SERVICEBUS_CONNECTION_STRING: ${{ secrets.AZURE_SERVICEBUS_CONNECTION_STRING }}
+ AZURE_SERVICEBUS_QUEUE: ${{ vars.AZURE_SERVICEBUS_QUEUE }}
+ steps:
+ - run: echo "DT=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
+ - run: echo "🗓️ The job was triggerd on ${{ env.DT }}."
+ - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
+ - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
+ - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
+ - run: echo "🪈 The queue name is ${{ env.AZURE_SERVICEBUS_QUEUE }}."
+ - run: pip install azure-servicebus-cli
+ - run: azsb send --queue ${{ env.AZURE_SERVICEBUS_QUEUE }} --message '{"timestamp":"${{ env.DT }}","cmd":"graderbot","repo_url":"${{ github.repository }}"}'
+ - run: echo "🍏 Message sent to the grading bot! This job's status is ${{ job.status }}."
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..82f9275
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,162 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.nox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+*.py,cover
+.hypothesis/
+.pytest_cache/
+cover/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+db.sqlite3-journal
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+.pybuilder/
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+# For a library or package, you might want to ignore these files since the code is
+# intended to run in multiple environments; otherwise, check them in:
+# .python-version
+
+# pipenv
+# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
+# However, in case of collaboration, if having platform-specific dependencies or dependencies
+# having no cross-platform support, pipenv may install dependencies that don't work, or not
+# install all needed dependencies.
+#Pipfile.lock
+
+# poetry
+# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
+# This is especially recommended for binary packages to ensure reproducibility, and is more
+# commonly ignored for libraries.
+# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
+#poetry.lock
+
+# pdm
+# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
+#pdm.lock
+# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
+# in version control.
+# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
+.pdm.toml
+.pdm-python
+.pdm-build/
+
+# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
+__pypackages__/
+
+# Celery stuff
+celerybeat-schedule
+celerybeat.pid
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
+
+# pytype static type analyzer
+.pytype/
+
+# Cython debug symbols
+cython_debug/
+
+# PyCharm
+# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
+# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
+# and can be added to the global gitignore or merged into this file. For a more nuclear
+# option (not recommended) you can uncomment the following to ignore the entire idea folder.
+#.idea/
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..4a4eb98
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,23 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Streamlit Run: Current File",
+ "type": "debugpy",
+ "request": "launch",
+ "module": "streamlit",
+ "args": ["run", "${file}"],
+ "console": "integratedTerminal"
+ },
+ {
+ "name": "Python Debugger: Current File",
+ "type": "debugpy",
+ "request": "launch",
+ "program": "${file}",
+ "console": "integratedTerminal"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..456a67e
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,7 @@
+{
+ "python.testing.pytestArgs": [
+ "tests", "-s", "--import-mode=prepend"
+ ],
+ "python.testing.unittestEnabled": false,
+ "python.testing.pytestEnabled": true
+}
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e666ac7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,183 @@
+# IST356 Assignment 07 (assignment_07)
+
+## Meta Section
+
+### Prerequisites
+
+Before starting this assignment you must get the requirements installed.
+
+**NOTE: This should be done already as part of the scraping unit.**
+
+Install the assignemnt python requirements:
+
+1. From VS Code, open a terminal: Menu => Terminal => New Terminal
+2. In the terminal, type and enter: `pip install -r requirements.txt`
+3. Get playwright running with the chromium browser: `python -m playwright install`
+
+### Running Tests
+
+There are some code and tests already working in this assignment. These are sanity checks to ensure VS Code is configured properly.
+
+1. Open **Testing** in the activity bar: Menu => View => Testing
+2. Open the **>** by clicking on it next to **assignment_06**. Keep clicking on **>** until you see **test_should_pass** in each **test_????.py** file
+4. Click the Play button `|>` next to **test_should_pass** to execute the test.
+5. A green check means the test code ran and the test has passed.
+6. A red X means the test code ran but the test has failed. When a test fails you will be given an error message and stack trace with line numbers.
+
+### Debugging
+
+Odds are you will need to use some debugging strategies in this assignment.
+
+- To debug a test:
+ - call the test function in the `if __name__ == '__main__':` block at the bottom of the test file.
+ - then set a breakpoint in the test function and run the test as you would any other python program.
+ - run the file with debugging: Menu => Run => Start Debugging
+
+- You will not need streamlit for this assignment.
+
+## Assignment: Scraping a Restaurant Menu
+
+Ever wonder how services like Google and Yelp are able to show restaraunt menu items? They use web scraping, of course.
+
+In this assignment you will scrape the menu items from a restaurant website. The website we will scrape is Tully's Good Times.
+
+[https://www.tullysgoodtimes.com/menus/](https://www.tullysgoodtimes.com/menus/)
+
+To future proof this assignment, I've captured the site at the time of assignment creation using the Wayback Machine. You can access the site here:
+
+[https://web.archive.org/web/20241111165815/https://www.tullysgoodtimes.com/menus/](https://web.archive.org/web/20241111165815/https://www.tullysgoodtimes.com/menus/)
+
+This will ensure any solution code will still work in the future!
+
+### The objective
+
+Scrape the menu off the site, and build a CSV file consisting of the menu items. The CSV file should have the following columns:
+
+- category: where the item sits in the menu e.g. "Burgers"
+- name: of the item
+- price: of the item
+- description: of the item
+
+The input is the webpage, and the output is a CSV of all the menu items on the page. There are no interactions. Consider this just a data extraction task.
+
+## The Approach
+
+Once again, we will take a bottom up approach. Commit your code after each part. Push when you are done with the code and the reflection.
+
+### Part 0: check out menuitem.py
+
+The `menuitem.py` introduces a Python Dataclass [https://docs.python.org/3/library/dataclasses.html](https://docs.python.org/3/library/dataclasses.html) to represent a menu item. Think of a dataclass like a Python dictionary but with a fixed structure. It's a great way to represent structured data in Python where the elements in the structure are required and should obey a specific data types, like a float type for prices.
+
+Review and play around with the main code in the file, running the examples. Before you proceed, make sure you have a good understanding how to create a menu item using the dataclass and convert it back to a dictionary. You will need to know how to do this!
+
+### Part 1: Complete the functions in menuitemextractor.py
+
+Next, work on the functions in `menuitemextractor.py` these functions will get the menu text extracted from the website and convert it to a `MenuItem` dataclass object.
+
+There are three functions to implement:
+
+#### 1. `clean_price(price: str) --> float:`
+
+This function should take a string price "$9.99" and returns a float 9.99. The price string may have a dollar sign or commas that need to be removed before the conversion. We have written something similar before.
+
+#### 2. `clean_scraped_text(scraped_text: str) --> list[str]:`
+
+This function should take the scraped text and clean it up, by removing any unwanted data. First split the text on a newline `"\n"` so you have a list of strings, you will only add the desired lines to the cleaned list. "Unwanted" lines that should be omitted include:
+ - empty lines of text
+ - lines of text that are just "NEW!" or "NEW"
+ - lines of text that are indications of Spicy, Vegan, Gluten-free, or peanut items "S", "V", "GS", "P"
+
+what should be returned back should be a list of only the desired text. There should be 2-3 items in the list.
+
+ - first item will be the name of the item
+ - second item will be the price of the item
+ - third item will be the description of the item (if there is a description)
+
+See `TEST_DATA` in the `test_menuitemextractor.py` file for examples of the text you will be working with.
+
+#### 3. `extract_menu_items( title: str, scraped_text: str) --> MenuItem`
+
+This function builds a `MenuItem` dataclass object from what was scraped.
+ - The title is the scraped menu category, e.g. "Pastas"
+ - The scraped_text is the text of the menu item. Again, refer to `TEST_DATA` in the `test_menuitemextractor.py` file for examples of the text you will be working with.
+
+In the function body, you should call `clean_scraped_text` to get the cleaned text for each item, then create a `MenuItem` object for each item. Do not forget to call `clean_price` to get the price as a float. Finally check to see if there is a menu description (cleaned list of text has more than 2 items), when there is no description, use "No desciption available" as the description.
+
+Use the tests in `tests/test_menuitemextractor.py` to verify your code is correct and in most cases, help you figure out what to do.
+
+### Part 2: tully_scraper.py
+
+The `tully_scraper.py` file is your main program. This is where you will use playwright to scrape the menu items from the website and create the CSV file.
+
+#### CSS Selectors
+
+What is scraping without CSS selectors?
+
+CSS selectors you'll need to identify:
+
+1. `title` a selector for the menu section title.
+
+Example inner_text():
+
+ Starters & Snacks
+
+2. `item` a selector for the text of the food item. This will conain the name, price, and description of the item.
+
+Example inner_text()::
+
+ NEW!
+
+ Tully Tots
+
+ $11.79
+
+ Made from scratch with shredded potatoes, cheddar-jack cheese and Romano...
+
+#### Algorithm
+
+Here's a working strategy for the scraper:
+
+ go to the website (or wayback machine version)
+ for each `title` (menu section) selected on the page
+ go down two elements to get the element that contains the menu items (its a `
` tag)
+ for each item in the all the selected `menu` items
+ get the text of the item
+ call `extract_menu_items` to get a `MenuItem` object
+ add the dict version `MenuItem` to a list
+
+ after the for loops, you have a list of dict for all the menu items on the page.
+ create a pandas dataframe from the list of dict
+ write the dataframe to a CSV file `cache/tullys_menu.csv`
+
+#### Running test_tully_scraper_output.py
+
+After you get the scraper working, you can run the tests in `test_tully_scraper.py` to verify your code is correct.
+
+NOTE: Those tests do not execute the tully scraper, the only check for the CSV file. You will need to run the scraper to generate the CSV file before running the tests!!!
+
+
+## Turning it in
+
+### Commit Requirements
+
+If you followed directions, you should have your 2 git commits minimum. Its okay to have more, but you should have at least 2.
+
+
+- Make sure tests pass and code works as expected
+- Write your reflection in `reflection.md`
+- Commit your changes: VS Code -> menu -> View -> Source Control -> Enter Commit message -> Click "Commit"
+- Push your changes: VS Code -> menu -> View -> Source Control -> Click "Sync Changes"
+
+## Grading
+
+🤖 Beep, Boop. This assignment is bot-graded! When you push your code to GitHub, my graderbot is notified there is something to grade. The bot then takes the following actions:
+
+1. Your assignment repository is cloned from Github
+2. The bot checks your code and commits according to guidelines outlined in `assignment-criteria.json` (it runs tests, checking code correctness, etc.)
+3. The bot reads your `reflection.md` and provides areas for improvement (based on the instructions in the file).
+4. A grade is assigned by the bot. Feedback is generated including justification for the grade given.
+5. The grade and feedback are posted to Blackboard.
+
+You are welcome to review the bot's feedback and improve your submission as often as you like.
+
+**NOTE: ** Consider this an experiment in the future of education. The graderbot is an AI teaching assistant. Like a human grader, it will make mistakes. Please feel free to question the bots' feedback! Do not feel as if you should gamify the bot. Talk to me! Like a person, we must teach it how to do its job effectively.
diff --git a/__init__.py b/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/assignment-criteria.json b/assignment-criteria.json
new file mode 100644
index 0000000..155c8c9
--- /dev/null
+++ b/assignment-criteria.json
@@ -0,0 +1,9 @@
+{
+ "criteria" : [
+ "1. There are at least 2 Github commits",
+ "2. All tests must pass. Pass rate should be 100 %",
+ "3. Code similarity for each file in the assignment should be at least 50 %",
+ "4. The student reflection is acceptable"
+ ],
+ "files" : ["tully_scraper.py", "menuitemextractor.py"]
+}
\ No newline at end of file
diff --git a/cache/scraped_file_goes_here b/cache/scraped_file_goes_here
new file mode 100644
index 0000000..e69de29
diff --git a/code/__init__.py b/code/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/code/menuitem.py b/code/menuitem.py
new file mode 100644
index 0000000..2b1f0b2
--- /dev/null
+++ b/code/menuitem.py
@@ -0,0 +1,40 @@
+from dataclasses import dataclass, asdict
+
+@dataclass
+class MenuItem:
+ # these are built-in properties
+ category: str
+ name: str
+ price: float
+ description: str
+
+ # convert to a dictionary
+ def to_dict(self):
+ return asdict(self)
+
+ @staticmethod
+ def from_dict(data):
+ return MenuItem(**data)
+
+if __name__=='__main__':
+ # example of howto use the dataclass
+
+ # create a new MenuItem
+ mozz = MenuItem(name = "Mozzarella Sticks",
+ price = 8.99,
+ category="Apps",
+ description="Fried cheese sticks served with marinara sauce.")
+
+ # can assign a new category
+ mozz.category = "Appetizers"
+ print(mozz)
+ # convert back to a dictionary
+ print(mozz.to_dict())
+
+ # create a new MenuItem from a dictionary
+ burger = MenuItem.from_dict({"name": "Burger",
+ "price": 9.99,
+ "description": "A delicious burger.",
+ "category": "Entrees"})
+ print(burger)
+
diff --git a/code/menuitemextractor.py b/code/menuitemextractor.py
new file mode 100644
index 0000000..62da32c
--- /dev/null
+++ b/code/menuitemextractor.py
@@ -0,0 +1,21 @@
+if __name__ == "__main__":
+ import sys
+ sys.path.append('code')
+ from menuitem import MenuItem
+else:
+ from code.menuitem import MenuItem
+
+
+def clean_price(price:str) -> float:
+ pass # TODO replace with code
+
+def clean_scraped_text(scraped_text: str) -> list[str]:
+ pass # TODO replace with code
+
+def extract_menu_item(title:str, scraped_text: str) -> MenuItem:
+ pass # TODO replace with code
+
+
+
+if __name__=='__main__':
+ pass
diff --git a/code/solutions/__init__.py b/code/solutions/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/code/solutions/cache/tullys_menu.csv b/code/solutions/cache/tullys_menu.csv
new file mode 100644
index 0000000..c209c11
--- /dev/null
+++ b/code/solutions/cache/tullys_menu.csv
@@ -0,0 +1,114 @@
+category,name,price,description
+Starters & Snacks,Tully Tots,11.79,"Made from scratch with shredded potatoes, cheddar-jack cheese and Romano cheese all rolled up and deep-fried. Served with a spicy cheese sauce."
+Starters & Snacks,Super Nachos,15.49,"Tortilla chips topped with a mix of spicy beef and refried beans, nacho cheese sauce, olives, pico de gallo, jalapeños, scallions and shredded lettuce. Sour cream and salsa on the side. Add guacamole $2.39"
+Starters & Snacks,Mozzarella Sticks,11.49,Lightly battered and served with our own marinara sauce.
+Starters & Snacks,Louisiana Crab Dip,11.49,"A blend of real and imitation crab meat, homemade and creamy with a little zing! Served with tortilla chips."
+Starters & Snacks,Tully's Habañero Wings,15.69,This is where heat meets flavor! Lightly dusted with flour and tossed in our homemade habañero sauce. Bleu Cheese included.
+Starters & Snacks,Garlic Parm Wings,15.69,Lightly dusted with four then tossed in our homemade garlic Parmesan sauce. Celery and Tully's Ranch dressing included.
+Starters & Snacks,Salt & Pepper Wings,15.29,Tossed in our salt and pepper seasoning. Celery and Bleu Cheese included.
+Starters & Snacks,Tully's Original Wings,15.29,"Lightly dusted with flour. Choose from Tully’s signature sauces: Mild, Medium, Hot, or BBQ. Celery and Bleu Cheese included."
+Starters & Snacks,Tully's Buffalo Wings,15.29,Tossed in homemade Buffalo sauce. Celery and Bleu cheese included.
+Starters & Snacks,Loaded Fries,13.29,"Smothered with melted Jack-cheddar cheese, bacon bits and Tully’s Ranch for dipping."
+Starters & Snacks,Tex-Mex Eggrolls,12.99,"Filled with spicy chicken, corn, black beans, peppers, onions and melted cheese. Served with spicy Cajun sauce, salsa and tortilla chips."
+Starters & Snacks,Chicken Wing Dip,12.59,Our homemade spicy dip topped with melted Jack-cheddar cheese and sour cream. Served with tortilla chips.
+Starters & Snacks,Chicken-N-Cheese,12.19,Tully’s Tenders® and mozzarella sticks with Tully’s Honey Mustard and our own marinara sauce.
+Starters & Snacks,Beef Birria Quesadilla,15.99,"Shredded beef marinated in chipotle adobo with cheddar-jack cheese, tomatoes, jalapeños, black olives, scallions, cilantro and black beans in a flour tortilla. Served with sour cream, shredded lettuce and pico de gallo. Add guacamole $2.39"
+Starters & Snacks,Veggie Quesadilla,11.99,"A flour tortilla packed with cheese, tomatoes, jalapeños, black olives and scallions. Served with sour cream and pico de gallo."
+The Best Chicken Tenders on Earth®,10 Tully's Tenders®,19.99,Served with Tully’s Honey Mustard sauce. Sub Buffalo or Asian Tenders add $1.00.
+The Best Chicken Tenders on Earth®,Tully's Tenders® Appetizer,13.99,Hand battered chicken tenders served with fries and Tully’s Honey Mustard.
+The Best Chicken Tenders on Earth®,Asian Tenders Appetizer,14.39,Tully’s Tenders® tossed in a sweet ‘n spicy Asian sauce. Served with fries and Tully’s Ranch.
+The Best Chicken Tenders on Earth®,Buffalo Tenders Appetizer,14.39,Tully’s Tenders® dipped in Buffalo wing sauce. Served with fries and creamy Bleu Cheese.
+The Best Chicken Tenders on Earth®,Add 3 Tully’s Tenders®,6.49,Served with Tully's Honey Mustard sauce.
+Homemade Soups,French Onion Soup,6.89,"Served piping hot with homemade croutons, melted Swiss and mozzarella."
+Homemade Soups,Homemade Chili,6.89,Thick and hearty. Topped with melted cheddar cheese. Served with tortilla chips.
+Homemade Soups,Baked Potato Soup,5.99,"Loaded with chunks of Idaho potatoes, celery, bacon bits and Jack-cheddar cheese."
+Salad Entrées,Balsamic Chicken Salad,15.79,"Romaine tossed with Balsamic vinaigrette dressing and tomato bruschetta. Topped with roasted peppers, olives, Romano cheese, grilled chicken and scallions."
+Salad Entrées,Mexican Chopped Salad,15.49,"Southwest grilled chicken, corn, black beans, pico de gallo, cucumbers, guacamole, red onions and Jack-cheddar cheese. Served over iceberg lettuce, tossed with a salsa ranch."
+Salad Entrées,Grilled Chicken Caesar Salad,14.99,"Crisp Romaine tossed with Caesar dressing and homemade croutons, topped with grilled chicken."
+Salad Entrées,Tavern Steak Salad,17.99,"Mixed greens tossed with red wine vinaigrette, cucumbers, diced tomatoes, scallions, potatoes and topped with grilled USDA Choice Flat iron steak and crumbly Bleu Cheese."
+Salad Entrées,BBQ Chicken Salad,14.89,"Iceberg lettuce tossed with homemade Tully’s Ranch, black beans, corn, and Jack-cheddar cheese. Topped with scallions, cilantro, diced tomatoes, tortilla chips and BBQ grilled chicken."
+Salad Entrées,Tully's Tenders® Salad,14.99,"Iceberg lettuce with fresh vegetables, black olives, and Jack-cheddar cheese. Topped with Tully’s Tenders®. Sub Buffalo or Asian Tenders $.40"
+Huge Deli Sandwiches,The Tully,14.99,Shaved turkey and ham lightly grilled and topped with melted white American cheese and bacon with lettuce and tomato on butter toasted deli bread.
+Huge Deli Sandwiches,The Ultimate BLT,14.99,"Crisp bacon, lettuce, tomato and mayo on country white bread."
+Huge Deli Sandwiches,New York Grilled Reuben,15.79,"Corned beef, Thousand Island dressing, sauerkraut and melted Swiss on rye."
+Huge Deli Sandwiches,The Ultimate Grilled Cheese,13.89,"Cheddar, yellow and white American cheeses on country white bread."
+Huge Deli Sandwiches,Classic Tuna Melt on Rye,14.99,Grilled with melted Cheddar cheese and sliced tomatoes on Rye.
+Tully's Favorites,California Fish Taco,15.99,"A crisp tortilla packed with hand breaded haddock, melted cheese, black beans, pico de gallo, scallions, black olives, jalapeños and our spicy homemade dressing. Served with rice and beans. Add guacamole $2.39."
+Tully's Favorites,Santa Fe Chicken Dinner,16.99,"Two fresh 6oz chicken breast grilled then topped with teriyaki sauce, American cheese, mushrooms, and bacon. Served with coleslaw and choice of side."
+Tully's Favorites,Seafood Combo,16.99,"Hand breaded shrimp and lightly breaded haddock, served with choice of side, coleslaw and garlic bread."
+Tully's Favorites,Fish Fry Haddock Dinner,16.49,"Lightly breaded haddock with choice of potato, coleslaw and tartar sauce."
+Tully's Favorites,Mile High Meatloaf,15.99,Homemade meatloaf (contains mushrooms) served on top of country mashed potatoes and topped with fresh gravy. Served with coleslaw.
+Tully's Favorites,Surf 'n Turf,19.79,6oz USDA Angus Flat Iron steak served with sautéed shrimp lightly seasoned with Cajun spices and fresh vegetables. (Under 800 calories)
+Tully's Favorites,Tully's Tenders® Dinner,15.99,Fresh hand battered chicken tenders with fries. Served with Tully’s Honey Mustard and coleslaw.
+Tully's Favorites,Asian Tenders Dinner,16.69,"Tully’s Tenders dipped in house sweet ‘n spicy Asian sauce. Served with fries, Tully’s Ranch and coleslaw."
+Tully's Favorites,Buffalo Tenders Dinner,16.69,"Tully’s Tenders dipped in house Buffalo sauce. Served with fries, Bleu Cheese and coleslaw."
+Sandwich Platters,Bacon Chicken Teriyaki Sandwich,14.49,"An old favorite! Grilled chicken breast topped with teriyaki sauce, American cheese, mushrooms and bacon."
+Sandwich Platters,Cajun Cheddar Chicken Sandwich,13.99,"Grilled chicken breast seasoned with Cajun spices and topped with cheddar cheese. Served on a toasted roll with lettuce, tomato and Cajun mayo."
+Sandwich Platters,Blackened Mahi Sandwich,15.69,"Grilled to perfection with diced pickles, lettuce and Cajun mayo."
+Sandwich Platters,Fish Fry Haddock Sandwich,13.79,"Lightly hand breaded haddock, served with lettuce and a side of tartar sauce."
+Sandwich Platters,Cheese Steak,14.59,"Sliced sirloin topped with onions, peppers, mushrooms and melted American cheese."
+Sandwich Platters,Buffalo Chicken,13.99,"Hand battered chicken breast dipped in Buffalo sauce, topped with Bleu Cheese."
+Sandwich Platters,Ranch Chicken,14.29,"Chicken breast hand battered and lightly fried. Topped with American cheese, lettuce, tomato, bacon and Tully’s Ranch dressing."
+Burgers,Fiery Jalapeño Cheddar Burger,13.99,Seasoned with our fiery habañero roasted garlic seasoning and jalapeños right in the burger. Topped with cheddar cheese and Cajun mayo.
+Burgers,American Classic Burger,13.99,"Our fresh steak burger topped with American cheese and freshly sliced white onion with diced pickles, ketchup and mustard. A must try!"
+Burgers,Basic Burger,12.99,Lettuce and tomato.
+Burgers,Knife & Fork Cheesy Philly Burger,15.49,"Topped with diced onions, peppers, American cheese and our homemade mac 'n cheese sauce poured all over the bun."
+Burgers,Cheeseburger,13.59,"Lettuce, tomato and choice of American, cheddar, or Swiss cheese."
+Burgers,Smokehouse Burger,13.99,"Bacon, cheddar cheese, BBQ sauce and our Cajun mayo topped with fresh, fried onion straws."
+Burgers,Bacon Cheeseburger,14.79,"Five strips of bacon, American cheese, lettuce, tomato and mayo."
+Burgers,Mountain Melt Burger,15.89,"Our huge burger packed between our Ultimate Grilled Cheese with lettuce, tomato and mayo."
+Burgers,Mushroom Swiss Burger,13.79,Sautéed mushrooms and melted Swiss cheese.
+Burgers,Turkey Burger,13.49,Juicy ground seasoned turkey grilled with lettuce and tomato.
+Burgers,Garden Burger,13.99,"Meatless burger with pickled red onions, lettuce, tomato, mustard, ketchup and pickles."
+Pastas,Baked Ziti,15.99,"A generous portion of ziti tossed in our own marinara sauce with Romano and mozzarella cheese, then baked."
+Pastas,Buffalo Mac & Cheese,17.89,Tender chicken sautéed in buffalo sauce then tossed with ziti pasta and our homemade cheese sauce. Topped with butter crumb topping and melted jack‐cheddar cheese.
+Pastas,Chicken & Broccoli Alfredo,17.29,Tender chicken and broccoli tossed with fettuccine Alfredo.
+Pastas,Cheesy Chicken & Broccoli Bake,16.99,"Homemade cheddar cheese sauce tossed with tender chicken, ziti and broccoli. Topped with a buttery crumb topping."
+Pastas,Cajun Chicken Pasta,17.89,"Fresh chicken, mushrooms and ziti tossed in a spicy Alfredo sauce."
+Pastas,Chicken Parmigiana,16.49,"Chicken breast breaded Italian style, topped with our own marinara sauce, Romano and mozzarella with a side of fettuccine."
+Rice Bowls,Shrimp Creole,14.99,"A taste of New Orleans! Plump shrimp and our own Creole seasoning sautéed with garlic butter, fresh chopped celery, green peppers, onions, diced tomatoes and a little hot sauce for some kick! Served with seasoned rice."
+Rice Bowls,Orange Tenders Rice Bowl,14.49,"Tully's Tenders® tossed with broccoli, shredded carrots and our homemade orange citrus sauce. Served over seasoned rice and sprinkled with scallions."
+Rice Bowls,Healthy Choice Life Bowl,13.99,"Southwest seasoned chicken with black beans, corn, pico de gallo, guacamole on a bed of seasoned rice with fresh cilantro and lime. (Under 600 calories)"
+Rice Bowls,Chicken Fresca,15.99,"Chicken tenders sautéed in our light tomato white wine sauce with mushrooms, tomato bruschetta, roasted red peppers, Romano cheese and scallions. Served over seasoned rice."
+Rice Bowls,Beef Birria Rice Bowl,15.69,"Shredded beef marinated in chipotle adobo on top of seasoned rice with pico de Gallo, creamy guacamole, black beans, shredded jack-cheddar cheese and fresh cilantro."
+Rice Bowls,Blackened Shrimp Rice Bowl,13.99,"Blackened gulf shrimp, grilled with onions, corn, black beans and roasted red peppers. Served over rice with pico de gallo and fresh cilantro."
+Shareable Desserts,Baked Apple Crumb Pie,7.99,"Two layers of apples, brown sugar and cinnamon homemade in our kitchen. Topped with vanilla ice cream, whipped cream, caramel sauce and sprinkled with more cinnamon."
+Shareable Desserts,Pumpkin Cheesecake,7.99,"Homemade cheesecake topped with powdered sugar, whipped cream and cinnamon."
+Shareable Desserts,Chocolate Chip Cookie Monster,7.99,"Two warm chocolate chip cookies topped with vanilla ice cream, hot fudge and whipped cream."
+Shareable Desserts,Reese's Pieces® Cookie Monster,7.99,"Two warm chocolate chip cookies topped with vanilla ice cream, whipped cream, chocolate sauce, peanut butter sauce and crushed Reese’s Pieces®."
+Shareable Desserts,Chocolate Peanut Butter Pie,7.99,"Homemade with chocolate crumb crust, creamy peanut butter, topped with semi-sweet chocolate and whipped cream."
+Lunch Combos,Tully's Street Tacos,11.99,"Two flour tortillas filled with our signature Tully's Tenders®, shredded jack-cheddar cheese, pico de gallo, shredded lettuce and cilantro lime crema. Sprinkled with our taco seasoning and fresh cilantro. Served with homemade cowboy caviar."
+Lunch Combos,Lunch Tuna Melt,11.99,Lunch size of our Classic Tuna Melt on rye with melted cheddar and tomato. Served with fries and a pickle spear.
+Lunch Combos,Turkey Bacon Ranch,11.99,"Freshly shaved turkey and crispy bacon with cheddar cheese, lettuce and tomato on toasted deli bread with our homemade Ranch dressing. Served with fries and a pickle spear."
+Lunch Combos,1/4lb Cheeseburger,11.99,"Our 1/4lb. burger with lettuce, tomato and topped with American cheese. Served with fries and pickle spear."
+Lunch Combos,The Dublin,11.99,"Warm corned beef on a toasted roll with Swiss cheese, 1000 Island dressing and topped with fresh coleslaw. Served with fries and a pickle spear."
+Lunch Combos,Soup & Sandwich Combo,11.99,"Baked Potato soup, paired with a turkey, ham, or tuna fish sandwich on a small sub roll with lettuce, tomato, and mayo. Served with a pickle spear. Substitute French Onion or Homemade Chili for $.99."
+Lunch Combos,Soup & Tenders,11.99,Baked Potato soup and Tully's Tenders® with Tully's Honey Mustard for dipping. Substitute French Onion or Homemade Chili for $.99.
+Lunch Combos,Chicken Tender Wrap,11.99,"Tully’s Tenders® diced and mixed with lettuce, tomato and Tully’s Honey Mustard. Served with fries and a pickle spear."
+Lunch Favorites,Tully's Meatball Sub,11.69,A classic. Meatballs covered in our own marinara sauce topped with Romano and mozzarella cheese on a garlic butter grilled sub roll. Served with fries and a pickle spear.
+Lunch Favorites,Chicken Caesar Wrap,11.99,Crisp romaine tossed in Caesar dressing with grilled chicken. Served with fries and a pickle spear.
+Lunch Favorites,Lunch Fish Fry,11.99,"Lightly breaded haddock served with fries, tartar sauce and coleslaw."
+Lunch Favorites,Tully's Tenders®,11.99,Our famous hand battered Tully's Tenders®. Served with fries and Tully's Honey Mustard for dipping. Sub Buffalo or Asian Tenders $.50.
+Dinner Specials,Fiery 10oz Flat Iron Steak,21.99,"10oz USDA Choice Black Angus Flat Iron steak rubbed with our fiery habañero roasted garlic seasoning. Topped with homemade pico de Gallo, fried onion straws and fresh cilantro. Served with cowboy caviar and country mashed potatoes."
+Dinner Specials,Petite Flat Iron Steak,16.79,6oz USDA choice Black Angus flat iron steak served with country mashed potatoes and fresh vegetables.
+Dinner Specials,Steak and Shells Combo,19.99,6oz USDA Choice Black Angus Flat Iron steak served with our classic stuffed shells and garlic bread.
+Dinner Specials,Steak and Tender Combo,19.79,6oz USDA choice Black Angus Flat Iron steak and Tully’s
+Dinner Specials,Steak Fajita Bowl,17.99,"Seasoned Black Angus Flat Iron steak served with grilled onions, mushrooms and peppers, pico de gallo, guacamole and cowboy caviar. Served over seasoned riced and sprinkled with fresh cilantro and cheddar-jack cheese."
+Dinner Specials,Baked Stuffed Shells,15.99,"Pasta shells stuffed with ricotta, herbs, and mozzarella cheese. Topped with our own marinara sauce and mozzarella cheese then baked until golden brown. Served with a side salad and garlic bread."
+Dinner Specials,Orange Citrus Salmon,19.79,8oz Norwegian salmon grilled with our homemade orange citrus sauce. Served with seasoned rice and fresh vegetables.
+Dinner Specials,Grilled Pork Chops,16.99,"Two center-cut loin pork chops seasoned with salt and pepper then grilled. Served with applesauce, coleslaw and country mashed potatoes."
+Dinner Specials,Italian Style Mahi Mahi,17.79,"Grilled mahi mahi filet with Italian seasonings. Topped with a warm combination of black olives, roasted red peppers, homemade bruschetta and a sprinkle of Pecorino Romano cheese. Served with seasoned rice and fresh vegetables."
+Little League Menu,Kid's Burger & Fries,6.99,Add cheese for $.30
+Little League Menu,Tully's Tenders & Fries,6.99,No description available.
+Little League Menu,Pasta Marinara,6.99,No description available.
+Little League Menu,Grilled Cheese Sandwich & Fries,6.99,No description available.
+Little League Menu,Macaroni & Cheese,6.99,No description available.
+Little League Menu,Mozzarella Sticks & Fries,6.99,No description available.
+Little League Menu,Tully's Tenders Salad,6.99,No description available.
+Little League Menu,Cookie & Cream Dream,3.99,A creamy drink made with crumbled chocolate cookies and vanilla ice cream.
+Little League Menu,Kiddie Cookie Sundae,3.99,"Vanilla ice cream, crushed chocolate cookies, chocolate syrup and whipped cream."
+Little League Menu,Hot Fudge Sundae,3.99,No description available.
+Little League Menu,Strawberry Fizz,2.29,"Sierra Mist, strawberry puree."
+Little League Menu,Candy Apple,2.29,Apple juice and grenadine.
+Little League Menu,Wild Berry Smoothie,5.99,No description available.
+Little League Menu,Strawberry Smoothie,5.99,No description available.
diff --git a/code/solutions/menuitem.py b/code/solutions/menuitem.py
new file mode 100644
index 0000000..2b1f0b2
--- /dev/null
+++ b/code/solutions/menuitem.py
@@ -0,0 +1,40 @@
+from dataclasses import dataclass, asdict
+
+@dataclass
+class MenuItem:
+ # these are built-in properties
+ category: str
+ name: str
+ price: float
+ description: str
+
+ # convert to a dictionary
+ def to_dict(self):
+ return asdict(self)
+
+ @staticmethod
+ def from_dict(data):
+ return MenuItem(**data)
+
+if __name__=='__main__':
+ # example of howto use the dataclass
+
+ # create a new MenuItem
+ mozz = MenuItem(name = "Mozzarella Sticks",
+ price = 8.99,
+ category="Apps",
+ description="Fried cheese sticks served with marinara sauce.")
+
+ # can assign a new category
+ mozz.category = "Appetizers"
+ print(mozz)
+ # convert back to a dictionary
+ print(mozz.to_dict())
+
+ # create a new MenuItem from a dictionary
+ burger = MenuItem.from_dict({"name": "Burger",
+ "price": 9.99,
+ "description": "A delicious burger.",
+ "category": "Entrees"})
+ print(burger)
+
diff --git a/code/solutions/menuitemextractor.py b/code/solutions/menuitemextractor.py
new file mode 100644
index 0000000..4e5a85d
--- /dev/null
+++ b/code/solutions/menuitemextractor.py
@@ -0,0 +1,86 @@
+if __name__ == "__main__":
+ import sys
+ sys.path.append('code')
+ from menuitem import MenuItem
+else:
+ from code.menuitem import MenuItem
+
+
+def clean_price(price:str) -> float:
+ # remove dollar sign
+ price = price.replace("$", "")
+ # remove any commas
+ price = price.replace(",", "")
+ # convert to float
+ return float(price)
+
+def clean_scraped_text(scraped_text: str) -> list[str]:
+ items = scraped_text.split("\n")
+ cleaned = []
+ for item in items:
+ if item in ['GS',"V","S","P"]:
+ continue
+ if item.startswith("NEW"):
+ continue
+ if len(item.strip()) == 0:
+ continue
+
+ cleaned.append(item)
+
+ return cleaned
+
+
+
+def extract_menu_item(title:str, scraped_text: str) -> MenuItem:
+ cleaned_items = clean_scraped_text(scraped_text)
+ item = MenuItem(category=title, name="", price=0.0, description="")
+ item.name = cleaned_items[0]
+ item.price = clean_price(cleaned_items[1])
+ if len(cleaned_items) > 2:
+ item.description = cleaned_items[2]
+ else:
+ item.description = "No description available."
+ return item
+
+
+
+
+if __name__=='__main__':
+ test_items = [
+ '''
+NEW!
+
+Tully Tots
+
+$11.79
+
+Made from scratch with shredded potatoes, cheddar-jack cheese and Romano cheese all rolled up and deep-fried. Served with a spicy cheese sauce.
+ ''',
+
+ '''Super Nachos
+
+$15.49
+GS
+
+Tortilla chips topped with a mix of spicy beef and refried beans, nacho cheese sauce, olives, pico de gallo, jalapeños, scallions and shredded lettuce. Sour cream and salsa on the side. Add guacamole $2.39
+
+ ''',
+ '''Veggie Quesadilla
+
+$11.99
+V
+
+A flour tortilla packed with cheese, tomatoes, jalapeños, black olives and scallions. Served with sour cream and pico de gallo.
+Add chicken $2.99 | Add guacamole $2.39
+''',
+'''Kid's Burger & Fries
+
+$6.99
+'''
+
+ ]
+ title = "TEST"
+ for scraped_text in test_items:
+ item = extract_menu_item(title, scraped_text)
+ print(item)
+
diff --git a/code/solutions/tully_scraper.py b/code/solutions/tully_scraper.py
new file mode 100644
index 0000000..0b12a07
--- /dev/null
+++ b/code/solutions/tully_scraper.py
@@ -0,0 +1,33 @@
+import re
+from playwright.sync_api import Playwright, sync_playwright
+from menuitemextractor import extract_menu_item
+from menuitem import MenuItem
+import pandas as pd
+
+def tullyscraper(playwright: Playwright) -> None:
+ browser = playwright.chromium.launch(headless=False)
+ context = browser.new_context()
+ page = context.new_page()
+ page.goto("https://www.tullysgoodtimes.com/menus/")
+
+ extracted_items = []
+ for title in page.query_selector_all("h3.foodmenu__menu-section-title"):
+ title_text = title.inner_text()
+ print("MENU SECTION:", title_text)
+ row = title.query_selector("~ *").query_selector("~ *")
+ for item in row.query_selector_all("div.foodmenu__menu-item"):
+ item_text = item.inner_text()
+ extracted_item = extract_menu_item(title_text, item_text)
+ print(f" MENU ITEM: {extracted_item.name}")
+ extracted_items.append(extracted_item.to_dict())
+
+ df = pd.DataFrame(extracted_items)
+ df.to_csv("cache/tullys_menu.csv", index=False)
+
+ # ---------------------
+ context.close()
+ browser.close()
+
+
+with sync_playwright() as playwright:
+ tullyscraper(playwright)
diff --git a/code/tully_scraper.py b/code/tully_scraper.py
new file mode 100644
index 0000000..30ae11e
--- /dev/null
+++ b/code/tully_scraper.py
@@ -0,0 +1,21 @@
+import re
+from playwright.sync_api import Playwright, sync_playwright
+from menuitemextractor import extract_menu_item
+from menuitem import MenuItem
+import pandas as pd
+
+def tullyscraper(playwright: Playwright) -> None:
+ browser = playwright.chromium.launch(headless=False)
+ context = browser.new_context()
+ page = context.new_page()
+ page.goto("https://www.tullysgoodtimes.com/menus/")
+
+ # TODO Write code here
+
+ # ---------------------
+ context.close()
+ browser.close()
+
+
+with sync_playwright() as playwright:
+ tullyscraper(playwright)
diff --git a/reflection.md b/reflection.md
new file mode 100644
index 0000000..da4a8ef
--- /dev/null
+++ b/reflection.md
@@ -0,0 +1,25 @@
+# Reflection
+
+Student Name: name
+Sudent Email: email
+
+## Instructions
+
+Reflection is a key activity of learning. It helps you build a strong metacognition, or "understanding of your own learning." A good learner not only "knows what they know", but they "know what they don't know", too. Learning to reflect takes practice, but if your goal is to become a self-directed learner where you can teach yourself things, reflection is imperative.
+
+- Now that you've completed the assignment, share your throughts. What did you learn? What confuses you? Where did you struggle? Where might you need more practice?
+- A good reflection is: **specific as possible**, **uses the terminology of the problem domain** (what was learned in class / through readings), and **is actionable** (you can pursue next steps, or be aided in the pursuit). That last part is what will make you a self-directed learner.
+- Flex your recall muscles. You might have to review class notes / assigned readings to write your reflection and get the terminology correct.
+- Your reflection is for **you**. Yes I make you write them and I read them, but you are merely practicing to become a better self-directed learner. If you read your reflection 1 week later, does what you wrote advance your learning?
+
+Examples:
+
+- **Poor Reflection:** "I don't understand loops."
+**Better Reflection:** "I don't undersand how the while loop exits."
+**Best Reflection:** "I struggle writing the proper exit conditions on a while loop." It's actionable: You can practice this, google it, ask Chat GPT to explain it, etc.
+- **Poor Reflection** "I learned loops."
+**Better Reflection** "I learned how to write while loops and their difference from for loops."
+**Best Reflection** "I learned when to use while vs for loops. While loops are for sentiel-controlled values (waiting for a condition to occur), vs for loops are for iterating over collections of fixed values."
+
+`--- Reflection Below This Line ---`
+
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..c6c04ff
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+playwright
+pandas
\ No newline at end of file
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/helpers.py b/tests/helpers.py
new file mode 100644
index 0000000..9f4a415
--- /dev/null
+++ b/tests/helpers.py
@@ -0,0 +1,8 @@
+import sys
+
+from subprocess import run
+
+def run_python_script(script_path : str, input_text : str) -> str:
+ process = run([sys.executable, script_path], text=True, capture_output=True, input=input_text)
+ output_text = process.stdout.strip()
+ return output_text
diff --git a/tests/pytest.ini b/tests/pytest.ini
new file mode 100644
index 0000000..7d13245
--- /dev/null
+++ b/tests/pytest.ini
@@ -0,0 +1,5 @@
+[pytest]
+log_cli=true
+log_level=DEBUG
+log_format = %(asctime)s %(levelname)s %(message)s
+log_date_format = %Y-%m-%d %H:%M:%S
\ No newline at end of file
diff --git a/tests/test_menuitemextractor.py b/tests/test_menuitemextractor.py
new file mode 100644
index 0000000..0f92bc4
--- /dev/null
+++ b/tests/test_menuitemextractor.py
@@ -0,0 +1,108 @@
+import pytest
+from code.menuitem import MenuItem
+from code.menuitemextractor import clean_scraped_text, clean_price, extract_menu_item
+
+
+TEST_DATA = [
+ '''
+NEW!
+
+Tully Tots
+
+$11.79
+
+Made from scratch with shredded potatoes, cheddar-jack cheese and Romano cheese all rolled up and deep-fried. Served with a spicy cheese sauce.
+ ''',
+
+ '''Super Nachos
+
+$15.49
+GS
+
+Tortilla chips topped with a mix of spicy beef and refried beans, nacho cheese sauce, olives, pico de gallo, jalapeños, scallions and shredded lettuce. Sour cream and salsa on the side. Add guacamole $2.39
+
+ ''',
+ '''Veggie Quesadilla
+
+$11.99
+V
+
+A flour tortilla packed with cheese, tomatoes, jalapeños, black olives and scallions. Served with sour cream and pico de gallo.
+Add chicken $2.99 | Add guacamole $2.39
+''',
+'''Kid's Burger & Fries
+
+$6.99
+'''
+]
+
+UNWANTED = ["NEW", "NEW!", "GS", "V", "P", "S"]
+
+def test_should_pass():
+ print("\nAlways True!")
+ assert True
+
+def test_clean_price():
+ text_expects = [
+ ("$11.79", 11.79),
+ ("$15,000", 15000),
+ ("$.99", .99),
+ ("6.99", 6.99),
+ ("$6", 6)
+ ]
+ for text, expect in text_expects:
+ actual = clean_price(text)
+ print(f"For text {text}, Expect: {expect}, Actual: {actual}")
+ assert expect == actual
+
+
+def test_clean_scraped_text_no_empties():
+ for text in TEST_DATA:
+ cleaned = clean_scraped_text(text)
+ print("CLEANED", cleaned)
+ print("Checking there are no empties in cleaned..")
+ assert len([item for item in cleaned if len(item)==0]) == 0
+
+
+def test_clean_scraped_text_no_unwanted():
+ for text in TEST_DATA:
+ cleaned = clean_scraped_text(text)
+ print("CLEANED", cleaned)
+ for u in UNWANTED:
+ print(f"Checking there are no {u} unwanted items in cleaned")
+ assert u not in cleaned
+
+def test_clean_scraped_text_at_least_2_items():
+ for text in TEST_DATA:
+ cleaned = clean_scraped_text(text)
+ print("CLEANED", cleaned)
+ print("Checking there are at least 2 items in cleaned")
+ assert len(cleaned) >= 2
+
+
+def test_extract_menu_item_expect_type_MenuItem():
+ for text in TEST_DATA:
+ item = extract_menu_item("TEST", text)
+ print(f"Expect: {item} to be a MenuItem type")
+ assert isinstance(item, MenuItem)
+
+def test_extract_menu_item_expect_No_desciption_available():
+ text = TEST_DATA[-1] # this one has no description
+ item = extract_menu_item("TEST", text)
+ print(f"Expect: {item} to be a MenuItem type")
+ assert item.description.lower().startswith("no description available")
+
+def test_extract_menu_item_expect_price_1549():
+ text = TEST_DATA[1] # this one has a price of 15.49
+ item = extract_menu_item("TEST", text)
+ print(f"Expect: 15.49 to be a {item.price}")
+ assert item.price == 15.49
+
+
+
+# IF YOU NEED TO DEBUG A TEST
+# 1. Place a breakpoint on the line below
+# 2. call the function you want to debug below the if statement
+# Run this file with debugging
+if __name__ == "__main__":
+ test_should_pass()
diff --git a/tests/test_tully_scraper_output.py b/tests/test_tully_scraper_output.py
new file mode 100644
index 0000000..9f7706e
--- /dev/null
+++ b/tests/test_tully_scraper_output.py
@@ -0,0 +1,30 @@
+import pytest
+import os
+import pandas as pd
+
+#
+# TODO RUN YOUR SCRAPER BEFORE RUNNING THESE TESTS!
+#
+
+FILE = "cache/tullys_menu.csv"
+
+def test_should_pass():
+ print("\nAlways True!")
+ assert True
+
+def test_tullyscraper_menu_csv_file_exists():
+ print(f"Expect {FILE} to exist!")
+ assert os.path.exists(FILE)
+
+def test_tullyscraper_menu_csv_file_proper_rows_and_cols():
+ df = pd.read_csv(FILE)
+ print("We expect 113 rows and 4 columns")
+ assert df.shape == (113, 4)
+
+
+# IF YOU NEED TO DEBUG A TEST
+# 1. Place a breakpoint on the line below
+# 2. call the function you want to debug below the if statement
+# Run this file with debugging
+if __name__ == "__main__":
+ test_should_pass()