Skip to content

Commit

Permalink
Merge 5468713 into 97e1c11
Browse files Browse the repository at this point in the history
  • Loading branch information
DarthDippy committed Dec 15, 2014
2 parents 97e1c11 + 5468713 commit fbe3259
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions mapusaurus/hmda/management/commands/load_hmda.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def handle(self, *args, **options):

delete_file = False
filter_hmda = False
filter_state_list = None

self.total_skipped = 0
self.na_skipped = 0
Expand All @@ -45,6 +46,7 @@ def log_info(message):
### default is False
### if filter_hmda is passed in, setup known_hmda & geo_states
### else load all HMDA records without filtering
### if filter_state_list is passed in, setup filter list to only process those states
if len(args) > 1:
for arg in args:
if "delete_file:" in arg:
Expand All @@ -57,6 +59,10 @@ def log_info(message):
if "filterhmda" in arg:
filter_hmda = True

if "filter_state_list" in arg:
tmp_state_list = arg.split(":")
filter_state_list = tmp_state_list[1].split(",")



csv_files = []
Expand All @@ -73,11 +79,13 @@ def log_info(message):
raise Exception("Not a file or Directory! " + args[0])



geo_states = set(
row['state'] for row in
Geo.objects.filter(geo_type=Geo.TRACT_TYPE).values('state').distinct()
)
if filter_state_list == None:
geo_states = set(
row['state'] for row in
Geo.objects.filter(geo_type=Geo.TRACT_TYPE).values('state').distinct()
)
else:
geo_states = set(filter_state_list)

db.reset_queries()

Expand Down

0 comments on commit fbe3259

Please sign in to comment.