Skip to content

Commit

Permalink
Merge branch 'master' of github.com:contolini/mapusaurus into census-…
Browse files Browse the repository at this point in the history
…tooltips
  • Loading branch information
contolini committed Mar 16, 2016
2 parents 351b4bb + 2311a85 commit 69968a9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mapusaurus/hmda/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ def loan_originations(request):
query = query.filter(action_taken__in=action_taken_selected)

#count on geo_id
query = query.values('geo_id', 'geo__census2010households__total', 'geo__centlat', 'geo__centlon').annotate(volume=Count('geo_id'))
query = query.values('geo_id', 'geo__census2010households__total', 'geo__centlat', 'geo__centlon',
'geo__state', 'geo__county', 'geo__tract').annotate(volume=Count('geo_id'))
return query;

def loan_originations_as_json(request):
records = loan_originations(request)
data = {}
if records:
for row in records:
tract_id = row['geo__state']+row['geo__county']+row['geo__tract']
data[row['geo_id']] = {
'geoid': row['geo_id'],
'tractid': tract_id,
'volume': row['volume'],
'num_households': row['geo__census2010households__total'],
'centlat': row['geo__centlat'],
Expand Down

0 comments on commit 69968a9

Please sign in to comment.