예제 #1
0
 def handle(self, *args, **options):
     with open('rawdata/Appathon3_KS4_1011.txt', 'r') as f:
         reader = csv.DictReader(f, delimiter='\t')
         done = 0
         for page in paged(PAGE_SIZE, reader):
             pupils = [row_to_pupil(row) for row in page]
             Pupil.objects.bulk_create(pupils)
             done += PAGE_SIZE
             pprint.pprint(done)
예제 #2
0
 def handle(self, *args, **options):
     with open("rawdata/Appathon3_KS4_1011.txt", "r") as f:
         reader = csv.DictReader(f, delimiter="\t")
         done = 0
         for page in paged(PAGE_SIZE, reader):
             pupils = [row_to_pupil(row) for row in page]
             Pupil.objects.bulk_create(pupils)
             done += PAGE_SIZE
             pprint.pprint(done)
예제 #3
0
def leas(request):
    counties = County.objects.all().order_by('name')
    counties_per_col = counties.count() / 4

    county_layer = InfoLayer([[c.shape, _link(c)] for c in counties])
    map_ = Map([county_layer], LEAS_MAP_OPTIONS)

    context = {
        'counties_columns': paged(counties_per_col, counties),
        'map': map_,
    }

    return render_to_response('dashboard/leas.html',
            context,
            context_instance=RequestContext(request))
예제 #4
0
def leas(request):
    counties = County.objects.all().order_by('name')
    counties_per_col = counties.count() / 4

    county_layer = InfoLayer([[c.shape, _link(c)] for c in counties])
    map_ = Map([county_layer], LEAS_MAP_OPTIONS)

    context = {
        'counties_columns': paged(counties_per_col, counties),
        'map': map_,
    }

    return render_to_response('dashboard/leas.html',
                              context,
                              context_instance=RequestContext(request))
예제 #5
0
 def handle(self, *args, **options):
     with open('rawdata/deprivation/J440310_2309_GeoPolicy_LSOA.CSV', 'r') as f:
         for _ in range(6):
             f.readline()
         reader = csv.reader(f)
         for page in paged(200, reader):
             areas = []
             for row in page:
                 areas.append(Area(
                     name=row[11],
                     msoa=row[8],
                     lsoa=row[10],
                     deprivation_score=row[14],
                     income_score=row[16],
                     employment_score=row[18],
                     health_score=row[20],
                     education_score=row[22],
                     housing_score=row[24],
                     crime_score=row[26],
                     environment_score=row[28],
                 ))
             Area.objects.bulk_create(areas)