CodeForAfrica / sensors.AFRICA-api

The sensors.AFRICA API receiving, storing, and processing data received from sensors across the continentent. Accessible at https://api.sensors.africa/
https://api.sensors.africa/
18 stars 7 forks source link

Fix/node list access #140

Closed thepsalmist closed 1 week ago

thepsalmist commented 1 week ago

Description

This PR introduces the following changes to the list_nodes action on the NodesView

  1. Allow non-authenticated access to fetch nodes, e.g v2.map.aq.sensors
  2. Optimize to fetch only LastActiveNodes within the last 1 hour and make joins to fetch nodes and locations. We need to only display statistics within the last 5 min range, and we post new data every 3-5 mins

PS: As per @gideonmaina the ideal time frame to tell an active node is that which has transmitted data within last 1 year (Old sensors, last updated in 2017,2018 still appear in DB & yet to be decommissioned)

Type of change

Checklist: