diff options
author | francis <francis> | 2008-05-09 00:55:42 +0000 |
---|---|---|
committer | francis <francis> | 2008-05-09 00:55:42 +0000 |
commit | 901e92e9781f8ed6c42029ca12aa486b285e83e5 (patch) | |
tree | 926937b84ff02cf73cd3b63c35add8c41bb7aaee | |
parent | cc1430e476f6dcdb58d194bbb63d43a79ea1c457 (diff) |
Graph
-rwxr-xr-x | script/request-creation-graph | 103 | ||||
-rw-r--r-- | todo.txt | 11 |
2 files changed, 108 insertions, 6 deletions
diff --git a/script/request-creation-graph b/script/request-creation-graph new file mode 100755 index 000000000..d5d87063d --- /dev/null +++ b/script/request-creation-graph @@ -0,0 +1,103 @@ +#!/bin/bash +# request-creation-graph +# Plot graph of rate of request creation +# +# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. +# Email: francis@mysociety.org. WWW: http://www.mysociety.org/ +# +# $Id: request-creation-graph,v 1.1 2008-05-09 00:55:43 francis Exp $ + +GPLOT_OUTPUT="set terminal png font 'Vera.ttf' 9 size 1200,400" +EXTENSION=".png" +#GPLOT_OUTPUT="set terminal fig color big thickness 1" +#EXTENSION=".fig" +#GPLOT_OUTPUT="set terminal svg size 800 250" +#EXTENSION=".svg" + +cd `dirname $0` +cd ../../ +source shlib/deployfns + +# XXX this is nasty :) +OPTION_FOI_DB_HOST=`grep "host:" foi/config/database.yml | head --lines=1 | cut -d ":" -f 2` +OPTION_FOI_DB_PORT=`grep "port:" foi/config/database.yml | head --lines=1 | cut -d ":" -f 2` +OPTION_FOI_DB_NAME=`grep "database:" foi/config/database.yml | head --lines=1 | cut -d ":" -f 2` +OPTION_FOI_DB_USER=`grep "username:" foi/config/database.yml | head --lines=1 | cut -d ":" -f 2` + +SOURCEA=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM +SOURCEB=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM +SOURCEC=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM +SOURCED=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM +SOURCEE=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM +SOURCEF=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM +SOURCEG=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM +GPSCRIPT=/tmp/foi-creation-rate-graph-script-$RANDOM$RANDOM + +# where status in ('draft') + +function grab_data { + echo "select + date(created_at), count(*) + from info_requests + $1 + group by date(created_at) + order by date(created_at) + ;" | psql --host $OPTION_FOI_DB_HOST --port $OPTION_FOI_DB_PORT -A -F " " $OPTION_FOI_DB_NAME $OPTION_FOI_DB_USER | egrep -v "date|rows" >$2 +} + +# rather nastily, work out the cumulative heights in reverse, so can plot impulses on top of each other +grab_data "" $SOURCEA +grab_data "where described_state not in ('waiting_response')" $SOURCEB +grab_data "where described_state not in ('waiting_response', 'waiting_clarification')" $SOURCEC +grab_data "where described_state not in ('waiting_response', 'waiting_clarification', 'not_held')" $SOURCED +grab_data "where described_state not in ('waiting_response', 'waiting_clarification', 'not_held', 'rejected')" $SOURCEE +grab_data "where described_state not in ('waiting_response', 'waiting_clarification', 'not_held', 'rejected', 'successful')" $SOURCEF +grab_data "where described_state not in ('waiting_response', 'waiting_clarification', 'not_held', 'rejected', 'successful', 'partially_successful')" $SOURCEG + + +#state = 'unconfirmed' +#or state = 'confirmed' +#or state = 'fixed' +#or state = 'hidden' +#or state = 'flickr' + + +cat >$GPSCRIPT <<END + unset border + unset arrow + set key left + set tics out + $GPLOT_OUTPUT + + set xdata time + set timefmt "%Y-%m-%d" + set xrange ["2007-12-01":] + set format x "%d %b %Y" + set xtics nomirror + set xlabel "status of requests that were created on each calendar day" + + set ytics nomirror + set ylabel "number of requests created on the calendar day" + set y2tics tc lt 2 + set y2label "cumulative total number of requests" tc lt 2 + set format y2 "%.0f" + +# set arrow 1 from '2005-02-14', 0 to '2005-02-14', 900 lt 0 nohead +# set label 1 'launch of beta' at '2005-02-17', 900 + + n = 0 + plot "$SOURCEA" using 1:2 with impulses lt 3 lw 15 title "waiting_response",\ + "$SOURCEB" using 1:2 with impulses lt 4 lw 15 title "waiting_clarification",\ + "$SOURCEC" using 1:2 with impulses lt 5 lw 15 title "not_held",\ + "$SOURCED" using 1:2 with impulses lt 6 lw 15 title "rejected",\ + "$SOURCEE" using 1:2 with impulses lt 7 lw 15 title "successful",\ + "$SOURCEE" using 1:2 with impulses lt 8 lw 15 title "partially_successful",\ + "$SOURCEE" using 1:2 with impulses lt 9 lw 15 title "requires_admin",\ + "< awk 'BEGIN { n = 0 } { n += \$2; print \$1, \$2, n; }' $SOURCEA" using 1:3 axes x1y2 with lines lt 2 title "cumulative total number of requests" +END +#echo "gpscript $GPSCRIPT" + +export GDFONTPATH=/usr/share/fonts/truetype/ttf-bitstream-vera +gnuplot < $GPSCRIPT > foi/public/foi-live-creation$EXTENSION + + @@ -1,5 +1,3 @@ -Museum aliases - FOI requests to use to test it ============================== @@ -34,6 +32,8 @@ BAILII - relationship with law courts, robots.txt ? Next ==== +Museum aliases + Watch this one: http://www.whatdotheyknow.com/request/crime_statistics_for_2007_champi @@ -45,15 +45,14 @@ described_at is needed for Users and Public Bodies for RSS Don't let people use email as their name -Make the "needs admin attention" have a text box? -Mask -bounce addresses too - Editing status in admin interface isn't putting it in info request events Do search for cases where current value doens't corespond to last event value Later ===== +Make the "needs admin attention" have a text box asking why + Highlight text search finds in word docs Edits to outgoing/incoming/title won't be reindexed in Xapian @@ -66,7 +65,7 @@ Plot graph of new request rate Enter > 255 char comment when editing public body gives unhelpful error -Put user rather than import_csv +Put name of admin user rather than import_csv Link more clearly to full request and next/previous correspondence (ask Matthew) Perhaps always redirect to internal # links from the /response/ pages |