In [16]:
import sys
sys.path.append('C:\Users\Chrisi\Desktop\Studium\iv\Project\DirtyDrive')
sys.path.append('C:\Users\Chrisi\Desktop\Studium\iv\Project\DirtyDrive\DirtyDrive')
sys.path

import pandas as pd
import numpy as np
import django, os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DirtyDrive.settings')
#settings.configure()
django.setup()

from django.contrib.gis import gdal
gdal.HAS_GDAL

from DirtyDrive import db_saver
import datetime

from DirtyDrive.models import CityDistrict, DriveNowCarType, DriveNowCar, DriveNowChargingStation, DriveNowPetrolStation
from django.db import connection
from django.db.models import Count, Avg
from django.contrib.gis.geos import Point, Polygon

In [17]:
import db_controller

c = db_controller.db_controller()

c.get_available_dates()


Out[17]:
[{'available': 68023,
  'day': datetime.datetime(2016, 12, 1, 0, 0, tzinfo=<DstTzInfo 'Europe/Berlin' CET+1:00:00 STD>)},
 {'available': 66029,
  'day': datetime.datetime(2016, 12, 2, 0, 0, tzinfo=<DstTzInfo 'Europe/Berlin' CET+1:00:00 STD>)},
 {'available': 65190,
  'day': datetime.datetime(2016, 12, 3, 0, 0, tzinfo=<DstTzInfo 'Europe/Berlin' CET+1:00:00 STD>)},
 {'available': 67781,
  'day': datetime.datetime(2016, 12, 4, 0, 0, tzinfo=<DstTzInfo 'Europe/Berlin' CET+1:00:00 STD>)},
 {'available': 66891,
  'day': datetime.datetime(2016, 12, 5, 0, 0, tzinfo=<DstTzInfo 'Europe/Berlin' CET+1:00:00 STD>)},
 {'available': 66257,
  'day': datetime.datetime(2016, 12, 6, 0, 0, tzinfo=<DstTzInfo 'Europe/Berlin' CET+1:00:00 STD>)},
 {'available': 45799,
  'day': datetime.datetime(2016, 12, 7, 0, 0, tzinfo=<DstTzInfo 'Europe/Berlin' CET+1:00:00 STD>)}]

In [18]:
# prozentual Dirt Anteil in Zeit

clean_levels = ['VERY_CLEAN', 'CLEAN', 'REGULAR', 'POOR']

#todo nochmal drüber denken
for s in clean_levels:
    print(s, DriveNowCar.objects.filter(innerCleanliness=s).count()*5 /60 /350)


('VERY_CLEAN', 20)
('CLEAN', 44)
('REGULAR', 33)
('POOR', 7)

In [19]:
#point in polygon 

car = DriveNowCar.objects.all()[0]
#p_cd.contains(car)
car
res = CityDistrict.objects.get(polygon__contains = car.point)
res.name


Out[19]:
u'Moosach'

In [11]:
# distance between points
from django.contrib.gis.db.models.functions import Distance
from django.db.models.query import QuerySet
car1 = DriveNowCar.objects.filter(id=1)
car2 = DriveNowCar.objects.filter(id=2).first()

res = car1.annotate(dist = Distance('point', car2.point))
print(res[0].dist)


#SouthTexasCity.objects.filter(point__distance_lte=(pnt, D(km=7)))


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-11-90319fe4248a> in <module>()
      5 car2 = DriveNowCar.objects.filter(id=2).first()
      6 
----> 7 res = car1.annotate(dist = Distance('point', car2.point))
      8 print(res[0].dist)
      9 

AttributeError: 'NoneType' object has no attribute 'point'

In [12]:
# generate Drives

from django.contrib.gis.db.models.functions import Distance

# alle verfügbaren autos sind vorhanden
# pro auto
# sortiert nach datum
# wenn es sich mehr als 1km bewegt hat
# endpunkt hinzufügen
# CityDistrict hinzufügen

# wenn ein auto nicht verfügbar ist ist es noch am fahren? nicht in objects dabei?


