From 878b2dbfe7b36928bcbb995049ec1c45972c4d12 Mon Sep 17 00:00:00 2001 From: francis Date: Fri, 11 Apr 2008 11:00:17 +0000 Subject: More graphy stuff --- bin/problem-creation-graph | 93 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100755 bin/problem-creation-graph (limited to 'bin/problem-creation-graph') diff --git a/bin/problem-creation-graph b/bin/problem-creation-graph new file mode 100755 index 000000000..a62de24f7 --- /dev/null +++ b/bin/problem-creation-graph @@ -0,0 +1,93 @@ +#!/bin/bash +# problem-creation-graph +# Plot graph of rate of problem creation +# +# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. +# Email: francis@mysociety.org. WWW: http://www.mysociety.org/ +# +# $Id: problem-creation-graph,v 1.1 2008-04-11 11:00:17 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 + +read_conf bci/conf/general + +SOURCEA=/tmp/bci-creation-rate-graph-data-$RANDOM$RANDOM +SOURCEB=/tmp/bci-creation-rate-graph-data-$RANDOM$RANDOM +SOURCEC=/tmp/bci-creation-rate-graph-data-$RANDOM$RANDOM +SOURCED=/tmp/bci-creation-rate-graph-data-$RANDOM$RANDOM +SOURCEE=/tmp/bci-creation-rate-graph-data-$RANDOM$RANDOM +GPSCRIPT=/tmp/bci-creation-rate-graph-script-$RANDOM$RANDOM + +# where status in ('draft') + +function grab_data { + echo "select + date(created), count(*) + from problem + $1 + group by date(created) + order by date(created) + ;" | psql --host $OPTION_BCI_DB_HOST --port $OPTION_BCI_DB_PORT -A -F " " $OPTION_BCI_DB_NAME $OPTION_BCI_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 status not in ('unconfirmed')" $SOURCEB +grab_data "where status not in ('unconfirmed', 'confirmed')" $SOURCEC +grab_data "where status not in ('unconfirmed', 'confirmed', 'fixed')" $SOURCED +grab_data "where status not in ('unconfirmed', 'confirmed', 'fixed', 'hidden')" $SOURCEE + + +state = 'unconfirmed' +or state = 'confirmed' +or state = 'fixed' +or state = 'hidden' +or state = 'flickr' + + +cat >$GPSCRIPT < pet/web-admin/bci-live-creation$EXTENSION + + -- cgit v1.2.3