Git Product home page Git Product logo

test-task-wifimap's Introduction

Test task for WifiMap

Installation (Linux)

  • Clone the repository and navigate there.
  • (optional) Create a virtual environment and activate it:
    python3 -m venv env
    source env/bin/activate
  • Install the required packages:
    pip install -r requirements/base.txt

Run the tests with unittest:

python3 -m unittest

Quickstart

Run the analysis using analysis.py script:

user_id="1118"
python src/analysis.py \
    $user_id  \
    conns.csv  \
    hotspots.csv  \
    users.csv  \
    --loglevel=info

For usage, check out the docs:

python src/analysis.py -h

Flask app

There is a simple Flask application that mirrors the functionality of the script. It is ok for demo purposes, but is rough.

Setup

To set up the app, create the data/ folder inside the project root directory, then copy CSV files with names conns.csv, hotspots.csv, users.csv inside this newly created folder:

mkdir data
cp ${somedir}/conns_test.csv data/conns.csv
cp ${somedir}/hotspots_test.csv data/hotspots.csv
cp ${somedir}/users_test.csv data/users.csv

Note that the names must match - CSV imports are hard-coded inside the db.py module.

The final layout of the root folder should look like so:

data/
    conns.csv
    hotspots.csv
    users.csv
requirements/
src/
...

Run the Flask development server:

flask --app src/app --debug run

API

There are 2 URL endpoints of interest:

  • /users/<user_id>/hotspots provides the counts of hotspots for a particular user.
    • Accepts location, since, lower, upper query args.
  • /users/<user_id>/hotspots/unique_connections provides the counts of unique connections to user's hotspots.
    • Accepts since, min_unique_conns query args.

Both are controlled through query parameters.

test-task-wifimap's People

Contributors

atsysin avatar

Watchers

Aleksei Tcysin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.