Difference between revisions of "Summer of Code/2013/moksaya"

From Sugar Labs
Jump to navigation Jump to search
Line 45: Line 45:
 
*ForkResource
 
*ForkResource
  
At the Top most level ,Profile/list contains all the UserProfiles along with their Related Resources.
+
At the Top most level Profile/list contains all the User Profiles along with their Related Resources.
So , a typical user profile contains User info like About , Birthdays , etcs then the Related Resources Projects , Friends List , Likes on Projects (Can be easily extended for comments or other models).
+
So , a typical user profile contains User info like About , Birthdays etcs then the Related Resources Projects , Friends List , Likes on Projects (Can be easily extended for comments or other models).
Most of these Related Resources can be further assessed individually as well  
+
Most of these Related Resources can be accessed individually as well.
  
  

Revision as of 22:36, 4 July 2013

Moksaya Project :

A Dajngo based web app aimed at sharing and collaboration of sugar activities to foster learning and creativity

Goal of this project is to implement a Project Sharing site to foster collaboration and sharing of Sugar Activities over the internet.The website upon the completion would also provide REST-API’s , so that the services of the website could be utilised by the Sugar Activities to share the project on the site from within the Sugar Environment.

Key Deliverables :

Here I have listed the Key features that I am currently working on , however as we go through the course of GSoC new features will be added ,once we have a concrete and stable base infrastructure for the Social Project Sharing site.

  • Social Features : Following/Followers , Like , favourites , share , Comments .etc
  • Authenticated RESTful API's :Ability to interact with website from various Sugar Activities
  • Separate landing pages for different audiences (kids, teachers, parents, etc.)
  • Gallery : Ability for users to create portfolio of their projects.

Repository

I am developing this project under the Moksaya branch on my Github.


Progress


At the moment , I am aiming to get a basic set of features that a Social site like this should offer.So the first phase deals with developing a minimal functional site that offers basic set of social networking features and Project sharing capabilities.


UI/UX

The User interface and user experience of the site is an essential feature , we have to get this part right as this whole project's target audience is Kids so the UI should be simple yet should be attractive to kids and the user experience should be done in a way such that if kids use the site ,they are comfortable with all the functionality being offered by the site and engage on the site. Here are some of my Design Approach :

I am planning to stage the site on PaaS platform maybe like OpenShift , however there have been certains glitches with my Openshift account but I will try to work it out or consider some other feasible alternative. I am doing this because with this approach I would be able to get user feedback from community members side by side with my development efforts and hence I can iterate and improve with their feedbacks.


Site Model

I have planed to design the RESTful interface to the Moksaya project , and I plan to consume these APIs with a webapp possibly written with Backbone.js Initially Moksaya project offers a RESTful interface to the following interrelated models :

  • ProfileResource
  • ProjectResource
  • CommentResource
  • LikeResource
  • ForkResource