car = DriveNowCar.objects.order_by('id').first()
print car.name

bytime = DriveNowCar.objects.filter(carId = car.carId).order_by('datetime')

last_car = None
for c in bytime:
    if(last_car != None):
        timeDiff = c.datetime - last_car.datetime
        dist = bytime.filter(datetime =c.datetime).annotate(dist= Distance('point', last_car.point))
        dist_km = dist.first().dist.km
        #timeDiff > datetime.timedelta(minutes = 19, seconds = 0) and
        if(dist_km > 0):
            print(c.datetime)
            print(c.datetime - last_car.datetime)
            print('%f km' % dist.first().dist.km)
            #print(last_car.fuelLevel - c.fuelLevel)
            print('')
    last_car = c


Yoko
2016-12-01 07:50:02+00:00
0:40:01
11.447891 km

2016-12-01 22:20:02+00:00
1:40:01
16.868923 km

2016-12-02 07:00:01+00:00
0:39:58
5.174348 km

2016-12-02 08:10:01+00:00
0:39:59
3.964124 km

2016-12-02 12:10:01+00:00
0:50:00
9.067931 km

2016-12-02 13:00:01+00:00
0:39:59
4.110710 km

2016-12-02 14:00:01+00:00
0:49:57
4.008492 km

2016-12-02 22:20:02+00:00
5:30:01
7.870213 km

2016-12-02 23:20:02+00:00
0:30:01
2.875317 km

2016-12-03 08:30:02+00:00
0:40:01
2.931601 km

2016-12-03 14:30:02+00:00
0:50:00
4.915102 km

2016-12-03 15:00:01+00:00
0:20:00
3.064584 km

2016-12-03 15:50:01+00:00
0:50:00
2.452167 km

2016-12-03 16:30:02+00:00
0:40:01
2.967478 km

2016-12-04 08:50:02+00:00
15:10:01
6.954055 km

2016-12-04 09:20:01+00:00
0:29:59
8.505711 km

2016-12-04 16:00:01+00:00
6:10:00
0.054358 km

2016-12-04 17:10:01+00:00
0:39:59
6.097896 km

2016-12-04 19:40:02+00:00
0:40:01
5.962092 km

2016-12-04 20:30:01+00:00
0:19:59
2.453386 km

2016-12-05 05:10:01+00:00
0:49:59
25.697535 km

2016-12-05 10:40:02+00:00
0:50:01
27.755634 km

2016-12-05 13:40:01+00:00
0:29:59
4.279342 km

2016-12-05 15:00:02+00:00
0:30:01
1.162597 km

2016-12-05 16:00:04+00:00
0:30:02
3.828336 km

2016-12-05 19:00:02+00:00
0:50:01
3.662690 km

2016-12-05 20:00:01+00:00
0:59:59
5.267823 km

2016-12-06 06:40:01+00:00
0:50:00
23.788706 km

2016-12-07 00:00:01+00:00
5:20:00
30.136799 km

2016-12-07 07:50:02+00:00
0:30:01
4.009680 km

2016-12-07 09:00:01+00:00
1:09:59
1.619274 km

2016-12-07 09:50:01+00:00
0:50:00
4.320684 km


In [2]:
CityDistrict.objects.all()[1]


Out[2]:
<CityDistrict: CityDistrict object>

In [ ]:
car = DriveNowCar.objects.all()
#p_cd.contains(car)

clean_levels = ['VERY_CLEAN', 'CLEAN', 'REGULAR', 'POOR']

#todo nochmal drüber denken
DriveNowCar.objects.filter(innerCleanliness=clean_levels[3])

#res = CityDistrict.objects.get(polygon__contains = car.point)
#res.name

res = []

#
for district in CityDistrict.objects.all():
    for car in DriveNowCar.objects.all():
        if(district.polygon.contains(car.point)):
            res.append((district,car))


Exception KeyboardInterrupt: KeyboardInterrupt() in 

In [ ]:


In [15]:
district = CityDistrict.objects.all()[1]

