aqualinkorg / aqualink-app

Aqualink.org Ocean Monitoring Application
MIT License
34 stars 12 forks source link

Possible conflict of timeseries data #495

Open avalmas-programize opened 3 years ago

avalmas-programize commented 3 years ago

Currently the time-series API is implemented as follows: GET /time-series/reefs/:reefId/pois/:poiId : Get all poi data plus all reef data (poi = poiId or NULL) GET /time-series/reefs/:reefId : Get all reef data (poi is NULL)

However the above assumes that there would be no conflicts between reef specific sensor and POI specific sensor, i.e. there won't exist two sensors, one on the reef and one on a POI of the reef, that will log the same metric under the same source For example two spotters, one logging reef specific data and one logging POI specific data of the same reef.

In a case of the conflict data would get scrabbled as the implementation will group data of different sensors into one stream of data.

avalmas-programize commented 3 years ago

Right now we have the following sources:

At the moment we have that noaa, gfs and spotter data are strictly reef data (do not have poiId specified) and hobo data are poi data. However this is not restricted by anything. So if, in the future, more than one spotter can exist in the same reef (as a reef specific and a poi specific) the poi data endpoint (since it is fetching both specified poi and reef data) will mix the data from the two spotters together. Right now we can add an extra layer of grouping in the spotter source based on the id of the spotter which will solve the conflict. For example:

{
  "spotter": {
    "SPOT-4321": { "metric": ...data },
    "SPOT-1234": { "metric": ...data }
  }
}