[NUUG fiksgatami] Hvor stor andel av problemene er fikset i hver kommune?

Petter Reinholdtsen pere at hungry.com
Wed Apr 27 09:01:05 CEST 2011


[Petter Reinholdtsen]
> Her er resultat av en SQL-spørring som viser nettopp dette, for alle
> saker som ble rapportert før vi begynte å sende til vegvesenet:

Det slo meg at vi burde gi kommunene litt tid til å løse saker, samt
ignorere testsaker og saker som ikke er bekreftet av innsender, og
gjorde nytt søk.  Her er det tre uker gamle saker som teller med.
Kommune 220 (Asker) og 709 (Larvik) ser ut til å ha gjort en god
jobb. :)

     areas      | total |       fraq_fixed
----------------+-------+------------------------
 ,10,1004,      |     1 |   100.0000000000000000
 ,10,1014,      |     2 |   100.0000000000000000
 ,10,1021,      |     1 |   100.0000000000000000
 ,10,1032,      |     1 |   100.0000000000000000
 ,12,1246,      |     2 |   100.0000000000000000
 ,14,1420,      |     1 |   100.0000000000000000
 ,16,1634,      |     1 |   100.0000000000000000
 ,17,1739,      |     1 |   100.0000000000000000
 ,18,1850,      |     1 |   100.0000000000000000
 ,18,1865,      |     1 |   100.0000000000000000
 ,19,1920,      |     1 |   100.0000000000000000
 ,20,2030,      |     1 |   100.0000000000000000
 ,2,234,        |     1 |   100.0000000000000000
 ,4,402,        |     1 |   100.0000000000000000
 ,5,522,        |     1 |   100.0000000000000000
 ,8,815,        |     1 |   100.0000000000000000
 ,2,220,        |    20 |    70.0000000000000000
 ,11,1119,      |     3 |    66.6666666666666667
 ,15,1519,      |     6 |    66.6666666666666667
 ,18,1805,      |     6 |    66.6666666666666667
 ,19,1929,      |     3 |    66.6666666666666667
 ,7,709,        |    15 |    60.0000000000000000
 ,8,814,        |     5 |    60.0000000000000000
 ,11,1101,      |     2 |    50.0000000000000000
 ,1,123,        |     2 |    50.0000000000000000
 ,12,1224,      |     4 |    50.0000000000000000
 ,12,1245,      |     2 |    50.0000000000000000
 ,16,1622,      |     2 |    50.0000000000000000
 ,16,1638,      |     2 |    50.0000000000000000
 ,16,1640,      |     2 |    50.0000000000000000
 ,18,1824,      |     4 |    50.0000000000000000
 ,18,1840,      |     2 |    50.0000000000000000
 ,19,1917,      |     4 |    50.0000000000000000
 ,19,1933,      |     2 |    50.0000000000000000
 ,2,231,        |    24 |    50.0000000000000000
 ,8,822,        |     2 |    50.0000000000000000
 ,4,403,        |    19 |    47.3684210526315789
 ,7,706,        |    15 |    46.6666666666666667
 ,7,701,        |    13 |    46.1538461538461538
 ,2,230,        |     9 |    44.4444444444444444
 ,1,135,        |     5 |    40.0000000000000000
 ,6,604,        |     8 |    37.5000000000000000
 ,11,1124,      |    11 |    36.3636363636363636
 ,16,1653,      |    31 |    35.4838709677419355
 ,1,105,        |    23 |    34.7826086956521739
 ,1,119,        |     3 |    33.3333333333333333
 ,14,1419,      |     3 |    33.3333333333333333
 ,2,211,        |     3 |    33.3333333333333333
 ,2,227,        |     3 |    33.3333333333333333
 ,2,236,        |     3 |    33.3333333333333333
 ,4,412,        |    12 |    33.3333333333333333
 ,5,501,        |     3 |    33.3333333333333333
 ,5,502,        |     6 |    33.3333333333333333
 ,5,515,        |     3 |    33.3333333333333333
 ,7,704,        |     9 |    33.3333333333333333
 ,7,722,        |     6 |    33.3333333333333333
 ,8,807,        |     3 |    33.3333333333333333
 ,9,926,        |     3 |    33.3333333333333333
 ,1,101,        |    20 |    30.0000000000000000
 ,9,904,        |    10 |    30.0000000000000000
 ,8,806,        |    24 |    29.1666666666666667
 ,8,805,        |     7 |    28.5714285714285714
 ,2,219,        |   175 |    28.0000000000000000
 ,12,1235,      |    36 |    27.7777777777777778
 ,11,1102,      |    77 |    27.2727272727272727
 ,15,1517,      |    11 |    27.2727272727272727
 ,3,301,        |   460 |    26.7391304347826087
 ,6,602,        |    27 |    25.9259259259259259
 ,1,106,        |    51 |    25.4901960784313725
 ,11,1106,      |     8 |    25.0000000000000000
 ,1,125,        |     4 |    25.0000000000000000
 ,17,1703,      |     4 |    25.0000000000000000
 ,18,1833,      |     4 |    25.0000000000000000
 ,18,1867,      |     4 |    25.0000000000000000
 ,2,226,        |     4 |    25.0000000000000000
 ,6,605,        |     4 |    25.0000000000000000
 ,7,716,        |     4 |    25.0000000000000000
 ,9,906,        |     8 |    25.0000000000000000
 ,10,1001,      |    35 |    22.8571428571428571
 ,1,104,        |    22 |    22.7272727272727273
 ,19,1901,      |    44 |    22.7272727272727273
 ,10,1017,      |     9 |    22.2222222222222222
 ,11,1149,      |     9 |    22.2222222222222222
 ,1,124,        |     9 |    22.2222222222222222
 ,19,1924,      |     9 |    22.2222222222222222
 ,11,1103,      |    74 |    21.6216216216216216
 ,17,1714,      |    48 |    20.8333333333333333
 ,11,1127,      |     5 |    20.0000000000000000
 ,15,1502,      |     5 |    20.0000000000000000
 ,17,1718,      |     5 |    20.0000000000000000
 ,18,1870,      |    15 |    20.0000000000000000
 ,19,1931,      |    11 |    18.1818181818181818
 ,10,1002,      |     6 |    16.6666666666666667
 ,11,1121,      |    18 |    16.6666666666666667
 ,15,1531,      |     6 |    16.6666666666666667
 ,16,1636,      |     6 |    16.6666666666666667
 ,18,1866,      |     6 |    16.6666666666666667
 ,12,1201,      |   173 |    16.1849710982658960
 ,15,1505,      |   101 |    15.8415841584158416
 ,19,1902,      |    19 |    15.7894736842105263
 ,11,1120,      |    13 |    15.3846153846153846
 ,12,1247,      |    13 |    15.3846153846153846
 ,12,1228,      |    21 |    14.2857142857142857
 ,2,215,        |     7 |    14.2857142857142857
 ,6,626,        |     7 |    14.2857142857142857
 ,7,702,        |     7 |    14.2857142857142857
 ,16,1601,      |   560 |    13.9285714285714286
 ,10,1018,      |    15 |    13.3333333333333333
 ,2,214,        |    15 |    13.3333333333333333
 ,4,417,        |    15 |    13.3333333333333333
 ,17,1702,      |     8 |    12.5000000000000000
 ,17,1721,      |     8 |    12.5000000000000000
 ,2,217,        |     8 |    12.5000000000000000
 ,2,233,        |    16 |    12.5000000000000000
 ,12,1253,      |    33 |    12.1212121212121212
 ,16,1662,      |     9 |    11.1111111111111111
 ,2,213,        |     9 |    11.1111111111111111
 ,12,1243,      |    47 |    10.6382978723404255
 ,15,1504,      |    51 |     9.8039215686274510
 ,16,1612,      |    21 |     9.5238095238095238
 ,15,1520,      |    11 |     9.0909090909090909
 ,17,1719,      |    37 |     8.1081081081081081
 ,12,1221,      |    16 |     6.2500000000000000

SQL-spørringen ser slik ut:

SELECT areas, COUNT(*) AS TOTAL, 100.0 * SUM(fixed) / COUNT(*) AS fraq_fixed
  FROM (SELECT areas, CASE WHEN state = 'fixed' THEN 1 ELSE 0 END AS fixed
        FROM problem WHERE confirmed IS NOT NULL
            AND state IN ('fixed', 'confirmed')
	    AND whensent < NOW() - INTERVAL '3 weeks') AS a
  GROUP BY areas ORDER BY fraq_fixed DESC, areas;

Vennlig hilsen,
-- 
Petter Reinholdtsen


More information about the fiksgatami mailing list