CityScope / CS_Urban_Indicators

Scripts for getting urban data and building urban indicators. A module for computing urban indicators in response to real-time CityScope inputs.
GNU General Public License v3.0
7 stars 4 forks source link

Aggregate indicators need to get latest value from indicator objects #17

Closed doorleyr closed 4 years ago

doorleyr commented 4 years ago

We have both regular indicators and aggregate indicators (which are calculated by aggregating some of the regular indicators). For example the Social Well Being Indicator aggregates values from the proximity indicator as well as several other indicators.

The way I've done this for now is that each indicator saves its indicator values as an attribute on each update. eg.

indicator.return_indicator(): .... self.value_indicators=list_of_computed_indicators return self.value_indicators

Then the aggregate indicator can access the saved values of the other indicators in order to update itself.

@crisjf Maybe there's a better way of doing this. Like maybe the handler is already storing the latest indicator values and the aggregate indicator should just ask it for them? Or if the way I'm currently doing it seems ok, we just need to update the innovation indicator to also save it's last state to self.value_indicators

crisjf commented 4 years ago

I think it makes sense to have the AggregateIndicator class in the toolbox. Let me work on this and see if I can make it more intuitive.

If I understand correctly, we want to avoid calculating each indicator multiple times. Correct?

I'll make sure the Handler class treats compositive indicators differently.

crisjf commented 4 years ago

@doorleyr check the documentation in the README under Custom Composite indicator

doorleyr commented 4 years ago

Thanks. This looks great but I cant test right now as cityIO is down and this method requires creating a Handler. I'll test it once cityIO is back up.