At the Top most level Profile/list contains all the User Profiles along with their Related Resources. So , a typical user profile contains User info like About , Birthdays etcs then the Related Resources Projects , Friends List , Likes on Projects (Can be easily extended for comments or other models). Most of these Related Resources can be accessed individually as well.


 {
   "meta": {
       "limit": 20, 
       "next": null, 
       "offset": 0, 
       "previous": null, 
       "total_count": 3
   }, 
   "objects": [
       {
           "about_me": "DjangoNaut", 
           "birth_date": "1991-06-20", 
           "friends": [
               "testuser", 
               "SomeDude"
           ], 
           "gender": 1, 
           "language": "en", 
           "location": "India", 
           "mugshot": "/media/mugshots/d749832b7a.jpg", 
           "privacy": "registered", 
           "projects": [
               {
                   "Likes": 3, 
                   "comment": [
                       {
                           "entry": "Another story i am covering and i want to test the constrains this time", 
                           "resource_uri": "", 
                           "text": "MAhn this is some awesome shit "
                       }, 
                       {
                           "entry": "Another story i am covering and i want to test the constrains this time", 
                           "resource_uri": "", 
                           "text": "cool Man comments are returned in APIs"
                       }
                   ], 
                   "desc": "here is another hack by me and I am doing this right now", 
                   "owner": "aregee", 
                   "screenshot": "/media/projects/Screenshot_from_2013-01-21_030756.png", 
                   "shared_date": "2013-06-25T18:48:18.205760", 
                   "src": "/media/proejcts/admin.py", 
                   "title": "Another story i am covering and i want to test the constrains this time"
               }, 
               {
                   "Likes": 1, 
                   "comment": [], 
                   "desc": "Wired Hack ", 
                   "owner": "aregee", 
                   "screenshot": "/media/projects/background.png", 
                   "shared_date": "2013-06-26T05:59:48.445868", 
                   "src": "/media/proejcts/startconky.sh", 
                   "title": "Someting Wong"
               }, 
               {
                   "Likes": 0, 
                   "comment": [], 
                   "desc": "This is my first hello world code", 
                   "owner": "aregee", 
                   "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png", 
                   "shared_date": "2013-07-04T19:18:23.307241", 
                   "src": "/media/proejcts/hello.c", 
                   "title": "First Project Upload"
               }
           ], 
           "user": "aregee", 
           "website": "http://rahulgaur.info/"
       }, 
       {
           "about_me": "Profile BIO", 
           "birth_date": "2013-06-26", 
           "friends": [
               "aregee", 
               "SomeDude"
           ], 
           "gender": 2, 
           "language": "en", 
           "location": "Delhi", 
           "mugshot": null, 
           "privacy": "registered", 
           "projects": [
               {
                   "Likes": 3, 
                   "comment": [], 
                   "desc": "This is my first hello world code", 
                   "owner": "testuser", 
                   "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png", 
                   "shared_date": "2013-06-27T15:31:22.560494", 
                   "src": "/media/proejcts/hello.c", 
                   "title": "First Project Upload"
               }, 
               {
                   "Likes": 0, 
                   "comment": [], 
                   "desc": "Wired Hack ", 
                   "owner": "testuser", 
                   "screenshot": "/media/projects/background.png", 
                   "shared_date": "2013-07-04T19:37:54.184572", 
                   "src": "/media/proejcts/startconky.sh", 
                   "title": "Someting Wong"
               }
           ], 
           "user": "testuser", 
           "website": "http://Something.com/"
       }, 
       {
           "about_me": "Hello I am a dummy User here and I am doing something very amazing", 
           "birth_date": "2013-07-02", 
           "friends": [
               "aregee", 
               "testuser"
           ], 
           "gender": 1, 
           "language": "en", 
           "location": "India", 
           "mugshot": "/media/mugshots/0ebb9512eb.jpg", 
           "privacy": "registered", 
           "projects": [], 
           "user": "SomeDude", 
           "website": "http://somedude.com/"
       }
   ]
 }
 {
   "about_me": "Profile BIO", 
   "birth_date": "2013-06-26", 
   "friends": [
       "aregee", 
       "SomeDude"
   ], 
   "gender": 2, 
   "language": "en", 
   "location": "Delhi", 
   "mugshot": null, 
   "privacy": "registered", 
   "projects": [
       {
           "Likes": 3, 
           "comment": [], 
           "desc": "This is my first hello world code", 
           "owner": "testuser", 
           "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png", 
           "shared_date": "2013-06-27T15:31:22.560494", 
           "src": "/media/proejcts/hello.c", 
           "title": "First Project Upload"
       }, 
       {
           "Likes": 0, 
           "comment": [], 
           "desc": "Wired Hack ", 
           "owner": "testuser", 
           "screenshot": "/media/projects/background.png", 
           "shared_date": "2013-07-04T19:37:54.184572", 
           "src": "/media/proejcts/startconky.sh", 
           "title": "Someting Wong"
       }
   ], 
   "user": "testuser", 
   "website": "http://Something.com/"
 }
 {
   "meta": {
       "limit": 20, 
       "next": null, 
       "offset": 0, 
       "previous": null, 
       "total_count": 5
   }, 
   "objects": [
       {
           "Likes": 3, 
           "comment": [
               {
                   "entry": "Another story i am covering and i want to test the constrains this time", 
                   "resource_uri": "", 
                   "text": "MAhn this is some awesome shit "
               }, 
               {
                   "entry": "Another story i am covering and i want to test the constrains this time", 
                   "resource_uri": "", 
                   "text": "cool Man comments are returned in APIs"
               }
           ], 
           "desc": "here is another hack by me and I am doing this right now", 
           "owner": "aregee", 
           "screenshot": "/media/projects/Screenshot_from_2013-01-21_030756.png", 
           "shared_date": "2013-06-25T18:48:18.205760", 
           "src": "/media/proejcts/admin.py", 
           "title": "Another story i am covering and i want to test the constrains this time"
       }, 
       {
           "Likes": 1, 
           "comment": [], 
           "desc": "Wired Hack ", 
           "owner": "aregee", 
           "screenshot": "/media/projects/background.png", 
           "shared_date": "2013-06-26T05:59:48.445868", 
           "src": "/media/proejcts/startconky.sh", 
           "title": "Someting Wong"
       }, 
       {
           "Likes": 3, 
           "comment": [], 
           "desc": "This is my first hello world code", 
           "owner": "testuser", 
           "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png", 
           "shared_date": "2013-06-27T15:31:22.560494", 
           "src": "/media/proejcts/hello.c", 
           "title": "First Project Upload"
       }, 
       {
           "Likes": 0, 
           "comment": [], 
           "desc": "This is my first hello world code", 
           "owner": "aregee", 
           "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png", 
           "shared_date": "2013-07-04T19:18:23.307241", 
           "src": "/media/proejcts/hello.c", 
           "title": "First Project Upload"
       }, 
       {
           "Likes": 0, 
           "comment": [], 
           "desc": "Wired Hack ", 
           "owner": "testuser", 
           "screenshot": "/media/projects/background.png", 
           "shared_date": "2013-07-04T19:37:54.184572", 
           "src": "/media/proejcts/startconky.sh", 
           "title": "Someting Wong"
       }
   ]
 }
 

