focusconsulting / housing-insights

Bringing open data to affordable housing decision makers in Washington DC. A D3/Javascript based website to visualize data related to affordable housing in Washington DC. Data processing with Python.
http://housinginsights.org
MIT License
59 stars 110 forks source link

Refactor `_populate_zone_facts` to be cleaner #563

Open NealHumphrey opened 7 years ago

NealHumphrey commented 7 years ago

The _populate_zone_facts method and its related methods were carried over from the API, which needed to calculate specific zone information on demand using user inputs. Now we are calculating all the zone_facts ahead of time and caching them in the zone_facts table. As such, a lot of the structure that was needed for an on-demand calculation is no longer as understandable and is more complicated than needed.

Refactor this section of the code to cleanly calculate all the zone facts statistics and pay down our tech debt on this section.