Giter VIP home page Giter VIP logo

most-active-cookie's Introduction

most-active-cookie

pytest_run workflow

Command line program to process log file and return the most active cookie

Project Spec

  • Cookie log file format - csv
  • Define the most active cookie as one seen in the log the most times during a given day

Assumptions:

  • If multiple cookies meet criteria, return all of them on separate lines
  • -d parameter takes date in UTC time zone
  • You have enough memory to store the contents of the whole file
  • Cookies in the log file are sorted by timestamp (most recent occurrence is first line of the file)

Run Steps

Clone Repository:

$ git clone https://github.com/aamijar/most-active-cookie.git

Quick Run:

$ python3 most_active_cookie.py cookie_log.csv -d 2018-12-09

Executable and Run:

$ chmod +x most_active_cookie
$ ./most_active_cookie cookie_log.csv -d 2018-12-09

Environment

Python3 + Pytest

Virtual Environment [Optional]:

Ex: Miniconda

$ conda create -n cookie python
$ conda activate cookie

Install Pytest via pip:

$ pip install pytest

Save environment:

$ conda env export > environment.yml
$ pip freeze > requirements.txt

Testing

At root of project use pytest

$ python3 -m pytest

Project Structure

  • /cookie - datatypes to hold cookie[s] and find most active
  • /parsing
    • read cli arguments and read log file lines
    • filter log file content based on cli arguments (ex. UTC Date) using binary search
  • /timeutil - helper functions to determine date and time from UTC format
  • /testing - pytest based tests to validate program functions

most-active-cookie's People

Contributors

aamijar avatar

Watchers

James Cloos avatar  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.