Code Monkey home page Code Monkey logo

django_celery_3's Introduction

Business Monitoring| Django + Celery

Deployed Website:

https://djangocelery2-production.up.railway.app/

Environment Variables:

DEBUG SECRET_KEY DJANGO_ALLOWED_HOSTS CELERY_BROKER CELERY_BACKEND DB_HOST DB_PASSWORD DB_PORT

Two API endpoints

1. /trigger_report endpoint that will trigger report generation from the data provided (stored in DB)
    1. No input 
    2. Output - report_id (random string) 
    3. report_id will be used for polling the status of report completion
2. /get_report endpoint that will return the status of the report or the csv
    1. Input - report_id
    2. Output
        - if report generation is not complete, return "Pending" as the output
        - if report generation is complete, return “Complete” along with the CSV file 

Input Data Format:

We have 3 sources of data

  1. Have data about whether the store was active or not in a CSV.
    The CSV has 3 columns (store_id, timestamp_utc, status) where status is active or inactive.
    All timestamps are in UTC

  2. We have the business hours of all the stores - schema of this data is store_id, dayOfWeek(0=Monday, 6=Sunday), start_time_local, end_time_local

    1. These times are in the local time zone
    2. If data is missing for a store, assume it is open 24*7
  3. Timezone for the stores - schema is store_id, timezone_str

    1. If data is missing for a store, assume it is America/Chicago

Output Data Format:

A csv report that has the following schema

store_id, uptime_last_hour(in minutes), uptime_last_day(in hours), update_last_week(in hours), downtime_last_hour(in minutes), downtime_last_day(in hours), downtime_last_week(in hours)

  1. Uptime and downtime only include observations within business hours.
  2. Extrapolated uptime and downtime based on the periodic polls available, to the entire time interval.
    1. eg, business hours for a store are 9 AM to 12 PM on Monday
      1. only have 2 observations for this store on a particular date (Monday) in our data at 10:14 AM and 11:15 AM
      2. need to fill the entire business hours interval with uptime and downtime from these 2 observations based on basic interpolation logic

django_celery_3's People

Contributors

paramkr2 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.