blob: bfb467e639113cde64092145f30d101d1fd69a72 [file]
#summary for planning the work on statistics in Melange
#labels Importance-Details,Phase-Design,Contents-Draft
_This is a wiki page. It is intended that people edit and improve it!_
<wiki:toc max_depth="3" />
= GSoC Project Info =
|| Mario Ferraro || [http://socghop.appspot.com/student_project/show/google/gsoc2009/melange/t124022698336 Ajax Statistics module] ||
|| Daniel Hans || [http://socghop.appspot.com/student_project/show/google/gsoc2009/melange/t124022698771 Statistic Module] ||
= Gathering Data =
It would be very inefficient (and probably impossible because of GAE restrictions) to count all statistics every request. Instead of doing that, the all necessary data will be gathered periodically from the Melange data model, stats will be counted based on this data and they will be cached as [http://www.json.org JSON] objects in a new stats model. When a frontend component needs to display some statistics, it will be delivered a particular JSON object from the stats model.
Additionally, JSON objects in the stat model will be also cached in Melange memcache so as to improve effectiveness.
In order to gather data from the model Melange will be using [http://code.google.com/appengine/docs/python/config/cron.html Cron Jobs] which is a support for scheduled tasks provided by Google Application Enginge. There will be probably one Job for each statistic, but there is also a limitation that one application may have up to 20 scheduled tasks. Anyway (as Lennie suggested), we will avoid any troubles by using a single job which will fetch another url containing code for a particular statistic.
== Job Control Panel ==
* *Job Control Panel* Where you can define what stats you want to collect in what interval.
There are two possible ways to execute the gathering data jobs: they may be triggered by application engine in certain time intervals by setting in corn.yaml configuration page) or they may be executed by an administrator. The second option seems to be better, as it will allow the admin to start gathering data and making computations only for selected statistics which is important, because many of them do not change for most of the time.
Job Control Panel will be a new view that will allow an admin to pick the stats that need to be recalculated. There will be a table with all stats and next to each stat there will be a checkbox indicating whether this particular stat should be computed or not. After picking over the stat kinds, the admin will start the Job by pressing a button.
<Pawel> Ok, but also there should be a check box next to each stat to setup whether the stat should be automatically recalculated using Jobs or not in the given time interval
so basically this view will provide admin with a way of setting time intervals for stats that need them or recalculating manually selected stats</Pawel>
=== Initial Goals ===
* Set a job running to gather *location stats for accepted proposals*.
* Set a job to gather *location stats for submitted proposals*.
* Results will be *raw JSON* (at this stage).
_Need to decide precise format of this JSON data, (for clarity). An example here would help enormously._
According to [http://code.google.com/apis/visualization/documentation/using_overview.html#embeddingavis what Google Visualization asks for], something roughly like:
{{{
{
"title": "Title of graph",
"columns": [
{
"type": "string",
"name": "Country"
},
{
"type": "number",
"name": "N. Students"
}
],
"rows": [
{
"rowdata": [
"Country 1",
30
]
},
{
"rowdata": [
"Country 2",
40
]
}
]
}
}}}
In this way we can iterate through it as (take it as pseudo-JS-code, didn't test it yet):
{{{
var data = new google.visualization.DataTable();
for (var index in json.columns) {
data.addColumn(json.columns[index].type, json.columns[index].name);
}
data.addRows(json.rows.length);
for (var row_index in json.rows) {
for (var column_index in json.rows[row_index].rowdata) {
data.setValue(row_index, column_index, json.rows[row_index].rowdata[column_index]);
}
}
}}}
==== Statistics provisional data model ====
{{{
from google.appengine.ext import db
import soc.models.linkable
class StatisticJSON(soc.models.linkable.Linkable):
"""Model used to store a JSON representation of statistics
"""
#: internal String ID to get the correct statistics
stat_id = db.StringProperty(required=True)
#: name of the Statistic
stat_name = db.StringProperty()
#: long description of the Statistics
stat_description = db.TextProperty()
#: partial JSON representation, to be filled during the gathering of data
working_json_string = db.TextProperty()
#: percentual of completeness during gathering of data
percentual_complete = db.IntegerProperty()
#: final JSON representation, to be filled when data gathering is completed
final_json_string = db.TextProperty()
#: date when this calculation was last updated
calculated_on = db.DateTimeProperty(auto_now=True)
}}}
=== Later Goals for Job Control ===
* _...insert text here_
=== Stats ===
* Students per country/continent
* Students per school/continent
* Mentors per country
* Amount of mentors/students/org admins
* Server activity (e.g. big spike near deadlines).
* Organizations per program
* Application per organization / program
* Students, mentors and organization admins ages
* Connections between students and their mentors
* Dependencies between the fact that a student fails to complete his project and the distance between the student and his mentor
* Dependencies between a number of slots per organization and completion rate for this organization
* Dependencies between projects completion rate and student ages (or academic years)
* Standard statistc values (arithmetic mean, median, quadrille, etc)
= Displaying Stats =
== Stats Display Pages ==
=== Initial Goals ===
* Just raw JSON
=== Later Goals for Displaying Stats ===
* _...insert text here_
== Services/Libraries Used ==
* *[http://code.google.com/apis/chart/ Google Chart API]
*
* *[http://code.google.com/apis/visualization/documentation/gallery.html Google Visualization API]*
* *[http://www.clabberhead.com/googlechartgenerator.html Google Charts Generator]* (might be helpful for quickly testing Chart API output)
== Animated Displays ==
_Mario: What's the simplest change to the JSON data collected that would allow us to show one of these?_
Something like
{{{
{
[
{
"timestamp": timestamp1,
"caption": "If we want an additional description",
"data": JSONObject
},
{
"timestamp": timestamp2,
"caption": "Additional description 2",
"data": JSONObject
}
]
}
}}}
should suit our needs at a first glance. If _timestamp_ is not present we can consider the Array of JSONObjects (being _JSONObject_ a JSON object as defined formerly) as a simple order.
* *Drag slider* to see how profile changes over time, e.g. on a map.
* *Timestamped data* may be all that we need.
= Background Info =
* *[http://www.thousandparsec.com/~irc/logm/%23melange.2009-05-07.log.html Stats Meeting on IRC] - Key points:* Data will be collected by Jobs. This is the first step. Accordingly the [http://code.google.com/p/soc/issues/list?can=1&q=Issue+357&sort=id&colspec=ID+Summary 1000 record issue] is not a problem. Data will be presented as raw JSON (at this stage). Will be stored in GAE Model as a JSON string AND again as a memcache object. When you request the stats view you should get it right away. Loading from Jobs is very light. Although not ideal we could afford to collect stats all the time, even when there are no changes, though we intend to do better than that right from the start. Animated graphs may need strings collected at different times and/or timestamps in the data. Daniel and Mario to use this wiki to progress the Stats projects.
== Background Links ==
* *[http://spreadsheets.google.com/ccc?key=p6DuoA2lJToKmUzoSq6raZQ Spreadsheet]* - With several pages of reports/figures showing changes from year to year.
* *[http://google-opensource.blogspot.com/2008/04/two-top-10s-for-google-summer-of-code.html GSoC by location]* - A classic use of GSoC statistics. Shows that mixing stats and text on same page will be important.
* *[http://google-opensource.blogspot.com/2008/05/this-weeks-top-10s-universities-for.html GSoC by University]* - A gospo blog post of a similar nature.
* *[http://opentouch.info/tmp/ghop/ghop-stats.html GHOP Stats]* - Gospo page with GHOP stats.
= Who Does What? =
* LH has warned about student *projects that depend on work by other students*. It's important that neither student is ever held up 'waiting' for work by the other student. In the extreme case, if one student drops out, we don't want to end up with neither project succeeding.
* *End-to-end knowledge:* We're starting with the backend as being essential to getting anything. For project success, both students will need to know both front and backend. Both will be extending the range of tools and language features that they know.
* A conflicting goal: We also want to *avoid duplication of work*, with both students doing the same things at the same time - a particular risk near the start.
* The solution is *communication*. It's for Mario and Daniel to work out exactly how this will work, exactly how the work will be divided. To avoid duplications, they need to be teaching each other what they learn in developing their areas of Melange as they go along. Probably three way code reviews (one mentor involved), probably sharing of status reports, probably some other things too... This all needs to be worked out between Mario and Daniel with mentors looking on. Wiki should help as key information can be put here.
_Mario / Daniel: One way to split the initial data collection step is for Daniel to focus on the python/GAE side and Mario to create the very simple job control page. Is this a good way? I don't know. You'll need to talk to make sure you each have what you each need from the other. Wiki can be updated with progress on this._
== Spin Offs ==
* With two strong students on Stats we have more manpower than we strictly need for stats at this stage of Melange's development. Therefore, once the projects are started and on-track, we should be looking at spin offs that are motivated by the stats needs, that are for stats, but that happen to progress other important aspects of Melange too. Examples are in the *job scheduling*, we will be using the jobs for other tasks too, and refinements in jobs will benefit these. In presentation the *javascript* for configuring graphs will likely do double duty and be used in other places too. Lots of opportunities for creative flexible design. Details will need discussing with mentor(s) as projects progress.
= Other Details =
== Transclusion And Graphing Syntax =
* We'd like to be able to embed charts and graphs in a page of explanation and commentary. We'd have a URL for the raw 'graph', and we'd provide parameters to that on that page. This will have permissions just like documents do. Then in a document we transclude the named chart using something like *$Pie(!ChartName)*. We can have more than one chart on a page.
_...More details_
== Tagging ==
_Discussion of *[TagsInMelange tagging]* and how it fits into statistics. E.g will want pie charts based on tags._
<Pawel>yes this is something we want for GHOP for sure.</Pawel>
= Questions =
*Q:* This year many orgs are by choice mentoring fewer students and adding tougher qualification requirements. We're interested in whether mentor:student ratios have increased and what other changes may go with this. Are there questions we should ask *LH to ask for mid term survey* that would help here?
*A:*
*Q:* Many stats are possible. What are the *'big win' stats*, the ones that are most likely to tell us how to improve GSoC?
*A:*
*Q:* *GHOP stats:* What stats are specific to GHOP and not part of GSoC? _Answers will end up on *[GHOP]* page (to coordinate work with that project)._
*A:* Just have a look at my last year *[http://opentouch.info/tmp/ghop/ghop-stats.html GHOP Statistics page] and you should get an idea what kind of stats are GHOP specific.