17 | | i) How to Save your Search[[BR]] |
18 | | ii) Revisiting a Saved Search[[BR]] |
19 | | iii) Deletion of a Saved Search[[BR]][[BR]] |
20 | | |
21 | | |
22 | | Data Model |
23 | | |
24 | | The proposed data model for fulfilling the purpose is as follows - |
25 | | |
26 | | Search(Entity) |
27 | | User_id |
28 | | Search_criteria |
29 | | Datetime |
30 | | |
31 | | |
32 | | |
33 | | Key attributes – User_id, Search_criteria |
34 | | Other attribute(s) (may vary) – Datetime |
35 | | |
36 | | The search can be saved by sending them into the database. Usage of the web2py cache will also be employed . The User_id attribute, one of the key attribute here is a foreign key that will referenced from the auth_user entity (auth_user.id attribute preferably) from the already made databases. This and related database and tables that may come up as the project progresses will be implemented in the /models/savesearch.py file although there will be a few lines of code that would be added in the S3Search module (they won’t affect the code’s working) in order to store the search criteria/filters(put in use by the user to search his query) in the database later thereby saving the search if the user clicks on the save button. One prerequisite of the saving the search is that the user should be signed in to save his search result/query and also the number of recent searches that a particular user saves will be limited and when it exceeds that fixed limit, the least recent can then be deleted (this justifies the datetime attribute). The Search_criteria field will store the query and the filters that the user will employ for searching his query. |
37 | | |
38 | | However, this description just outlines the data model because I am still in the process of going through the S3Search module from which the following data model is going to gather the data. Presently, the idea is to add some lines to the S3Search module which won't affect the functioning of S3Search module in any but take out the data like the search criteria, user_id and datetime to store in savesearch database table. |
39 | | |
40 | | UI layout |
41 | | |
42 | | i) Widget on search results page – |
43 | | |
44 | | The widget for saving the search will appear on the search results page, basically it will be a button which asks the user the particular search must be saved. The user thus gets the option of saving the search, which if he/she uses will get saved in the database specified above using a function savesearch() in /controllers/search.py. Suitable adjustments for facilitating this function will be made via /views/search/save.html (tentatively). A very similar example for it can be viewed by clicking here. |
45 | | |
46 | | |
47 | | |
48 | | ii) Review of Saved Searches – |
49 | | |
50 | | A user interface would be made to view the searches that were made in the past. The user will have the option of reviewing the updated search results and delete the queries made in the past and other features that might get included as the project progresses. |
51 | | |
52 | | |
53 | | |
54 | | Subscription- |
55 | | |
56 | | http://eden.sahanafoundation.org/wiki/Projects/Advanced/Subscription |
57 | | |
58 | | After going through the subscription models implemented in various websites like the DRR Portal by Sahana-Eden, Yahoo Directories , Google Groups , StumbleUpon , Scrobbler API by last.fm and the ones implemented in my college IIIT-Hyderabad , a suitable subscription model which would look as described in the lines that follow. |
59 | | |
60 | | |
61 | | Data Model |
62 | | |
63 | | Subscribed_search (entity) |
64 | | Search_id |
65 | | Last_updated_datetime |
66 | | |
67 | | |
68 | | |
69 | | Key Attributes – Search_id (Foreign Keys) |
70 | | |
71 | | |
72 | | Subscription_mode (entity) |
73 | | User_id |
74 | | SMS_sub |
75 | | Twitter_sub |
76 | | Email_sub |
77 | | Type_email_sub |
78 | | |
79 | | |
80 | | |
81 | | Key Attributes – User_id(Foreign Key) |
82 | | |
83 | | |
84 | | The Search_id attribute in Subscribed_search (entity), is a foreign key referenced from the Search.id field(which get formed and is unique) of the Search table given in the data model for save search. This and related database and tables that may come up as the project progresses will be implemented in the /models/subscribe.py file. The Last_Updated_datetime attribute is taken in order to store the last time the user was sent the notification of update and so that the update can be made. The interval between the two notifications can be done on hourly/daily/weekly basis with the help of web2py cron and jenkins continous integration tool (thereby implementing the feature of customizing the frequency of notification). |
85 | | |
86 | | The User_id attribute in the Subscription_mode (entity) is a foreign key referenced from the auth_user entity (auth_user.id attribute preferably) from the already made databases. The SMS_sub , twitter_sub and email_sub will have yes/no option for the user tell which mode of the notfication they will prefer (this will be implemented with the help of messaging module present in the sahana-eden software, would have to look into the email-styling aspect). The type_email_sub will specify the frequency of notification through email. However, this description just outlines the data model because this data model depends a lot on the save search data model for retrieval of the data. So, there are bound to be some modifications as the job of designing proceeds. |
87 | | |
88 | | |
89 | | |
90 | | UI for Subscription |
91 | | |
92 | | The UI for subscribing to the saved searches can be implemented that the user would use for reviewing his saved searches. The saved searches will be ordered according to a particular field and there will be a subscribe button for each saved search listed there which the user can click on to subscribe to that saved search. Same page will also show the option for unsubscribing to a particular subscribed saved search. A very similar example for it can be viewed by clicking here. |
93 | | |
94 | | UI for Updated Subscription |
95 | | |
96 | | There will be a separate UI for the user to view the updation for his subscribed searches. This model can be based on something like google reader where the user will click on the subscribed saved searches and then would be able to see the updates on the UI. This model is a tentative one and can be modifed in future to allow more usability. A very similar example for it can be viewed by clicking here. |
97 | | |
98 | | There will be options to subscribe to different modes such as e-mail, sms, twitter etc apart from the UI provided for updated subscription. The mode of subscription will be user-preferred and it will be implemented by using the messaging module present in the sahana-eden software. The emails can be sent in two formats i.e. html or plaintext out of which plaintext seems to be a better option at this moment because it depends upon the user’s agent (end system) on how it displays the html content(which might differ from the desired form). Mock-ups for UI’s can be found below - |
99 | | |
100 | | Fig. 1 – Mock UI for Widget |
101 | | [[Image()]] |
102 | | |
103 | | |
104 | | |
105 | | |
106 | | Fig. 2 – Mock UI for Subscription Update |
107 | | |
| 16 | In an event of disaster, this functionality would help a lot in terms of providing information (take the example of dissemination of information related to availability of food, shelter, hospitals etc.). The project's essential capability is to disseminate information about various aspects through various means such as email/twitter/sms. Integrating this service into Sahana system will add to the platform's capability of tackling various issues faced in emergency/disaster management. |