Code Monkey home page Code Monkey logo

store-monitoring's Introduction

Store Monitoring

  • This API is for generating reports for stores based on logs.
  • The Report contains the uptime and downtime for the last hour, last day and the last week. It is generated in the form of a CSV file.
  • First, I converted the given CSV files to an SQLite3 database. Before storing in the database, I sorted the 'polls' database by the store_id first and then in non-increasing order of timestamps, for easy calculation of uptime and downtime.
  • Since the data in the given datasets are recorded in 2023, I have used the last timestamp a poll was taken, as the reference time.
  • Since most of the timestamps are at a difference of 1 hour(on an average), I have extrapolated it by considering the hour before that timestamp. In other words, I have truncated the timestamp to the previous hour. It is mentioned in the GenerateReport() function. Please refer to that for further clarity.
  • To calculate the uptime or downtime, I have taken the difference between the current timestamp and the next timestamp(which is earlier than the current one since the values are sorted in non-increasing order). I have also applied the above extrapolation logic to calculate the uptime/downtime when the current status and the next status are not the same.

I still have to work on a few corner cases, which are giving undesired reports for some stores.

This implementation uses maps for storing the data in the database. It is not space-efficient, but it takes only about a second or two to complete the report generation. But performing all the operations directly on the database is space-efficient but it takes around 29 minutes(I tried that as well) to complete the report generation. Therefore I have not done that implementation.

store-monitoring's People

Contributors

rjsanghamitra avatar

Watchers

 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.