res = {}
for car in DriveNowCar.objects.all():
    if(district.polygon.contains(car.point)):
        res[district] = car

res
#DriveNowCar.objects.annotate(district.polygon.contains(point) )


Out[15]:
{<CityDistrict: CityDistrict object>: <DriveNowCar: DriveNowCar object>}

In [20]:
CityDistrict.objects.all()


Out[20]:
<QuerySet [<CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, <CityDistrict: CityDistrict object>, '...(remaining elements truncated)...']>

In [ ]:


In [72]:
# 2 geojson
from geojson import FeatureCollection, Feature
features = []
for cd in CityDistrict.objects.order_by("id").raw('SELECT *, ST_AsGeoJSON(polygon) FROM public."DirtyDrive_citydistrict"'):
    p = geojson.loads(cd.st_asgeojson)
    f = Feature(geometry=p, properties={"id": cd.id, "name": cd.name})
    features.append(f)

fc = FeatureCollection(features)
dump = geojson.dumps(fc, sort_keys=False)

print("falid: ", geojson.is_valid(geojson.loads(dump))['valid'])

with open("muenchen.json", "w") as text_file:
    text_file.write(dump)


('falid: ', 'yes')

In [ ]:


In [ ]:


In [185]:
# % poor

def dictfetchall(cursor):
    "Return all rows from a cursor as a dict"
    columns = [col[0] for col in cursor.description]
    return [
        dict(zip(columns, row))
        for row in cursor.fetchall()
    ]

from django.db import connection


#count cars by citydistrict
with connection.cursor() as cursor:
    cursor.execute(
                   'SELECT dis.id, dis.name, count(car.id) As counter \
FROM public."DirtyDrive_citydistrict" as dis, public."DirtyDrive_drivenowcar" as car \
WHERE ST_Contains(dis.polygon, car.point) \
GROUP BY dis.id;'
                   )
    #res = cursor.fetchall()
    df_citydistrict = pd.DataFrame(dictfetchall(cursor))

# count all dirty by district
with connection.cursor() as cursor:
    cursor.execute(
                   'SELECT dis.id, dis.name, count(car.id) As count_poor \
FROM public."DirtyDrive_citydistrict" as dis, "DirtyDrive_drivenowcar" as car \
WHERE ST_Contains(dis.polygon, car.point) AND car."innerCleanliness"=\'POOR\'\
GROUP BY dis.id;'
                   )
    #res = cursor.fetchall()
    df_poor = pd.DataFrame(dictfetchall(cursor))

df_citydistrict


Out[185]:
counter id name
0 9330 1 Altstadt-Lehel
1 14625 2 Ludwigsvorstadt-Isarvorstadt
2 16864 3 Maxvorstadt
3 18413 4 Schwabing-West
4 13846 5 Au-Haidhausen
5 13429 6 Sendling
6 22483 7 Sendling-Westpark
7 7148 8 Schwanthalerhoehe
8 36015 9 Neuhausen-Nymphenburg
9 8592 10 Moosach
10 23180 11 Milbertshofen-Am
11 35660 12 Schwabing-Freimann
12 29331 13 Bogenhausen
13 11833 14 Berg
14 1468 15 Trudering-Riem
15 27397 16 Ramersdorf
16 13611 17 Obergiesing-Fasangarten
17 28326 18 Untergiesing-Harlaching
18 25057 19 Thalkirchen-Obersendling-Forstenried-Fuerstenr...
19 9030 20 Hadern
20 9689 21 Pasing-Obermenzing
21 73 22 Aubing-Lochhausen-Langwied
22 265 23 Allach-Untermenzing
23 230 24 Feldmoching-Hasenbergl
24 14346 25 Laim

In [186]:
with connection.cursor() as cursor:
    cursor.execute(
                   'SELECT dis.id, dis.name, car."innerCleanliness" as clean, count(car.id) As count \
FROM public."DirtyDrive_citydistrict" as dis, "DirtyDrive_drivenowcar" as car \
WHERE  ST_Contains(dis.polygon, car.point)  \
GROUP BY dis.id , car."innerCleanliness";'
                   )
    #res = cursor.fetchall()
    df_clean_group = pd.DataFrame(dictfetchall(cursor))

