/CityByte

A website which lets you search for cities and lists exciting information about the city.

Primary LanguagePythonMIT LicenseMIT

CityByte Project 2

Test codecov code_size repo_size DOI License: MIT GitHub issues GitHub issues-closed GitHub version Code style: black

Introduction

New and improved! Several new features and bug fixes were implemented to show significant improvement from Project 1.

Below are the new features and improvements we made:

  1. Implemented a wish list/to-go list to save interesting locations so you can come back and look at them later 🔥
  2. Implement Caching to get API results faster 🚀
  3. Created a signup/login page - having an account goes a long way when we add new features that are customized for the user!
  4. Comment Page - you can comment on the place and look at all the other comments that have been posted!
  5. Fixed WeatherApi Bug 🐛
  6. Implemented social media page and support contact information.

Old Project - In Brief

Below is a video of the old project:

image

New Project

Below is a video of the significant improvements we made:

https://drive.google.com/file/d/1sUewnnTpuXX3s8nMnpnR0WZhVM-c8L1a/view?usp=sharing

Old Architecture

1

New Architecture

2

Improvements

Improvements can be seen in the follwing load testing reportsusing the LocustIO:

Before Caching Implementation:

100 concurrent users: Before_cache_100
1000 concurrent users: Before_cache_1000 10000 concurrent users: before_cache_10000

After Caching Implementation:

100 concurrent users: After_cache_100

1000 concurrent users: Afte_cache_1000

10000 concurrent users: after_cache_10000

Results:

  • For 10000 concurrent users, before caching there was failure when the test was performed, but for the caching scenario, the mean response time was 46000 ms.
  • For 1000 concurrent users, before caching there was mean response time of 48000 ms when the test was performed, but for the caching scenario, the mean response time was 10000 ms.

Quick Start

1. Clone the repository:

git clone https://github.com/rohitgeddam/CityByte.git

2. Setup the virtual environment:

python -m venv venv

3. Activate the virtual environment:

On Mac/Linux:    

source venv/bin/activate

On Windows:    

venv\Scripts\activate

4. Install required modules and libraries:

pip install -r requirements.txt

5. Create .env file at ./CityByte using the below template.

    GEODB_X_RAPID_API_KEY=""
    GEODB_X_RAPID_API_HOST=""
    AMADEUS_API_KEY=""
    AMADEUS_API_SECRET_KEY=""
    UNSPLASH_API_KEY=""
    FOURSQUARE_API_KEY=""
    WEATHER_BIT_X_RAPID_API_KEY=""
    WEATHER_BIT_X_RAPID_API_HOST=""

Create an account in the below websites to Fetch API keys and use them in the above template.

6. Set-up REDIS

  • Follow the instructions in Getting Started to Install Redis in your local environment.
  • Start the Redis Server: Open a terminal and run the following command:
   redis-server
  • Open another terminal to start the REDIS CLI:
   redis-cli

Now, you can run the application.

7. Run the application:

python manage.py migrate
python manage.py runserver

After adding another field to Model

Django's way of propagating changes you make to your models (adding a field, deleting a model, etc.) into your database schema.

python manage.py makemigrations
python manage.py migrate

Automatic tools - GitHub Actions

We use GitHub actions to automate tasks of linting, code coverage, build, tests, and security checks. The codes that perform these actions are stored as .yml files in the .github/workflows directory. The GitHub actions are triggered whenever something is pushed (or pulled) into the remote repository. The results of these automated tasks are shown as badges at the top of this README.md file.

Unit tests:

Unit test are performed everytime there is a push or pull into the repository. They are present in /search/tests.py.

Code Coverage:

Code Coverage is an important metric that allows us to understand how much of the codebase is tested. django.yml performs this task. For more information about Code Coverage, please visit this link.

Flake8 - Code Linting:

We are using Flake8 for linting and syntax checking, and it is performed by Linting.yml. For more information about Flake8, please visit this link. Use flake8 before you push code to GitHub.
Config file present in .flake8.

flake8 <directory>

Black - Code Formatter

We are using the Black code formatter to format our code before pushing it to GitHub. For more information about Black, please visit this link. Config file in pyproject.toml.

Run the line below everytime you push to GitHub.

black --line-length 120 <filename>

If you prefer using Black in VSCode, you can add the below settings in your vscode settings:

{
    "python.formatting.provider": "black",
    "python.formatting.blackArgs": ["--line-length", "120"],
    "python.linting.enabled": true
}

Pre Commit Hooks for Black Code formatting and Flake8 Linting

  • run pre-commit install
  • Now everytime you commit, Black and Flake8 will run automatically and will not allow you to push if the code standards are not met.

Screenshot 2022-10-07 at 11 35 40 AM

Image from Ji Miranda.

License

Distributed under the MIT License. See LICENSE for more information

Team Members

  1. Rohit Geddam: sgeddam2@ncsu.edu
  2. Arun Kumar Ramesh - arames25@ncsu.edu
  3. Kiron Jayesh - kjayesh@ncsu.edu
  4. Sai Krishna Teja Varma - smanthe@ncsu.edu
  5. Shandler Mason - samason4@ncsu.edu

Support

Concerns with the software? Please get in touch with us via one of the methods below. We are delighted to address any queries you may have about the program.

Please contact us if you experience any problems with the program, such as problems with joining up, logging in, or any other functions.

          

CityByte Project 1

DOI Django CI codecov

animated

Introduction

Moving to a new location can be a daunting endeavor, especially when you have the entire world to choose from. Finding a new home from scratch while prioritizing certain aspects might be very challenging given the variety of nations and cities. However, with the advancement of technology, information from earlier times can now be leveraged to offer a number of vital insights about a certain location. Our project succeeds in one of those objectives. We seek to present that information in our project because there are many other elements that are taken into consideration when choosing a place to reside, such as weather, temperature, entertainment options, landmark locations, education, and many more. The project is totally created using a variety of technologies, including some of the accessible APIs that are utilized to fetch real-time data.

Although this project is still in its early phases of development, it can be expanded up even further by including multiple features that can benefit society in a variety of different ways. This article offers a critical viewpoint that users can use to comprehend the project, adopt it as open source software, and add further features before releasing it to the market. The document also serves as a starting point for the project and helps developers understand the code.

The technologies listed below were used to build the entire project, and it is advised that the group of developers who take on this project in the future retain these tools on hand:

  • Python3
  • Django
  • Pytest
  • HTML
  • CSS
  • JavaScript
  • BootStrap

Although we have used HTML, CSS and Bootstrap for the frontend logic the user can use any technologies and combine it with backend such as Angular, React etc.

Result

The below screenshots give the glance of the working of our project:

Deployment:

This project is deployed on AWS and is live at http://3.88.233.194:8000/

Future Scope

  • Caching results from API using Redis in order to improve the performance.
  • Addition of search bar with category filter, that will help the user to search based on his/ her requirements.
  • To run multiple API requests simultaneously, multithreading will be used.

Team Members

  • Nirav Shah - nshah28
  • Vishwa Gandhi - vgandhi
  • Pradyumna Khawas - ppkhawas
  • Vrushanki Patel - vpatel25
  • Priya Saroj - pbsaroj