In the above results I have excluded Project ids from the json Response, but similarly each individual project could be accessed and updated by making GET or Post or Put request to http://127.0.0.1:8000/api/v1/projects/<pk>?format=json

 {
   "Likes": 1, 
   "comment": [], 
   "desc": "Wired Hack ", 
   "owner": "aregee", 
   "screenshot": "/media/projects/background.png", 
   "shared_date": "2013-06-26T05:59:48.445868", 
   "src": "/media/proejcts/startconky.sh", 
   "title": "Someting Wong"
}

Forking

Lets take a look at how forking works here , though this is not really the best approach but I am doing this for understanding purpose and would figure out the proper solution for this .. but for now here it is.

  • Lets say these are the projects on the Moksaya submitted by the user :
 {
   "meta": {
       "limit": 20, 
       "next": null, 
       "offset": 0, 
       "previous": null, 
       "total_count": 3
   }, 
   "objects": [
       {
           "Likes": 3, 
           "comment": [
               {
                   "entry": "Another story i am covering and i want to test the constrains this time", 
                   "resource_uri": "", 
                   "text": "MAhn this is some awesome shit "
               }, 
               {
                   "entry": "Another story i am covering and i want to test the constrains this time", 
                   "resource_uri": "", 
                   "text": "cool Man comments are returned in APIs"
               }
           ], 
           "desc": "here is another hack by me and I am doing this right now", 
           "id": 1, 
           "owner": "aregee", 
           "screenshot": "/media/projects/Screenshot_from_2013-01-21_030756.png", 
           "shared_date": "2013-06-25T18:48:18.205760", 
           "src": "/media/proejcts/admin.py", 
           "title": "Another story i am covering and i want to test the constrains this time"
       }, 
       {
           "Likes": 1, 
           "comment": [], 
           "desc": "Wired Hack ", 
           "id": 2, 
           "owner": "aregee", 
           "screenshot": "/media/projects/background.png", 
           "shared_date": "2013-06-26T05:59:48.445868", 
           "src": "/media/proejcts/startconky.sh", 
           "title": "Someting Wong"
       }, 
       {
           "Likes": 3, 
           "comment": [], 
           "desc": "This is my first hello world code", 
           "id": 3, 
           "owner": "testuser", 
           "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png", 
           "shared_date": "2013-06-27T15:31:22.560494", 
           "src": "/media/proejcts/hello.c", 
           "title": "First Project Upload"
       }
   ]
 }
  • Now I am logged in as aregee , and here is my profile at 127.0.0.1:8000/api/v1/profile/list/1/?format=json
 {
   "about_me": "DjangoNaut", 
   "birth_date": "1991-06-20", 
   "friends": [
       "testuser", 
       "SomeDude"
   ], 
   "gender": 1, 
   "language": "en", 
   "location": "India", 
   "mugshot": "/media/mugshots/d749832b7a.jpg", 
   "privacy": "registered", 
   "projects": [
       {
           "Likes": 3, 
           "comment": [
               {
                   "entry": "Another story i am covering and i want to test the constrains this time", 
                   "resource_uri": "", 
                   "text": "MAhn this is some awesome shit "
               }, 
               {
                   "entry": "Another story i am covering and i want to test the constrains this time", 
                   "resource_uri": "", 
                   "text": "cool Man comments are returned in APIs"
               }
           ], 
           "desc": "here is another hack by me and I am doing this right now", 
           "id": 1, 
           "owner": "aregee", 
           "screenshot": "/media/projects/Screenshot_from_2013-01-21_030756.png", 
           "shared_date": "2013-06-25T18:48:18.205760", 
           "src": "/media/proejcts/admin.py", 
           "title": "Another story i am covering and i want to test the constrains this time"
       }, 
       {
           "Likes": 1, 
           "comment": [], 
           "desc": "Wired Hack ", 
           "id": 2, 
           "owner": "aregee", 
           "screenshot": "/media/projects/background.png", 
           "shared_date": "2013-06-26T05:59:48.445868", 
           "src": "/media/proejcts/startconky.sh", 
           "title": "Someting Wong"
       }
   ], 
   "user": "aregee", 
   "website": "http://rahulgaur.info/"
 }