df_clean_group


Out[186]:
clean count id name
0 CLEAN 3867 1 Altstadt-Lehel
1 POOR 667 1 Altstadt-Lehel
2 REGULAR 2871 1 Altstadt-Lehel
3 VERY_CLEAN 1925 1 Altstadt-Lehel
4 CLEAN 5939 2 Ludwigsvorstadt-Isarvorstadt
5 POOR 1087 2 Ludwigsvorstadt-Isarvorstadt
6 REGULAR 4463 2 Ludwigsvorstadt-Isarvorstadt
7 VERY_CLEAN 3136 2 Ludwigsvorstadt-Isarvorstadt
8 CLEAN 7358 3 Maxvorstadt
9 POOR 1144 3 Maxvorstadt
10 REGULAR 5012 3 Maxvorstadt
11 VERY_CLEAN 3350 3 Maxvorstadt
12 0 15 4 Schwabing-West
13 CLEAN 7506 4 Schwabing-West
14 POOR 1351 4 Schwabing-West
15 REGULAR 5395 4 Schwabing-West
16 VERY_CLEAN 4146 4 Schwabing-West
17 CLEAN 6230 5 Au-Haidhausen
18 POOR 1215 5 Au-Haidhausen
19 REGULAR 3760 5 Au-Haidhausen
20 VERY_CLEAN 2641 5 Au-Haidhausen
21 CLEAN 6414 6 Sendling
22 POOR 766 6 Sendling
23 REGULAR 3728 6 Sendling
24 VERY_CLEAN 2521 6 Sendling
25 CLEAN 8683 7 Sendling-Westpark
26 POOR 1405 7 Sendling-Westpark
27 REGULAR 7141 7 Sendling-Westpark
28 VERY_CLEAN 5254 7 Sendling-Westpark
29 0 10 8 Schwanthalerhoehe
... ... ... ... ...
68 REGULAR 4470 17 Obergiesing-Fasangarten
69 VERY_CLEAN 2175 17 Obergiesing-Fasangarten
70 CLEAN 11863 18 Untergiesing-Harlaching
71 POOR 2318 18 Untergiesing-Harlaching
72 REGULAR 8506 18 Untergiesing-Harlaching
73 VERY_CLEAN 5639 18 Untergiesing-Harlaching
74 CLEAN 10851 19 Thalkirchen-Obersendling-Forstenried-Fuerstenr...
75 POOR 1737 19 Thalkirchen-Obersendling-Forstenried-Fuerstenr...
76 REGULAR 7961 19 Thalkirchen-Obersendling-Forstenried-Fuerstenr...
77 VERY_CLEAN 4508 19 Thalkirchen-Obersendling-Forstenried-Fuerstenr...
78 CLEAN 3605 20 Hadern
79 POOR 484 20 Hadern
80 REGULAR 3324 20 Hadern
81 VERY_CLEAN 1617 20 Hadern
82 CLEAN 3651 21 Pasing-Obermenzing
83 POOR 583 21 Pasing-Obermenzing
84 REGULAR 3577 21 Pasing-Obermenzing
85 VERY_CLEAN 1878 21 Pasing-Obermenzing
86 POOR 71 22 Aubing-Lochhausen-Langwied
87 REGULAR 2 22 Aubing-Lochhausen-Langwied
88 CLEAN 125 23 Allach-Untermenzing
89 REGULAR 26 23 Allach-Untermenzing
90 VERY_CLEAN 114 23 Allach-Untermenzing
91 POOR 3 24 Feldmoching-Hasenbergl
92 REGULAR 194 24 Feldmoching-Hasenbergl
93 VERY_CLEAN 33 24 Feldmoching-Hasenbergl
94 CLEAN 5951 25 Laim
95 POOR 679 25 Laim
96 REGULAR 4854 25 Laim
97 VERY_CLEAN 2862 25 Laim

