Thursday, June 11, 2009

Google Summer of Code 2009: Mid Third Week - status update!

Hello everyone,
I am leaving for the bachelor degree final end semester examination. The progress of this week is short and swift. Fixed up the problems Lennard indicated in the GHOP Program view I had submitted. The timeline now works properly for GHOP. In this regard, I added a GHOP Timeline view. Made changes to soc.logic.models.program by replacing the TIMELINE_LOGIC dictionary with self.timeline_logic property in the model to point to GSoC timeline logic. Added an identical property in soc.modules.ghop.logic.models.program to point to GHOP timeline logic.

Added getExtraMenus for GHOP Program view and a GHOP Organization view. Further I am still working on task quota limits. But I am quite sure, it is almost close to complete, given that the background work, i.e its dependencies are already in place.

Catch you all on June 19th. See you!

Monday, June 8, 2009

Newsfeed Status Update

Working on the news_feed feature has required work in all the different sections of the codebase (Model, logic, caching, view, template) and has required updates to about a dozen existing modules. As you can imagine, merging upstream is a fun exercise in getting aquainted with some of the more advanced features of version control.

The mechanics behind the news feed are very simple, at least to start with. Whenever an entity - a document, for instance - is created, updated, or deleted, it gathers a list of receivers. The implementation right now is limited to the scope of linkable models, but luckily that covers almost all of the use-cases where we'd want the news feed to be updated.

A new FeedItem entity is created for each receiver - since the receiver in the current implementation is the scope, the receiver is only one entity, but I'm working on a method to propagate news feed updates like an event bubbling up through a hierarchy.


A news feed is constructed for the receiver entities - such as Program, Organization, Club, etc. - and aggressively cached. The template for the news feed itself is very similar to how blogs are formatted in Melange.

One part of the template has been a big headache - the link redirecting to the sender entity.

Right now, this is what the link HTML template looks like -

href="/{{ item.sender.kind.lower }}/show/{{ item.sender.key.name }}"


Yes, it's hacky. But it works...most of the time. When the sender's kind name is "Document", then this translates to /document/, which is what we want. But when the sender's kind name is "StudentProject", this is rendered as /studentproject/, while it should be /student_project/. I'm still figuring out how to properly linkify an arbitrary entity...and I tried using the redirect views helper, but I was hoping to do something that wouldn't require any additional server-side code.