* Now I want to fork the Project with id = 3 created by testuser , so I will make a GET request to 127.0.0.1:8000/api/v1/forking/3/?format=json
  {
   "Changes": {
       "owner": "testuser", 
       "shared_date": "2013-06-27T15:31:22.560494"
   }, 
   "desc": "This is my first hello world code", 
   "resource_uri": "/api/v1/forking/3/", 
   "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png", 
   "shared_date": "2013-06-27T15:31:22.560494", 
   "src": "/media/proejcts/hello.c", 
   "title": "First Project Upload"
 }

The diffs / metadata could be viewed for the changes made , for instance here the response shows the original author of the project and the date it was shared


  • Lets take a look at my Profile again at 127.0.0.1:8000/api/v1/profile/list/1/?format=json
 {
   "about_me": "DjangoNaut", 
   "birth_date": "1991-06-20", 
   "friends": [
       "testuser", 
       "SomeDude"
   ], 
   "gender": 1, 
   "language": "en", 
   "location": "India", 
   "mugshot": "/media/mugshots/d749832b7a.jpg", 
   "privacy": "registered", 
   "projects": [
       {
           "Likes": 3, 
           "comment": [
               {
                   "entry": "Another story i am covering and i want to test the constrains this time", 
                   "resource_uri": "", 
                   "text": "MAhn this is some awesome shit "
               }, 
               {
                   "entry": "Another story i am covering and i want to test the constrains this time", 
                   "resource_uri": "", 
                   "text": "cool Man comments are returned in APIs"
               }
           ], 
           "desc": "here is another hack by me and I am doing this right now", 
           "id": 1, 
           "owner": "aregee", 
           "screenshot": "/media/projects/Screenshot_from_2013-01-21_030756.png", 
           "shared_date": "2013-06-25T18:48:18.205760", 
           "src": "/media/proejcts/admin.py", 
           "title": "Another story i am covering and i want to test the constrains this time"
       }, 
       {
           "Likes": 1, 
           "comment": [], 
           "desc": "Wired Hack ", 
           "id": 2, 
           "owner": "aregee", 
           "screenshot": "/media/projects/background.png", 
           "shared_date": "2013-06-26T05:59:48.445868", 
           "src": "/media/proejcts/startconky.sh", 
           "title": "Someting Wong"
       }, 
       {
           "Likes": 0, 
           "comment": [], 
           "desc": "This is my first hello world code", 
           "id": 4, 
           "owner": "aregee", 
           "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png", 
           "shared_date": "2013-07-04T20:46:43.062294", 
           "src": "/media/proejcts/hello.c", 
           "title": "First Project Upload"
       }
   ], 
   "user": "aregee", 
   "website": "http://rahulgaur.info/"
 }


  • And the list of projects at 127.0.0.1:8000/api/v1/projects/
 {
   "meta": {
       "limit": 20, 
       "next": null, 
       "offset": 0, 
       "previous": null, 
       "total_count": 4
   }, 
   "objects": [
       {
           "Likes": 3, 
           "comment": [
               {
                   "entry": "Another story i am covering and i want to test the constrains this time", 
                   "resource_uri": "", 
                   "text": "MAhn this is some awesome shit "
               }, 
               {
                   "entry": "Another story i am covering and i want to test the constrains this time", 
                   "resource_uri": "", 
                   "text": "cool Man comments are returned in APIs"
               }
           ], 
           "desc": "here is another hack by me and I am doing this right now", 
           "id": 1, 
           "owner": "aregee", 
           "screenshot": "/media/projects/Screenshot_from_2013-01-21_030756.png", 
           "shared_date": "2013-06-25T18:48:18.205760", 
           "src": "/media/proejcts/admin.py", 
           "title": "Another story i am covering and i want to test the constrains this time"
       }, 
       {
           "Likes": 1, 
           "comment": [], 
           "desc": "Wired Hack ", 
           "id": 2, 
           "owner": "aregee", 
           "screenshot": "/media/projects/background.png", 
           "shared_date": "2013-06-26T05:59:48.445868", 
           "src": "/media/proejcts/startconky.sh", 
           "title": "Someting Wong"
       }, 
       {
           "Likes": 3, 
           "comment": [], 
           "desc": "This is my first hello world code", 
           "id": 3, 
           "owner": "testuser", 
           "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png", 
           "shared_date": "2013-06-27T15:31:22.560494", 
           "src": "/media/proejcts/hello.c", 
           "title": "First Project Upload"
       }, 
       {
           "Likes": 0, 
           "comment": [], 
           "desc": "This is my first hello world code", 
           "id": 4, 
           "owner": "aregee", 
           "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png", 
           "shared_date": "2013-07-04T20:46:43.062294", 
           "src": "/media/proejcts/hello.c", 
           "title": "First Project Upload"
       }
   ]
 }


Difference among the two Projects can be tracked by Project.objects.get(pk = 4).diff(Project.objects.get(pk = 3)) , its a method provided by the django-forkit app to view changes / differences in the forkable models. Meta data field needs to bee added to Projects field so that we can save these differences when a project is forked , and every project should contain a link to original creator.

TODOS

  • Add Authentication
  • Provide Full CRUD access to authenticated user to the core site functionalities : Like , Comment , UserProfile, Projects etcs
  • Improve the forking functionality
  • Implement JavaScript Client to consume APIs to get a minimal functional product up and running