Spa Booking is a terminal application designed to simulate the process of booking specific spa services. It offers additional features such as booking cancellations, checking available times for a particular service and date, and accessing information about various services.
The primary objective of this project is to enhance Python skills. Additionally, it involves deploying on a Heroku server, creating unit tests with the Python unittest library, and implementing object-oriented programming principles.
- User Experience UX
- Flowchart
- Structure
- Features
- Testing
- Bugs
- Technologies used
- Deploying
- How to Clone
- Credits
- Acknowledgements
Table of contents generated with markdown-toc
This application targets a narrow audience as it lacks a graphical user interface, which could complicate its usability. The audience primarily consists of programmers or companies seeking to integrate a booking system for their products.
- As a user, I want to be able to highlight text in different colors.
- As a user, I want information to be separated by corresponding groups using different symbols or spaces.
- As a user, I want to receive notifications or messages for my actions.
The aim of the project is to improve Python skills while also gaining experience in deploying applications on a Heroku server, creating comprehensive unit tests using the Python unittest library, and applying object-oriented programming principles.
The flowchart was created using the Draw.io software.
The application structure has four main branches:
- Sheet manager - responsible for handling spreadsheet data.
- Flow manager - responsible for flows of application.
- Validators - responsible for validating user inputs.
- Print manager - responsible for printing data to user.
The SpaSheet
class manages the spreadsheet received from the API. It creates a sheet attribute that refers to the actual sheet for the API and creates attributes that refer to worksheet objects.
The Spa Booking application comprises four flows (BookingFlow
, CancelFlow
, AvailabilityFlow
, ServiceInfoFlow
). Each flow corresponds to its own class, with each class inheriting from the basic class BasicFlow
. This Object-Oriented Programming (OOP) approach enhances the application's flexibility and expandability, while also facilitating adherence to the Don't Repeat Yourself (DRY) principle.
All flows implement run_flow()
method. The method runs set of methods, one by one, to complete the work of a flow.
The validators is place in validators.py
file. The file has all validators to validate user input.
Ordinarily a validator passed to input handler()
function. The function call the validator when user pass input.
To manage printings I created PrintMixin
class. The class uses rich
library to add styles for output and implements methods to print commonly used cases
Each feature include user data validation.
Allow user to take one option from list.
Allow user to confirm some action.
Allow user to input date for particular service to get schedule or information about the service.
Suggest available time for booking and allow user to choose time from list.
Get user credentials like name of phone number.
Allow user to change data for booking
User can book service on particular date and time.
User can cancel his bookings by passing name and phone number which he used when book a service.
User can check all available times for certain data and service
User can get information about a service.
Expectations | Realisation |
---|---|
As a user | |
I want to highlight text in different colors. | The application allows users to highlight text in various colors, providing a visual emphasis on important information or for categorizing content. |
I want information to be separated by corresponding groups. | Information within the application is separated into distinct groups using different symbols or spaces, ensuring clarity and organization, and making it easier for users to understand and navigate. |
I want to receive notifications or messages for my actions. | Users receive notifications or messages for their actions within the application, ensuring they stay informed about relevant updates or events, providing feedback and guidance throughout their interaction with the system. |
Unit testing was performed by using built-in python library unittest. To run tests navigate to root directory of the project and use commands:
Windows:
python -m unittest discover tests
Linux, Unix:
python3 -m unittest discover tests
Unittest coverage was checked with coverage
python library.
To check the test code coverage need to user two commands.
-
This command run all tests under the
coverage
library:coverage run -m unittest
-
This command show report of coverage.
coverage report
PEP8 validation was performed by using Python linter. To follow PEP8 during development I used VSCode extensions such as Ruff and Pylance.
Check PEP8 validation here
-
The "validate_space_separated_integers()" don't intercept input with multiple the same integers closed issue.
-
Incorrect canceletion, when multiple bookings selected closed issue.
-
Invalid search of bookings for cancellation closed issue.
The Spa booking application doesn't have unfixed bugs.
- Python - is an interpreted, object-oriented, high-level programming language with dynamic semantics.
- rich - python library to add color and style to terminal output.
- unittest - python built-in library to create unittests.
- coverage - python library to check test coverage
- freezegun - python library that helps mock datetime module.
- gspread - python interface for working with Google Sheets.
- google-auth - python library for authentication to Google APIs.
- GitHub - An online host for web and software development projects. Used to store the repository and deploy the finished website.
- Git - Software for tracking changes to files. Used with GitPod to add, commit and push code changes to the repository on GitHub.
- Heroku to deploy and host the live app.
- Google Spreadsheets API to store data.
- Google Drive to write an app to process requests to Spreadsheets.
- draw.io - for creating flowcharts.
The application was hosted using Heroku, a cloud platform designed for building, deploying, and managing apps within containers.
Deployment Steps:
- Fork or clone this repository.
- Log in to your Heroku account.
- Create a new Heroku app.
- Navigate to the
Settings
tab. - Set up environmental variables in the
config vars
section. In this case, it's CREDS(credentials of Google service account) and PORT(value 8000). - Configure
buildpacks
in the following order:python
andNodeJS
. - Set up GitHub integration, selecting the
main
branch in theDeploy
tab. - Click on
Deploy branch
to finalize the deployment process.
- Log into your account on GitHub
- Go to the repository of this project Spa booking
- Click on the code button, and copy your preferred clone link.
- Open the terminal in your code editor and change the current working directory to the location you want to use for the cloned directory.
- Type
git clone
into the terminal, paste the link you copied in step 3 and press enter.
-
mocking objects for unittesting
-
check test's coverage with python library coverage
-
mocking datetime.date.today() function with freezegun python library
-
phone number validation was performed by using phonenumbers library.
I want to convey my immense gratitude to my mentor, Luke Buchanan, for pinpointing my mistakes and providing advice on how to rectify them. Special thanks to my friends who assisted in testing the application, and to the Slack community, always ready to offer valuable tips at any time.