GithubHelp home page GithubHelp logo

data's People

Contributors

dependabot[bot] avatar lionralfs avatar noxeo2k avatar tomt95 avatar

Watchers

 avatar

Forkers

lionralfs

data's Issues

Implement new "averages" endpoint

For the frontend, we need an endpoint which gives us an average for an entire day/hour(?) per sensor.

Ideally, the frontend requests the data for a single day/hour and the endpoint returns a list of sensors which include the average measurements for that sensor grouped into 5min intervals.

For example, the result could be a map <sensor_id> --> list of 288 values (1440 minutes per day / 5 minutes = 288)

{
  "92": [ { "p1": 4.2, "p2": 3.5 }, { "p1": 5.2, "p2": 3.3 }, "286 more...." ]
}

Include "continuous" field in /bySensor endpoint

We need to add a continuous field (boolean) to the response of the /bySensor endpoint.
Since the response is currently just a JSON array, we should change it to an object which could look like this (where the measurements field is the array of the current response):

{
  "continuous": true,
  "measurements": []
}

"Continuous" can be calculated by looking 7 days into the past from the requested timestamp (for the requested sensor) and checking whether we always have a measurement for every 1 hour step. If there hasn't been a measurement +-3 hours a timestamp, the result isn't continuous anymore.

Check next/previous day

Currently, the /bySensor endpoint returns all measurements +- 10 minutes for a certain timestamp. This doesn't respect the cases where the timestamp is in the first/last 10 minutes of a day yet.

Since the measurements are grouped by day and sensor in the database, we would need to include an additional query in these cases.

See the the comment in

// TODO: check previous day
// System.out.println(((long) timestamp * 1000) - calendar.getTimeInMillis() <
// threshold * 1000);
// TODO: check next day

Checking the cases should be as simple as:

if (((long) timestamp * 1000) - calendar.getTimeInMillis() < threshold * 1000) {
  // we need to query the previous day
}

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.