This is a prototype designed to showcase the functionalities and interactions of the different modules involved in the application. The web-app can be found here.
Here are installation/set-up instructions for Mac OS X and other UNIX-based operating systems.
-
Make sure python is installed on your machine. You must use python3 in your virtual environment in order to successfully run the scripts. MacOS comes with python installed. In order to check the version of your python, type
python --version
If you're not currently on Python 3.6.4, upgrade with the following command:
brew install python3 && cp /usr/local/bin/python3 /usr/local/bin/python
-
Install pip with
sudo easy_install pip
-
Install and create a virtual environment. This will allow you to execute any script and locally host the web-app without having to worry about software dependencies.
The following lines of code should set up a virtualenv named vip-venv in your root directory.
cd ~/ pip install virtualenv
Now we'll get the current version of the code on our local machine. Use Github to maintain version control amongst developers, and to create features without breaking existing code. Create a folder for the project in your root directory and clone the repository in that folder
cd ~/
mkdir VIP && cd VIP
git clone https://github.com/carllcox/VIP/
Create an account on Heroku, and ask Carl to be added to the project as a collaborator.
Create an account on Firebase, and ask Carl to be added to the project as a collaborator.
In order to start developing, the virtual environment needs all necessary dependencies installed, so that your local machine can compile and run the web-app on your localhost.
- Create and activate your virtual environment
cd ~/ virtualenv vip-venv source ./vip-venv/bin/activate
- Navigate into your VIP folder and install the specified packages
cd ~/VIP pip install -r VIP/requirements.txt
Here's a description of our tech stack and documentation/tutorials for its elements. Use these for reference - it's easier to learn while doing!
The web-app uses javascript/HTML/CSS for client-side development with Bootstrap for its front-end framework, and python for server-side development with Flask as its micro web framework. It utilizes Firebase, Google's JSON-based NoSQL database, as its data store. The application is deployed on a virtual machine hosted by Heroku.
Firebase: Firebase is the NoSQL database that we use for our project. All data is stored in JSON format, and can be viewed in firebase's console.
Heroku: Heroku is a cloud platform that allows us to build, run, and operate the application on the cloud. This means we can access the web-app at https://vip-ipcrowd.herokuapp.com/ without having to dedicate a laptop to constantly run the code. Heroku packages all the application's dependencies into one state and then deploys it onto their cloud platform.
Make sure that when you're working on the project, you do the following steps in order. This will ensure that we avoid breaking the code or running into merge errors.
Once you've decided on the feature/change to develop -
- Pull latest version of the code from Git
git pull
- Create a new branch for your feature/change and navigate into it
git checkout -b branch-name
- Activate the virtual environment in order to prepare for development.
Sometimes you might need to update the packages in your virtual environment in order to reflect code changes in git. If this is the case, install packages from the requirements file again
cd ~/ source ./vip-venv/bin/activate
pip install -r VIP/requirements.txt
- Develop the feature and test it on your local machine. You can look at your changes by navigating to the project folder and running Flask on terminal.
Copy the localhost URL from the bash output and paste it on your browser to see changes. The bash output will look something like this:
cd ~/VIP python main.py
Running on http://127.0.0.1:5000/
- Once you're ready to put your changes up on git, commit your changes to the branch.
git commit -a -m "i just added a new feature"
- Merge the branch back to master.
git checkout master git merge branch-name
- Remember to deactivate your virtual environment so that you restrict its usage (and the packages you will install on your computer) to the scope of this project. Simply type
deactivate
- Build and deploy the application on heroku so that your changes reflect on the version available by URL.
I've already briefly described the architecture before, but we use Flask as the web framework and most of the front-end development is still in basic js/HTML/CSS. Most back-end and modular development will occur in python since it offers many packages for image and data analysis. Here's an image of how the modules interact with each other:
Here's how the cloud and database interfaces with the web-application.
Here's an explanation of how the code works (or at least how it works in its current state) -
i haven't done this part yet :) ;)