noi-techpark / bdp-core

Open Data Hub / Timeseries Core
https://opendatahub.com
Other
9 stars 4 forks source link

As an ODH user I would like to get the type "free" associated to parking data #183

Closed rcavaliere closed 3 years ago

rcavaliere commented 3 years ago

This should be implemented through a simple automatic elaboration (capacity - occupied). The new type should be stored in the DB and made available through the Ninja API

bertolla commented 3 years ago

I started with this but it gave me to think that it will double the volume of parking data set, but with no real benefits. Shouldn't we make elaborations only if they really make sense and maybe are a little bit more complicated ??? Furthermore, the current API might not support this, but in the future it might be easily done through postgres commands, which can be integrated in the API. Which means no additional buisness logic to do simple calculations, like averages,sums,max,mins. And low risks of new bugs and increase in data volume.

rcavaliere commented 3 years ago

@bertolla this data type is the most important one for parking, and actually don't provide it. In case we can think to not have "occupied" anymore, and to substitute this data type with the type "free". In case can we do this at a Data Collector level?

bertolla commented 3 years ago

Substitution is not really working well since there it would mean that existing apps wouldn't get correct data anymore. I will implement it as an elaboration, but we'll need to find better solution for this.

bertolla commented 3 years ago

A lambda function is currently inserting history data on test db and will update every 5 minutes

rcavaliere commented 3 years ago

@bertolla I am still not sure if it is working correctly now in the testing environment. I see the type and some values calculated, but I am not sure about the calculation. Is this implementation still in progress or do you expect that everything should work properly already now?

bertolla commented 3 years ago

Can you be give me an example. I just checked trying a random parking lot and it seems to work as intended: https://analytics.opendatahub.testingmachine.eu/#%7B%22active_tab%22:0,%22height%22:%22400px%22,%22auto_refresh%22:false,%22scale%22:%7B%22from%22:1606604400000,%22to%22:1607209200000%7D,%22graphs%22:%5B%7B%22category%22:%22Parking%22,%22station%22:%22103%22,%22station_name%22:%22P03%20-%20Piazza%20Walther%22,%22data_type%22:%22free%22,%22unit%22:%22%22,%22period%22:%22300%22,%22yaxis%22:1,%22color%22:0%7D,%7B%22category%22:%22Parking%22,%22station%22:%22103%22,%22station_name%22:%22P03%20-%20Piazza%20Walther%22,%22data_type%22:%22occupied%22,%22unit%22:%22%22,%22period%22:%22300%22,%22yaxis%22:1,%22color%22:1%7D%5D%7D