98 rows × 4 columns


In [187]:
df = pd.merge(df_clean_group, df_citydistrict[['id', 'counter']], on='id')
df['relative'] = df['count']/df['counter']

df[df['clean']=='POOR']
df_to_save = df.sort_values(['id'], ascending=False)
df_to_save


Out[187]:
clean count id name counter relative
97 VERY_CLEAN 2862 25 Laim 14346 0.199498
96 REGULAR 4854 25 Laim 14346 0.338352
95 POOR 679 25 Laim 14346 0.047330
94 CLEAN 5951 25 Laim 14346 0.414819
93 VERY_CLEAN 33 24 Feldmoching-Hasenbergl 230 0.143478
92 REGULAR 194 24 Feldmoching-Hasenbergl 230 0.843478
91 POOR 3 24 Feldmoching-Hasenbergl 230 0.013043
90 VERY_CLEAN 114 23 Allach-Untermenzing 265 0.430189
89 REGULAR 26 23 Allach-Untermenzing 265 0.098113
88 CLEAN 125 23 Allach-Untermenzing 265 0.471698
86 POOR 71 22 Aubing-Lochhausen-Langwied 73 0.972603
87 REGULAR 2 22 Aubing-Lochhausen-Langwied 73 0.027397
85 VERY_CLEAN 1878 21 Pasing-Obermenzing 9689 0.193828
84 REGULAR 3577 21 Pasing-Obermenzing 9689 0.369182
83 POOR 583 21 Pasing-Obermenzing 9689 0.060171
82 CLEAN 3651 21 Pasing-Obermenzing 9689 0.376819
81 VERY_CLEAN 1617 20 Hadern 9030 0.179070
80 REGULAR 3324 20 Hadern 9030 0.368106
79 POOR 484 20 Hadern 9030 0.053599
78 CLEAN 3605 20 Hadern 9030 0.399225
76 REGULAR 7961 19 Thalkirchen-Obersendling-Forstenried-Fuerstenr... 25057 0.317716
75 POOR 1737 19 Thalkirchen-Obersendling-Forstenried-Fuerstenr... 25057 0.069322
74 CLEAN 10851 19 Thalkirchen-Obersendling-Forstenried-Fuerstenr... 25057 0.433053
77 VERY_CLEAN 4508 19 Thalkirchen-Obersendling-Forstenried-Fuerstenr... 25057 0.179910
73 VERY_CLEAN 5639 18 Untergiesing-Harlaching 28326 0.199075
72 REGULAR 8506 18 Untergiesing-Harlaching 28326 0.300289
71 POOR 2318 18 Untergiesing-Harlaching 28326 0.081833
70 CLEAN 11863 18 Untergiesing-Harlaching 28326 0.418803
69 VERY_CLEAN 2175 17 Obergiesing-Fasangarten 13611 0.159797
68 REGULAR 4470 17 Obergiesing-Fasangarten 13611 0.328411
... ... ... ... ... ... ...
29 0 10 8 Schwanthalerhoehe 7148 0.001399
27 REGULAR 7141 7 Sendling-Westpark 22483 0.317618
25 CLEAN 8683 7 Sendling-Westpark 22483 0.386203
26 POOR 1405 7 Sendling-Westpark 22483 0.062492
28 VERY_CLEAN 5254 7 Sendling-Westpark 22483 0.233688
24 VERY_CLEAN 2521 6 Sendling 13429 0.187728
23 REGULAR 3728 6 Sendling 13429 0.277608
22 POOR 766 6 Sendling 13429 0.057041
21 CLEAN 6414 6 Sendling 13429 0.477623
20 VERY_CLEAN 2641 5 Au-Haidhausen 13846 0.190741
19 REGULAR 3760 5 Au-Haidhausen 13846 0.271559
18 POOR 1215 5 Au-Haidhausen 13846 0.087751
17 CLEAN 6230 5 Au-Haidhausen 13846 0.449949
15 REGULAR 5395 4 Schwabing-West 18413 0.293000
13 CLEAN 7506 4 Schwabing-West 18413 0.407647
12 0 15 4 Schwabing-West 18413 0.000815
16 VERY_CLEAN 4146 4 Schwabing-West 18413 0.225167
14 POOR 1351 4 Schwabing-West 18413 0.073372
11 VERY_CLEAN 3350 3 Maxvorstadt 16864 0.198648
10 REGULAR 5012 3 Maxvorstadt 16864 0.297201
9 POOR 1144 3 Maxvorstadt 16864 0.067837
8 CLEAN 7358 3 Maxvorstadt 16864 0.436314
6 REGULAR 4463 2 Ludwigsvorstadt-Isarvorstadt 14625 0.305162
5 POOR 1087 2 Ludwigsvorstadt-Isarvorstadt 14625 0.074325
4 CLEAN 5939 2 Ludwigsvorstadt-Isarvorstadt 14625 0.406085
7 VERY_CLEAN 3136 2 Ludwigsvorstadt-Isarvorstadt 14625 0.214427
2 REGULAR 2871 1 Altstadt-Lehel 9330 0.307717
1 POOR 667 1 Altstadt-Lehel 9330 0.071490
3 VERY_CLEAN 1925 1 Altstadt-Lehel 9330 0.206324
0 CLEAN 3867 1 Altstadt-Lehel 9330 0.414469

