base-camp-luftdaten / data Goto Github PK
View Code? Open in Web Editor NEWData gathering for https://github.com/base-camp-luftdaten
Data gathering for https://github.com/base-camp-luftdaten
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...." ]
}
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.
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
Checking the cases should be as simple as:
if (((long) timestamp * 1000) - calendar.getTimeInMillis() < threshold * 1000) {
// we need to query the previous day
}
We need an endpoint to read all available sensors. A sensor is uniquely identified by ID & Long/Lat
For example: /api/measurements/bySensor?sensor=17287×tamp=1560034800
which would return all measurements by that specific sensor -10min and +10min from the 1560034800 timestamp which represents Saturday, 08-Jun-19 23:00:00 UTC in epoch seconds.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.