Prize Bond Drawer - The Lottery Managment System 🤑 💶 💰
Tags: azuretrialhack, flask, python, postgres
Published: 2022-03-08 15:08:30


## Overview of My Submission

### Background 🕵️‍♂️
I always wanted to have my lottery management web application since all of the existing ones are either too bloated or aren't that user-friendly. But I was just delaying the project because it wasn't the need of the hour. Fortunately, I wasn't able to further procrastinate my idea as Dev.to announced the Microsoft Azure Hackathon, and I immediately started working on it.

### Project Description 📋
Prize Bond Draw is a web application for managing prize bonds which are a unique method of investment that are essentially lotteries backed by the government. This project enables the end-user of the application to effectively manage their prize bonds and ease the hassle of manually searching their serials when the result is announced. 

### Technical Overview 🧑‍💻
1. It is a full-stack web application made with Flask Microframework.
2. For persistent data storage, I have used the Postgresql database.
3. The User Interface is built with Html/CSS and Bootstrap V5.0.
4. Supports role-based mechanism to authorize the users:
 - `Admin` Can add denominations and their respective prizes, update the winning list and announce the notifications to all the users. 
 - `User` Can store their bond serials and check the results of either all of their serials or by entering any particular serial.
5. For CI/CD 🚀 I have used [Github Actions](https://github.com/features/actions) to deploy automatically to Azure VM. Check out the [workflow script](https://github.com/zain2323/prizebond-draw/blob/main/.github/workflows/workflow_deploy.yml) to know more about it.

### Features ✨
✅ The application supports all CRUD operations.
✅ Easy to use and user-friendly.
✅ Keep all the users updated about the latest result announcements with the notifications 🔔.
✅ Supports email confirmation and password resetting.
✅ All of the user-related data is saved securely 🔐 in the Postgres database.
✅  The application is deployed on Microsoft Azure so you can trust the security 💯.

### The Most Important Feature 🤩
The most important feature that I'm proud of 😎 is the text extraction from the bond picture. For that, I have used Microsoft Azure Optical Character Recognition API. Thus enabling the user to add the serial just by uploading the picture of the bond. See Appendix for some sample bonds so that you can try yourself 🥰.

### Dashboards
As stated previously, there are two distinct roles the web application supports. So there are two dashboards one for the admin of the application, and the other for the user.

#### The Admin Dashboard 👨‍🔧

* To view the admin dashboard login with the following credentials.
  - **Email:** admin@admin.com
  - **Password:** testing123
* The admin is responsible for uploading the latest results, announcing the notifications, adding denominations and their respective prizes.
* The admin has the privilege to access all the data including serials, denominations, prizes, and of users too but is restricted to modify any of the user-related data.
* Any of the data can be searched and filtered which is a must-have feature in today's ever-growing data.
* Winners lists usually contain many records and it would be too hectic to upload them manually so the admin can upload the list directly from the file.
* One thing to keep in mind while uploading the data from the file is that the application requires the file to be formatted in a certain way. See appendix for a demo file.

#### The User Dashboard 👨‍🦰
* To view the user dashboard, create an account first.
* Be sure not to use any invalid email as you will need to confirm your email.
* The recommended way is to get a temporary email from [temp-mail](https://temp-mail.org/en/) and don't use your personal email as anyone can access the admin account and can see your email.
* I have created some demo accounts for testing so you can use those for testing. See appendix for more details. 
* The user can add or remove their serials and check their results to see if they have won any prize.
* Users can also change their name, email and password if they want to.

### Submission Category: 
Computing Captains

### Azure Services Used
1. Azure Virtual Machine
2. Azure Optical Character Recognition Api

### Azure Resources

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m0u29biss2xb23tjus5g.png)

### Link to Code on GitHub

{% embed https://github.com/zain2323/prizebond-draw %}

### Demo
Want to test every feature yourself? Yeah sure, definitely check it out and don't forget to give your honest review.
👉 [Prize Bond Draw](http://prizebond-draw.centralindia.cloudapp.azure.com/)

### Admin Panel Screenshots 🥳 🔥

* **Denominations** 💵

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k3jsx621zyzhunm5d1iq.png)

* **Prizes** 🎁

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ys0fi9p74y8ms9aorfb9.png)

* **Winners List** 📜

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6jaueriicjg0hhevfv74.png)

* **Adding Winner's Records Through File** 📑

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/shx0csqfm0pe2a5wt57f.png)

* **Sending Out Notifications** 📯

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rwe5pg4b5ztg1027wcr4.png)

### User Panel Screenshots 🥳 🔥

* **Home Screen** 🏠

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ce46mslr4hsnm343fg3m.png)

* **Account Info** ℹ️

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3dmwegx4gooxka42pob4.png)

* **Result Window** 🎀📦

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/472mzugagiui5pdi1zje.png)

### Appendix

✅ Some pre-created accounts for testing:

| S.No          | Email                | Password   |
| ------------- |:--------------------:| ----------:|
| 1             | admin@admin.com      | testing123 |
| 2             | guvejyli@ryteto.me   | testing123 |
| 3             | kidiy79527@xindax.com| testing123 |

✅ Check out this 👉 [link](https://github.com/zain2323/prizebond-draw/tree/main/test_data/sample_winner_data) for some pre-made test data files for updating the winners list. Only this format works while updating the winners list. Use of any other format might not work.
✅ Check out this 👉 [link](https://github.com/zain2323/prizebond-draw/tree/main/test_data/sample_bonds) to get some sample bonds.

I hope you liked my project 🤗. If you have any kinds of questions or opinions then please don't hesitate to post them in the comments section.

Till then Good Bye. 🙋‍♂️🙋