The next week has a lot of challenging tasks ahead. Now that the basic implementation is working, I'm going to work on automation and testing. I'm also going to code up an ATOM feed that can be used to export news feed updates. (This shouldn't be a security issue, since news feed updates only include very basic information and a link to the entity for further information)

Surveys also need to have their ACL component finished so they can be taken for midterms...I've struggled with this when attempting it before, but GSOC needs this feature working, so I'm going to have to figure out a way to do it.

Finally, I've also updated logic for surveys and documents so that based on the prefix of the document, it creates a scope property. This way, the scope doesn't have to be retrieved at runtime and the document model is more in sync with the rest of Linkable entities.

Google Summer of Code 2009: Second Week - status update!

Hi everyone,
Time for status update of the second week spanning from June 1st-7th! This week was a very productive one from my point of view. Spent most of the time, rather all of my time coding for Melange this week without any other distractions (especially University :D ). As set out in the previous week's post, I completed moving all the code from app/ghop to app/soc/modules/ghop.

The respective templates and contents of ghop also have been moved from app/ghop/templates to app/soc/templates/modules/ghop and app/ghop/content to app/soc/content/modules/ghop. A callback.py python module was added to ghop module and necessary changes have been made in app/app.yaml.template and app/settings.py.

Secondly all the logic modules corresponding to each model defined specifically for GHOP (app/soc/modules/ghop/models/*) have been defined and committed. These logics are, "do nothing special" logic modules. They just inherit from their respective super classes, but do nothing specific about GHOP yet. The GHOP specific functionality is added in the due course for the necessary logic modules.

Thirdly, as I had said, I mostly concentrated on writing views. My first view, view for GHOPProgram create/edit is almost ready for commit. There are few small changes that are need to be made. I might send the updated patch by tonight. So everything required to get the views working is in place by now. I am also working on writing the second GHOPProgram view required, i.e the task quota limit view. I realized, to define this view, we also require view for GHOPOrganization to be in place. So this is a work in progress for now. I will be completing it as soon as possible.

Unfortunately I could not complete the work GHOPProgram views this week, because of unexpected delays in moves and defining the necessary logic. Also could not take time to include taggable-mixin support in models and could not move to GHOPOrganization views.

I will work on GHOPOrganization views for most of the time this week, along with completing the GHOPProgram views, since the latter is dependent on the former. Also unfortunately, because of my bachelor degree's final semester's end sem examination, I need to break from 11th of June upto 18th of June. I will have no time to work on Melange or anything else other than performing muggathons in long stretches of time(sleepless nights) :( I will not be able to attend conference calls next week, neither will I be able to update the blog/wiki, nor I will be available in GTalk/IRC. But I am quite sure I will compensate for this loss, by slogging in the subsequent weeks to come.

See you all, 2 weeks later :(

Thursday, June 4, 2009

Google Summer of Code 2009: Statistics module weekly report

So, here we are up and running! The Statistics project, which I'm really happy to share with Daniel, aims on collecting and displaying statistics data out of Melange.

I've spent my first week mainly on research and on the design of the Javascript layer that will be used for the Stats module, studying and testing libraries that will be of some use (hopefully) generally to the whole Melange project, too. The first thing I've done has been writing some code to get a first chart with Google Visualization API using Google API Playground, then I worked on studying how to use jQueryUI to get an iGoogle style dashboard interface for statistics module, finding this great tutorial from NetTuts, that could lead us to a cool interface. Then I had a meeting with Daniel, who had a great patience on giving me guidance on the Python code he started to write for the module backend, and we discussed on how to join our code, then Daniel set up the bitbucket repository he mentioned in his post.

During that meeting and afterwards, I've found Gviz lib and we agreed with Daniel that it would have lead to a smoother code for the communication between Python and Javascript. That library outputs "ready-to-serve" JSONs to Google Visualizations. Now it's already integrated in the main Melange trunk by Pawel for us to use it.

From that library on, I've got to know Google Visualization Query Language, which I thought it would be very powerful for us to show dynamic charts based on dynamic data. Unfortunately, there are no implementations for Python, so I tried to find something to get similar power in JavaScript. In that way I've found three great projects to query over JSON objects: JSONPath, JSONQuery and jLinq. I really like the functional way in which jLinq works, but I'm going to explore in the next week also the "XPath-like" ways, to have a better view on what's out there on JSON objects querying and what could be better for us to integrate.

Apart from that, I've started threads in the dev list and then put in the wiki some thoughts and contributes about a "medium-term" refactoring of Melange JavaScript layer and a draft proposal for JavaScript code style guidelines.

This week I will explore (or, better, I'm exploring, as I'm posting the report late :)) the JSON querying libraries, write on the wiki the design of the JS layer, and, hopefully, get a first skeleton code out of that design.

Newsfeeds Status Update

The Newsfeed concept is very simple - stream updates about things on the site, link to them, and offer ways they can be viewed outside the application.

The Newsfeed logic works by using a onCreate, onUpdate, and onDelete hook to create and save new feed items for a group of receivers, like programs and users that are associated with it. On the view side, these feed items are loaded, cached, and rendered.

There is then a simple HTML template that creates a table containing each update, with a link back to the sender entity, the type of update, and a timesince property. It can also render a payload for each feeditem, which can be any HTML or widget.

The receiver logic needs to be hardcoded for each entity type (or sometimes, groups of subclassed entities). I spent a few days trying to make a universal logic component, but the linkable scope property isn't designed for this kind of threading between entities. So the FeedItem model each stores a sender_key and a receiver_key. A one to many relationship via PolyMorphism would also be possible, but wouldn't necessarily be advantageous from a performance perspective.


The next tasks I'll be working on are tests (and tests for surveys), and then feed export functionality. I'd also like to do some refactoring to make it easier to subclass newsfeed functionality and to propagate "waves" of newsfeed updates as events bubbling up the heirarchy.

Speaking of which, it would be a lot of fun to make a Google Wave integration...

Tuesday, June 2, 2009

My first week update

Hey,

here is my update on what have been done for statistic module during the first week (May 22 - May 28) of Google Summer of Code. Sorry for posting so late, but as I said on our conference call, I had to prepare a presentation for my classes and was quite busy. As always, when I have a few months for something, I end up doing it on the last night before deadline:-P
Anyway, these days, I worked mainly on backend side of the module.
First of all a new model for keeping stats was designed. It is placed in soc.models.statistic and is designed so that statistics can be collected in batches.
After that I implemented a new view for managing stats. This site just lists all statistics defined for a given program and allows user to collect them batch by batch. It uses standard Melange 'list' view.
The next view displays field values for a particular stats. It does not use any visualization, but shows only raw json strings for collected statistic. It uses standard 'public' view.
Some statistics are very similar to each other in their nature, so on the logic side, I aimed to implement some kind of framework that would make adding similar stats as easy as possible. Some instructions on how to do that have been put on wiki.
Aside from coding, an important thing was my meeting with Mario. I explained him the code I wrote (or I tried, but probably was not so good:) and we discussed some issues about displaying statistics to the users and Mario told me about a few technologies that he is planning for us to use. Jlinq seems to be very powerful, but probably Mario will describe it better:)
We also set up a repository to which we will be uploading our code changes. You can check it out at http://bitbucket.org/dhans/statistic-module-for-melange/

Google Summer of Code 2009: First week - status update!

Hello everyone. I wanted to make my first blog post here very special, by narrating the entire story of how I got into Melange development and why I love to work with this brilliant team of Melange developers :P However time constraints (University and other work) never allowed me to write it till now. I will be writing it as soon as I find time to organize the contents for it.

Anyways coming back to the topic, first week status update(23-30, May, 2009). As planned in the schedule, I completed writing code for all the models. This was mostly a translation of the model design document on the wiki, to Google App Engine model code. This is already reviewed and committed into the code base. The new models I introduced were:
  1. ghop.models.task.GHOPTask
  2. ghop.models.program.GHOPProgram
  3. ghop.models.organization.GHOPOrganization
  4. ghop.models.comment.GHOPComment
  5. ghop.models.timeline.GHOPTimeline
  6. ghop.models.work_submission.GHOPWorkSubmission
  7. ghop.models.org_prize_assignment.GHOPOrgPrizeAssignment
I was slightly ahead of schedule, but University monthly tests put a break on the pace. Took a break for 2 days for tests and 1 day for travelling. I am all set now, and hopefully I don't have any other commitments in between except end sems.

I also started working on Views in the mean time. I started with Views for the Program and the Program Admin. I am currently writing the view for GHOP Specific program configuration for Program Admin. Also at the same time, discussions on Melange modular architecture is done and some concrete work is in place. So I am working on redesigning params.py in app/soc/views/helper and making the GHOP a pulg-gable module. So a bit of code re-organization is happening too.

Thats about the previous week. This week (31 May - 6 June, 2009), I will be completing the code re-organization. I will spend most of time working on Program Admin views. Also taggable-mixin code has been checked into the repository. I will take a look at it, and if everything goes as expected, I will complete adding tags support in GHOPTask Models for GHOP Tasks. And finally, if time permits, I will start working on Organization views.