Changes between Version 159 and Version 160 of BluePrint/Messaging


Ignore:
Timestamp:
06/05/13 15:25:22 (11 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BluePrint/Messaging

    v159 v160  
    44== Current Status ==
    55See DeveloperGuidelines/Messaging
     6
    67== Core Architecture ==
    78See BluePrint/Messaging/DataModel
    8 === Inbound Messages ===
    9  * When a message is picked up by the handler, it decides whether it's an XForm or not.
    10  * If it is, then it is routed direct to the relevant resource.
    11  * If not then it is added to the Master Message Log ({{{msg_log}}})
    12  * When new messages arrive in the Master Message Log, then the Parser looks for keywords & tries to Route automatically - either to a resource or to a {{{pe_pentity}}} (NB 'routing' to a resource is actually just 'tagging').
    13 === Routing within Eden ===
    14  * Users can view the Master Message Log via the 'Ticketing Module' UI & do manual Routing - either to a resource or a {{{pe_pentity}}}.
    15  * Users can Subscribe to Resources in order to receive copies of all messages which are routed to a resource.
    16   * This is done by pressing the 'Subscribe' button on the page for that Resource.
    17    * Button becomes 'Unsubscribe' if user already subscribed.
    18  * When a user visits a Resource via it's Web UI, then the [wiki:RESTController] scans the {{{msg_log}}} & provides access to associated messages in the views (display/update views have a list of associated messages in a table below the main record. list views have an extra column showing the number of messages tagged to this resource & number unread by this user ({{{unread(read)}}}) which is hyperlinked to a view which displays these records.
    19 === Outbound Messages ===
    20  * If a pentity has a message sent to them (they subscribed or routed to them automatically or manually) then as well as being tagged for them, a copy is placed in the Outbox with them as recipient. Their list of Contacts is browsed & the appropriate contact method is used, depending on the priority of the message (e..g. a user may want to be sent an SMS for a high priority message, such as a security alert, but just be sent an email if it's just an update to one of their projects). If there are multiple methods available for a priority level then all methods are used at once - each having a separate entry in the outbox.
    21  * XML exports (such as RSS feeds) include tagged messages as linked resources:
    22    * S3ResourceController has a hook for a function that retrieves all message URLs for a resource: s3xrc = s3xrc.S3ResourceController(..., messaging=<function>)
    23    * This function takes the the resource name (=full tablename incl. prefix) and the record ID as arguments, and returns a list of URLs to messages for this resource and user, where each list item is (url, timestamp), with timestamp refering to the message timestamp
    24    * The XML exporter inserts one element <message url="..." unread="True/False"/> per message and resource element as child of the <resource> tag
    25    * This can be used for any feeds that are produced of the XML exporter
    26    * Requires: ~~make RSS feeds an XML export template~~
    27  * From address for emails can be set by changing mail.settings.sender under the hood.
    28  * If using gmail as Server for Outbound Email messages then this will override mail.settings.sender, so need to integrate this
    29   * Grey out the setting & explain why in Help if this option is set
    30   * Allow a per-user Outbound server override
    31  * Could use !GoogleVoice for Outbound SMS: http://code.google.com/p/pygooglevoice/
    32 === Message Flows ===
    33 [[Image(Message Flows.png)]]
    349
    35 === How do we achieve this? ===
    36  * Table {{{msg_log}}} is used as a replacement for the current {{{msg_inbox}}} & {{{ticket_log}}}.
    37   * Fields: sender, subject, body, verified, actionable, assignee (multiple?), actioned, priority
    38    * Q: Do we move some of these 'ticketing' fields to a separate, linked {{{ticket_msg}}} table?
    39  * Table {{{msg_tag}}} is used to tag messages for resources.
    40   * Fields: message_id, resource, record (uid)
    41    * Q: How to display this nicely?
    42     * A: Give the message a tab with all distribution resources (db.tables). Once a table is selected, a second selector with all UUIDs (represented, of course) in that table appears, so you can choose the target. Use s3xrc.model.configure to add a name_nice for each table.
    43  * Table {{{pe_subscription}}} is used to maintain subscriptions for a {{{pe_pentity}}}.
    44   * Fields: pr_pe_id, resource, record (uid)
    45   * Subscriptions can be added/deleted from the linked resource
    46    * Add to Views (layout.html)
    47     * http://myserver.org/eden/msg/subscribe?resource=org_org&uid=XXX
    48     * Controller needs writing
    49   * Subscriptions can be viewed from the user's subscriptions page
    50    * ~~Add to 01_menu.py & pr.py~~
    51  * Table {{{msg_outbox}}} is used to identify messages which need to be routed externally & store delivery statuses.
    52   * Fields: message_id, pe_contact_id, status
    53  * Table {{{msg_read_status}}} is used to show that a message has been read by a user.
    54   * Fields: message_id, auth_user_id ('read' is assumed)
    55   * Q: Do we mark as read if pe_contact_id status suggests person has received message? (Fran thinks not)
    56   * Good to have UI to 'Mark Unread'
    57  * Parser has hooks for modules to plug-into?
    58  * Q: Do we treat a pentity the same way as any other resource?
    59   * Just that when a message is routed to them, it not only tags but also creates an entry in {{{msg_outbox}}}, which is scanned by the Cron task for 'pending' messages to be sent out.
    60  * {{{s3_rest_controller()}}} is modified to check msg_log for messages tagged to the resource (list) or record (display/update)
    61   * Views modified as above
    62  * 'Ticketing Module' UI
    63   * default view is all un-actioned messages (assigned to this user & unassigned?)
    64   * If a message is routed to a resource/pentity, this results in a 'create' form popup with as many fields auto-populated as possible (subject into 'name' field & body into 'comments' field, if nowhere better)
    65   * See 'Create Report' in [http://ushahidi.com/media/c_How-To-Approve-SMS.pdf Ushahidi] for an example of the workflow here.
    66    * Q: If a message is routed to a resource, does this automatically mark ticket as 'actioned'? Provide a popup to ask this?
    67  * [BluePrintAuthorization#SpecificExamples Auth restrictions]
    68  * Message settings (Gateway) is a 1-1 component of Organisation, Office & Person
    69  * When Messages are sent, Person settings are checked, if not found then Office settings are checked, if not found then Organisation settings are checked, if not found then Default settings are used. For speed, all records are read when daemon launched & stored in session.s3.msg. An oncreate/onupdate/ondelete callback forces a refresh of this session data.
    70  * Gateway usage should be auditable for billing purposes (i.e. allow a recharge)
     10Also see BluePrint/Messaging/Old
     11
    7112== Parser ==
    72 
    7313See BluePrint/Messaging/Parser
    74 == User Interface ==
    75 The home page should be a common Inbox view which, by default, shows all new unread Items (the 'Ticketing Module').
    76 
    77 Users/Groups should be able to subscribe to incoming messages of a certain type (Project / Location / Organisation) & have these messages forwarded via SMS / Email / Twitter / etc.
    78 
    79 Ideally there should be the ability to launch a popup/ticker to notify of new items & a portlet which can be on a user's dashboard when they login.
    80 
    81 The 'Send Message/Alert' screen should have a small box to enter the Plain-text message which is sent to all recipients (using all available SMS/Email addresses in the Group specified).
    82 
    83 There should be a 2nd box to create a Rich-text message, with the option of adding attachments. This content just gets sent to those members of the group with an Email address specified.
    84 
    85 If a user is added to a group we warn about any missing details, but still allow addition (the ref is by pe_pentity.id so addresses can be added/changed later anyway).
    86 
    87 When sending we need to provide warning messages about users for whom details weren't available.
    8814
    8915== Channels ==
     16
     17=== APRS ===
     18We would like to be able to connect to the Automatic Packet Reporting System used by Amateur Radio networks:
     19 * http://en.wikipedia.org/wiki/Automatic_Packet_Reporting_System
     20
     21=== CAP ===
     22See the [wiki:BluePrint/CAPBroker CAP Broker BluePrint]
     23
    9024=== Email ===
    9125The email settings should be made web-configurable as part of the Messaging Module
    9226- however also need to be used by Auth (order issues)
     27
    9328==== Rich Text ====
    9429We'd like to be able to send HTML mails for rich-text support (including attachments)
     
    14984* http://pysmpp.sourceforge.net (old: 2003)
    15085
    151 === APRS ===
    152 Automatic Packet Reporting System used by Amateur Radio networks:
    153  * http://en.wikipedia.org/wiki/Automatic_Packet_Reporting_System
    154 
    155 === CAP ===
    156 See the [wiki:GSOC2012/CAPBroker 2012 GSoC CAP project], [wiki:UserGuidelinesAlerts CAP usage], and [wiki:BluePrint/CAPBroker CAP Broker BluePrint].
    157 
    158 Common Alerting Protocol:
    159 
    160 ''Originating CAP alerts is one need, receiving them and using them to actuate alerting systems, be they SMS drivers or sirens or whatever is another.  Another is a message broker that can interoperate with the commercial boxes.  Authentication systems are also a factor, especially where cross-jurisdictional reciprocity is required''
    161 
    162 ''Ideally the CAP XML should be signed end-to-end, especially in a federated system where there's more than one authority running servers/aggregators.  Our current implementations sign the alerts at the originating server, so they're at least traceable to the source server but not necessarily the individual operator.  Current servers check integrity when they get a message from another server, but there isn't a regional PKI.''
    163 
    164  * http://docs.oasis-open.org/emergency/cap/v1.2/CAP-v1.2.html
    165   * Use an XSLT
    166  * Subset of EDXL-DE: http://docs.oasis-open.org/emergency/edxl-de/v1.0/EDXL-DE_Spec_v1.0.pdf
    167   * Use another XSLT
    168   * http://code.google.com/p/pyedxl/source/browse/trunk/edxl/edxl.py
    169   * http://edxlsharp.codeplex.com
    170   * SQL schema: http://wiki.sahanafoundation.org/doku.php/wiki:user:edxl_discussion#proposed_sahana_edxl-de_database_implementation
    171  * http://talksahana.com/2009/03/04/firefox-browser-cap-alerting-plugin-sahana-idea-for-gsoc2009/
    172  * Sahana CAP/EDXL Broker specification - http://lirneasia.net/wp-content/uploads/2009/05/Sahana-CAP-Msg-Mod-v0.2.pdf
    173 
    174  * Model definitions have been started in [http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/models/msg.py#L471 models/msg.py]
    175 
    176 ==== Wireframe (ported to eden) ====
    177  * The wireframe built using Python and Eden frameworks.[[https://github.com/Nostraa/eden/tree/CAPBroker | The code is here]]. Anyone can use this as the basis to continue the CAP Broker developments.
    178  * [[http://eden.sahanafoundation.org/ticket/1026 | This ticket]] contains some of the screen shots and initial GUI layouts with some descriptions.
    179 
    18086=== Twitter ===
    18187Adding support for sending out/receiving alerts via Twitter & [BluePrintMessagingModule#Micro-Syntax mining] a hashtag for potential value:
     
    18692 * be able to link tickets/actions to specific tweet
    18793 * it should be possible to automatically load a hashtag that is included in all outgoing messages e.g. we would have setup #eqnz to be included in all outgoing tweets. this may change during the event e.g. the Ministry of Civil Defence Emergency Management started with #CanterburyQuake but this was soon shortened and overtaken by #eqnz as being shorter and more useable.
    188 
    189 ==== Status ====
    190  * [http://tropo.com Tropo] has been integrated for a basic Twitter bot support:
    191   * http://gwob.org/hackathon-winners-and-participation-thanks
    192  * OAuth support has been added using [http://github.com/joshthecoder/tweepy Tweepy]
    19394
    19495==== !ToDo ====