Tuesday, June 16, 2009

Statistic Module update

I am sorry for a fewer number of my commits for the last couple of days. As I wrote, I was quite busy with some other things for some time, but I also worked on Melange related stuff.

First of all, I added service for a few more statistics. They are also quite simple, but I did this boring job to match all countries with thier continents. Of course I am still in dilema about some countries - to which continent they actually belong. The most importatnt are Russia and Turkey, but for now I assigned them to Europe.

The most important thing that I did for the last week was to find a way how to deal with stats that does not belong to a particular program.
Basically, we can divide all kind of stats that we already have into two types: stats that depend on data from one program and global stats that get data from various programs. Anyway, each models that is a subclass of Linkable has attributes like link_id, scope and scope_path. For most existing models (or I can say, for all models that I checked) scope is well-defined. For example, we know that a scope for a program is sponsor or a scope for a student project is organization. However, for statistics it would be better if the scope could be determined dynamically (depending whether the statistic is global or not). So, it took some time and several attempts before I came up with a good (IMHO:) solution.

I will try to explain the final solution. First of all, it is a compromise in some way. It does not have any dynamic scope assigment, because I have to admit that I do not know how to do it. I mean it could be possible, but I think it would require an awful lot of new code and it would be like reinventing the wheel. Therefore, each statistic is still defined for a particular program, but there is a new property in statistic model: access_for_other_programs. It may have one of three possible values: invisible, visible or collectable. If a statistic is marked as invisible, it is local for a program in scope - on other programs have access to it. For statistics that should be global, there are the two other options. Visible means that a statistic which is defined for a certain program may be also read-only accessed by other programs, while collectable stats may be also collected by other program administrators.

I will update statistic module wiki page with description of those changes by tomorrow.

No comments:

Post a Comment