98 rows × 6 columns


In [205]:
a = df_to_save[df_to_save['id']== 5]
a.iloc[0]['counter']


Out[205]:
13846

In [208]:
# clean 2 geojson
from geojson import FeatureCollection, Feature

features = []
for cd in CityDistrict.objects.order_by("id").raw('SELECT *, ST_AsGeoJSON(polygon) FROM public."DirtyDrive_citydistrict"'):
    p = geojson.loads(cd.st_asgeojson)
    the_id = cd.id
    df = df_to_save[df_to_save['id'] == the_id]
    
    counter = int(df.iloc[0]['counter'])
    properties={"id": cd.id, "name": cd.name, 'counter':counter}
    for clean_level in ['VERY_CLEAN', 'CLEAN', 'REGULAR', 'POOR']:
        a = df[df['clean'] == clean_level]
        if len(a) > 0:
            properties[clean_level] = int(a['count'])
        else:
            properties[clean_level] = 0
        
    print(properties)
    f = Feature(geometry=p, properties=properties)
    features.append(f)
    

fc = FeatureCollection(features)
dump = geojson.dumps(fc, sort_keys=False)

print("falid: ", geojson.is_valid(geojson.loads(dump))['valid'])

with open("muenchen.geo.json", "w") as text_file:
    text_file.write(dump)


