def finish_import(self, counties, Ers_data): fast_food_rest_per_capita = counties['attributes']['FFRPTH11'] full_rest_per_capita = counties['attributes']['FSRPTH11'] Ers_data.fast_food_rest_per_capita = round_div_float( fast_food_rest_per_capita, 1000.0) Ers_data.full_rest_per_capita = round_div_float( full_rest_per_capita, 1000.0)
def finish_import(self, counties, Ers_data): per_adult_diabetes = counties['attributes']['PCT_DIABETES_ADULTS10'] per_adult_obesity = counties['attributes']["PCT_OBESE_ADULTS10"] rec_facilities_per_capita = counties['attributes']["RECFACPTH11"] Ers_data.per_adult_diabetes = round_div_float( per_adult_diabetes, 100.0) Ers_data.per_adult_obesity = round_div_float(per_adult_obesity, 100.0) Ers_data.rec_facilities_per_capita = round_div_float( rec_facilities_per_capita, 1000.0)
def finish_import(self, counties, Ers_data): per_students_for_free_lunch = ( counties['attributes']["PCT_FREE_LUNCH10"]) per_students_for_reduced_lunch = ( counties['attributes']["PCT_REDUCED_LUNCH10"]) Ers_data.per_students_for_free_lunch = round_div_float( per_students_for_free_lunch, 100.0) Ers_data.per_students_for_reduced_lunch = round_div_float( per_students_for_reduced_lunch, 100.0)
def dartmouth_health_discharge_rate_db_importer(): path = 'data/dartmouth/discharge_rate.csv' reader = csv.reader(file(path)) count = 0 county_prefix = None for location, value in reader: #Tests to see if it is reading in a state based on the lack of a comma if location[-4:-3] == ",": assert county_prefix boundary_name = location[:-4] boundary = Boundary.objects.get( display_name=boundary_name, kind='County', external_id__startswith=county_prefix) else: assert not county_prefix boundary_name = location + " State" boundary = Boundary.objects.get( display_name=boundary_name, kind='State') county_prefix = boundary.external_id data, created = Dartmouth.objects.get_or_create(boundary=boundary) data.discharge_rate_per_capita = round_div_float(float(value), 1000.0) data.save() count += 1 logger.info("Imported {} discharge rates".format(count))
def finish_import(self, counties, Ers_data): per_low_access_to_groceries = ( counties['attributes']['PCT_LACCESS_POP10']) Ers_data.per_low_access_to_groceries = round_div_float( per_low_access_to_groceries, 100.0)
def finish_import(self, counties, Ers_data): grocery_stores_per_capita = ( counties['attributes']['GROCPTH11']) Ers_data.grocery_stores_per_capita = round_div_float( grocery_stores_per_capita, 1000.0)
def finish_import(self, counties, Ers_data): farmers_markets_per_capita = counties['attributes']['FMRKTPTH13'] Ers_data.farmers_markets_per_capita = round_div_float( farmers_markets_per_capita, 1000.0)