/tangelo-challenge

Primary LanguagePythonMIT LicenseMIT

Tangelo Challenge

Technical tests done for the company Tangelo.

Built With

This project is built in Python and uses the following libraries:

Getting Started

This is an application that consumes a service exposed by Rest Countries, then filters the information according to the requested requirements. It uses Pandas DataFrame to manipulate the information in a proper way, calculates time measurements and finally connects to a database and records the execution times. If the database or the table does not exist, it is created, additionally the app saves the data table in the DB in JSON format.

Below is the design of the solution:

Untitled Diagram drawio (1)

Improvements

SHA1 encryption is not recommended for new designs, even in its own page it says so, I was investigating new methods and I found Fernet (symmetric encryption): Fernet guarantees that an encrypted message cannot be manipulated or read without the key.

With this update, the board looks like this:

image

Prerequisites

The program needs git to clone it and python to run it.

Installation

Installation is really simple

  1. Clone the repository
    git clone https://github.com/jsdnlb/tangelo-challenge
    Enter the folder
    cd tangelo-challenge/
  2. Create the virtual environment
    python3 -m venv venv
    And then active the virtual environment
    source venv/bin/activate
  3. Build the application, this was implemented to do the unit tests.
    pip install -e .
  4. Install the dependencies requirements.txt
    pip install -r requirements.txt

Usage

To run the application you only have to run the file as follows:

  python3 app/bin/run.py

The answer will be similar to the following, depending on the quality of your internet.

test3 (online-video-cutter com)

This is an example of the data saved by the app using SQLite and visualized in Visual Studio Code with the SQLite Viewer extension.

image

Unit test

To use the unit tests you only have to run the files that are in the test folder, for example I will show the tests for encryption:

# SHA1 method:
python3 app/test/test_encrypt_sha1.py
# Fernet method:
python3 app/test/test_encrypt_fernet.py 

This is the result:

image

License

Distributed under the MIT License. See LICENSE.txt for more information.