Table of Contents
Save Search & Subscription
Purpose
The save search and subscription functionality can be used to enable to save the searches he makes and would like to revisit in future or subscribe to them to get updates on a daily/weekly/monthly basis. The tutorial link - http://eden.sahanafoundation.org/wiki/UserGuidelines/Tutorial/SaveSearchAndSubscription
Data Model
Save Search
Holds information about the search query and the parameters that are saved by the user. The data model can be found in modules/s3db/pr.py.Table name--> pr_save_search.
Field Name | Purpose | Datatype/table |
user_id | The user id of the user who saved the search. | FK referenced from auth_user.id (integer) |
subscribed | The subscribed status of the user to a particular saved search. | boolean |
search_vars | The search parameters for the search saved by the user | text |
person_id | The person_id of the user who saves the search | FK referenced from pr_person |
s3.meta_fields() | metadata |
Subscription
Holds information about the subscription details. The data model can be found in models/msg.py.Table name --> msg_subscription
Field Name | Purpose | Datatype/table |
user_id | The user_id of the user who selects the subscription mode | FK referenced from auth_user.id (integer) |
subscribe_mode | Describes the mode(s) of subscription selected | |
subscription_frequency | The frequency at which the subscription are to be sent. | |
person_id | The person_id of the user who saves the search | FK referenced from pr_person |
s3.meta_fields() | metadata |
UI Design
- Save Search Widget - The widget for saving the search will appear on the search results page, basically it will be a button which asks the user whether the particular search must be saved.
- Review of Saved Searches - A tab named "Saved Searches" is present in pr/person for this purpose. The user will have the option of modifying, deleting, loading and subscribing/unsubscribing the saved searches.
- Widget for Subscribing - The widget for subscription will appear on the page which contains all the saved searches, basically it will be a button which asks the user the particular saved search must be subscribed/unsubscribed.
- Load Search - A load search button to open the saved search will be present alongside the delete and subscribe/unsubscribe button so that the user is enabled to look at the current results of the saved search by opening the search page.
- Subscription Details - A tab named "Subscription Details" is present in pr/person for this purpose. The user is provided with an option to modify/create his subscription information.
Files modified
Following are the files which were modified -
- modules/s3/s3search.py - For the purpose of putting in the save search widget and saving the search parameter when the user wants to save/load a search. Several big and small modification were done to put these features.
- modules/s3db/pr.py - Contains the Save Search Data model.
- models/msg.py - Contains the Subscription Data model.
- controllers/pr.py - Modifications were done in person() to put the Saved Searches and Subscription Details tabs. Also, to provide the functionality of loading filter.
- controller/msg.py - It contains functions to review the subscription details and other functions to send emails containing updates to the subscribed users.
- cron/crontab - To schedule the daily/weekly/monthly checks for updated results in saved search and subsequently sending of emails for them.
- Deployment Settings to enable or disable the save search widget.
Improvements for future
- Sending Email in XSLT format.
- Adding the SMS/Twitter modes of subscription.
- DeveloperGuidelines/Search
- BluePrint/SaveSearch_Sub