Skip to content

Commit

Permalink
Remove import of tables.py from data load
Browse files Browse the repository at this point in the history
This fixes Issue #62.  tables.py was being imported before the tables were populated by table_check, resulting in top level table references being defined as None and throwing errors further downstream. This included the bad API call to /api/departments.
  • Loading branch information
mshenfield committed May 24, 2015
1 parent b1b3285 commit b4aedd5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 0 additions & 12 deletions ntp/data/aggregate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from include.rethinkdb.vars import NAME
from include.rethinkdb.init_db import RawDb, ParsedDb
from include.rethinkdb.tables import RdbChiSquare, RdbChiMerged
from include.rethinkdb.functions import aggregates, tbl_dict
from include.sanitize.vars import CLEAN_SALARY, ETHNICITY, GENDER, EMPLOYEES
from include.aggregate.vars import INCOME_DISTRIBUTIONS, EXPECTED, KEYS
Expand Down Expand Up @@ -46,14 +45,3 @@ def run():

CurrentParsedTableObject.replace(lambda row: row.without(EMPLOYEES)).run()

'''
aggs = aggregates(CurrentParsedTableObject)
chi_data = expected_and_observed(aggs, EXPECTED, KEYS)
chi_parsed = chi_parser(chi_data, KEYS)
for key in KEYS:
for bracket in chi_parsed[key]:
bracket.update({"axis": tbl_name, "demographic": key})
RdbChiSquare.insert(bracket).run()
'''
4 changes: 4 additions & 0 deletions ntp/run_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

if __name__ == "__main__":

# Make sure to not import anything from data.include.rethinkdb.tables
# inside of table_check
# tables.py has initialization that rely on a populated database
# to define the vars RdbMostRecent, RdbChiSquare, and RdbChiMerged correctly
table_check()

from app import app
Expand Down

0 comments on commit b4aedd5

Please sign in to comment.