{'POOR': 1405, 'VERY_CLEAN': 5254, 'name': u'Sendling-Westpark', 'counter': 22483, 'REGULAR': 7141, 'CLEAN': 8683, 'id': 7}
{'POOR': 473, 'VERY_CLEAN': 1294, 'name': u'Schwanthalerhoehe', 'counter': 7148, 'REGULAR': 2420, 'CLEAN': 2951, 'id': 8}
{'POOR': 1087, 'VERY_CLEAN': 3136, 'name': u'Ludwigsvorstadt-Isarvorstadt', 'counter': 14625, 'REGULAR': 4463, 'CLEAN': 5939, 'id': 2}
{'POOR': 1144, 'VERY_CLEAN': 3350, 'name': u'Maxvorstadt', 'counter': 16864, 'REGULAR': 5012, 'CLEAN': 7358, 'id': 3}
{'POOR': 1351, 'VERY_CLEAN': 4146, 'name': u'Schwabing-West', 'counter': 18413, 'REGULAR': 5395, 'CLEAN': 7506, 'id': 4}
{'POOR': 1215, 'VERY_CLEAN': 2641, 'name': u'Au-Haidhausen', 'counter': 13846, 'REGULAR': 3760, 'CLEAN': 6230, 'id': 5}
{'POOR': 766, 'VERY_CLEAN': 2521, 'name': u'Sendling', 'counter': 13429, 'REGULAR': 3728, 'CLEAN': 6414, 'id': 6}
{'POOR': 656, 'VERY_CLEAN': 1790, 'name': u'Moosach', 'counter': 8592, 'REGULAR': 2679, 'CLEAN': 3467, 'id': 10}
{'POOR': 1421, 'VERY_CLEAN': 4242, 'name': u'Milbertshofen-Am', 'counter': 23180, 'REGULAR': 8145, 'CLEAN': 9372, 'id': 11}
{'POOR': 785, 'VERY_CLEAN': 2347, 'name': u'Berg', 'counter': 11833, 'REGULAR': 3832, 'CLEAN': 4869, 'id': 14}
{'POOR': 732, 'VERY_CLEAN': 2175, 'name': u'Obergiesing-Fasangarten', 'counter': 13611, 'REGULAR': 4470, 'CLEAN': 6234, 'id': 17}
{'POOR': 3, 'VERY_CLEAN': 33, 'name': u'Feldmoching-Hasenbergl', 'counter': 230, 'REGULAR': 194, 'CLEAN': 0, 'id': 24}
{'POOR': 484, 'VERY_CLEAN': 1617, 'name': u'Hadern', 'counter': 9030, 'REGULAR': 3324, 'CLEAN': 3605, 'id': 20}
{'POOR': 679, 'VERY_CLEAN': 2862, 'name': u'Laim', 'counter': 14346, 'REGULAR': 4854, 'CLEAN': 5951, 'id': 25}
{'POOR': 2318, 'VERY_CLEAN': 5639, 'name': u'Untergiesing-Harlaching', 'counter': 28326, 'REGULAR': 8506, 'CLEAN': 11863, 'id': 18}
{'POOR': 71, 'VERY_CLEAN': 0, 'name': u'Aubing-Lochhausen-Langwied', 'counter': 73, 'REGULAR': 2, 'CLEAN': 0, 'id': 22}
{'POOR': 2064, 'VERY_CLEAN': 6462, 'name': u'Bogenhausen', 'counter': 29331, 'REGULAR': 7898, 'CLEAN': 12907, 'id': 13}
{'POOR': 0, 'VERY_CLEAN': 114, 'name': u'Allach-Untermenzing', 'counter': 265, 'REGULAR': 26, 'CLEAN': 125, 'id': 23}
{'POOR': 583, 'VERY_CLEAN': 1878, 'name': u'Pasing-Obermenzing', 'counter': 9689, 'REGULAR': 3577, 'CLEAN': 3651, 'id': 21}
{'POOR': 667, 'VERY_CLEAN': 1925, 'name': u'Altstadt-Lehel', 'counter': 9330, 'REGULAR': 2871, 'CLEAN': 3867, 'id': 1}
{'POOR': 2337, 'VERY_CLEAN': 4528, 'name': u'Ramersdorf', 'counter': 27397, 'REGULAR': 8074, 'CLEAN': 12458, 'id': 16}
{'POOR': 1737, 'VERY_CLEAN': 4508, 'name': u'Thalkirchen-Obersendling-Forstenried-Fuerstenried-Solln', 'counter': 25057, 'REGULAR': 7961, 'CLEAN': 10851, 'id': 19}
{'POOR': 2261, 'VERY_CLEAN': 6929, 'name': u'Neuhausen-Nymphenburg', 'counter': 36015, 'REGULAR': 11048, 'CLEAN': 15777, 'id': 9}
{'POOR': 2450, 'VERY_CLEAN': 6909, 'name': u'Schwabing-Freimann', 'counter': 35660, 'REGULAR': 11354, 'CLEAN': 14947, 'id': 12}
{'POOR': 350, 'VERY_CLEAN': 216, 'name': u'Trudering-Riem', 'counter': 1468, 'REGULAR': 401, 'CLEAN': 501, 'id': 15}
('falid: ', 'yes')