~GSoC2010: Ankit Ahuja's Smart Playlists

anildash edited this page Mar 26, 2011 · 1 revision
Clone this wiki locally

Note: For the complete proposal, including personal details and experience, please see the proposal submitted on GSoC site (only visible to mentors).
However, the project details here are updated (more mockups) as compared to the ones in the proposal on GSoC site.

Project Abstract

A filtering solution for ThinkTank that will allow users to create playlists that contain replies based on filters associated with them. This will allow the user to categorize large number of replies and be able to analyze and evaluate them better.

I’ll also add the ability to sort/search through items in any list view. For example, in the “Posts → All” view, the user will be able to sort based on username, date posted, number of replies or number of times shared. Or the user can filter the replies based on a search term.

To read up on the discussion around this project, see this mailing list thread.

Project Description

Terminology

  • Rule: A rule is one condition (that can have multiple arguments).
    E.g.: contains(thinktank, expert labs) – This rule means that the text must contain the words ‘thinktank’ or ‘expert labs’ or both.
  • Filter: A Filter is a set of rules logically AND’d. E.g.: service has to be a,b or c AND content must include the word ‘thinktank’.
  • Playlist: A playlist is a collection of one or more filters and is the actual view presented to the user. User will be able to create playlists and collapse/expand similar replies.

Filter based playlists

These will be added as a separate “Playlists” section under the “Replies” view. User will be able to switch playlists to view the replies that are a part of a particular list. Filters will be created via dropdown boxes similar to the Smart Playlist creation in iTunes

User will be able to add multiple rules that together form a single filter. A Rule maybe based on the following:

1. Containing term(s) or phrase(s)
User may specify multiple terms/phrases separated by a ‘,’. If a post contains any of the specified terms, then the post satisfies the rule.

2. Time period
User may specify a time period and only those posts made in that time period will satisfy the rule. E.g.: User may specify a time period like ‘29 April 2010 to 9 April 2010’.

3. In reply to a particular post
User will be able to choose a recent post from a dropdown or explicitly enter the post id. Only those posts that were made in reply to the post will satisfy this rule.

Also, a “Playlist” Tab will be added to the post’s individual view i.e. “/thinktank/post/?t=postid” that will allow the user to select and view specific playlists for that post.

4. Containing Links
Any response containing a link will satisfy this rule.

5. Containing Photo
Any response containing a shared photo link will satisfy this rule.

Filter Syntax

Once the user creates a set of rules for a filter, these rules are combined together using a strict syntax to form a filter. This syntax is not visible to the user and is only used to avoid the requirement of another table ‘tt_rules’. Instead, the filter is saved as a single entry in the ‘tt_filters’ table.

Syntax will make use of keywords like contains, time, user, inreply, etc. and ‘&’ to combine rules.

Example:

user(a,b,c)&contains(iPhone) — This will be the filter composed of two rules:

1. the user who sent the post is either a,b or c
2. Post contains the text ‘iPhone’

Collapsible Similar Replies

A Playlist may contain one or more filters. Each of these filters’ results will be collapsible to a single entry or expandable to view the replies. When collapsed to a single entry, it will display the number of replies.

Here is a preliminary mockup:

Example:

One use case for collapsible replies will be to analyze responses for objective questions. User might have a question “Should I buy the iPad now?” or “Which smartphone should I buy?”. In the first case, she will be able collapse replies that contain “Yes” and those that contain “No” into two separate filter results. In the second case, responses will not be restricted to two but the user can create filters for the more popular answers.

Another use case will be to narrow down similar responses. If the user notices several replies with the same context, she can create a filter to combine responses with that context into a single entry.

Filter News Feed

Users will be able to use and modify filters created by other users. The news feed will be a “Filters” view in the public timeline where all the filters created by users will be listed. Users can favorite a filter, which will let other users sort the filters list based on the number of times it was favorited. Also, filters will be sortable based on number of users using them or time when the filter was created.

This Playlist model can later be extended to search terms and hashtags when those features are added to ThinkTank.

List view sorting/searching

This will allow the user to sort/search through a list of items. This will be added in almost all the standard list views and will span a limited number of replies, unlike the rule based playlists, which are meant to span all replies and are more permanent in nature.

It will include the following ways to modify the list:

1. Search: Filter the items in a list based on a search term. As soon as the user enters a piece of text in the search, only posts containing that term will be displayed.

2. Sort: Sort based on no. of replies, date posted, other column headings. Any sorting done can be persistent for that view.

3. No. of entries: Adjust the no. of entries to display on a single page.

Technical Details

Filter Based Playlists

Here is a mind map of my initial idea of implementation for filter-based playlists: http://www.mindmeister.com/46438163/rule-based-playlists-in-thinktank.

Since these lists will be permanent in nature and will span across a large number of replies to a user, the results for these will be maintained in the database instead of evaluating them every time a playlist is viewed.

This project will add the following tables to the ThinkTank database:

  • tt_playlists: It will contain all the playlists created in ThinkTank and relate them to their owners.
  • tt_filters: It will contain all the filters created in ThinkTank.
  • tt_playlists_filters: It will relate the playlists with their component filters.
  • tt_users_filters: It will help in distinguishing different instances of the same filter for multiple users. This way many users will be able to reuse the same filters.
  • tt_filter_cache: It will be used to relate replies with filter instances (in tt_users_filters)

The filter cache will be updated when a playlist containing the filter is viewed. To determine if a playlist’s filter cache needs updating, the ‘last_updated’ field of ‘tt_users_filters’ can be compared with the same field of the user in ‘tt_user’ to which the playlist containing the filter belongs. The updation can be done using AJAX to keep the app responsive during the updating.

All the code for this feature will be abstracted into three classes i.e. Playlist, Filter and Rule.

List view sorting/searching

This can be implemented either at the client side using JavaScript, if the no. of replies to sort and search through is limited. Or else, the sorting and searching can be done at the server and the results can be fetched using AJAX. The latter approach will be useful if the no. of items in the list is large. Using AJAX will minimize the no. of page refreshes and provide a better user experience.

Schedule of Deliverables

  • 27 April to 22 May: Get started by creating basic UI prototypes. Do more brainstorming and finalize implementation details. Also, get acquainted with the existing code base and code style rules.
  • 23 May to 10 June: Start work on client side list view sorting/searching. Implement search, sorting and ability to vary the number of entries to be displayed. Implement this in a limited number of views.
  • 11 June to 1 July: Start work on Filter based playlists. Add the playlist view and ability to create and save new playlists based on filters. Fix bugs.
  • 2 July to 15 July: Add ability to add multiple filters to a playlist. Fix bugs.
  • 16 July to 28 July: Add the filter news feed. Ability for users to add/favorite filters. Fix bugs.
  • 29 July to 10 August: Add finishing touches. Perform extensive testing. Fix any remaining bugs and add any left out features. Merge branch into master!
  • 11 August to 17 August: Document features. Maybe create a screencast illustrating all the features in the project. Play with ThinkTank UI or pick up and resolve any minor issues in the issues list.