Google Summer Of Code 2017 Report.
Organisation - Mifos Initiative
Project - Notification Framework Enhancement
Over the last three months I have been working on enhancing a notification framework for MifosX platform as my GSoC Project. The notification framework provides a coherent and consistent communication mechanism that enables users of the system be notified on important actions performed by clients and/or clients.
Scope of Project
The current notification sub-system in Mifos provides a service to send notifications to a set of user. The service maps a notification message to recipient users and thus requires a list of user identifiers as parameter.
At the point of notification generation, the list of users to be notified is evaluated in real time based on their organization, role and permissions. The project aims to optimize this determination of recipient list and make the notification generation simpler using a topic-subscriber model.
How it works:
The notification framework enables notification in fineract to work as follows: On event of a notification generation, the notification service is called with a notification message and a list of user identifiers that form the audience of the notification.
For events that need sending notifications to a set of users based on the combination of their organization and role, the determination of the audience is done in real time. However, the approach is not optimum since there are multiple fetches from the datasource for the same data.
A topic-subscription model is used to optimize the evaluation of audience. Topics are created for each organization and role combination. When users are added to an organization and assigned roles, they are added as subscribers to the relevant topics.
Now, when a notification has to be sent to users having a particular role in an organization, the relevant topic is fetched and its subscribers are set as audience of the message
- A microfinance creates an office (and topics for the office is created for various users of the system e.g a topic called Loan_managers of head office is created for LOAN MANAGERS of office head office).
- A user creates an account (username: courage, password: Password123, role: loan manager) under the specific office (office name: head office) and she is made a subscriber to the topic Loan_managers_of_head_office.
- A client creates an account (Name: Cindy Mills) under the specific office (office name: head office) and the topic listens to her account.
- The client (Cindy Mills) applies for a loan.
- When the client applies for a loan, all loan managers of the client’s office are notified (courage - LOAN MANAGER at head office is notified).
- The user (courage) can then clicks on the notification to accept or decline the loan.
- An event is triggered, for example, creation of a new group
- An event listener for the corresponding event will generate a new notification.
- A notification is created.
- The office under which the event occurred is fetched, the desired role to act on the event is fetched and the topic corresponding to that office and role is fetched
- Subscribers(users) to that topic are fetched
- Recipients are added to the notification, and it is picked up once the user next logs in, or the UI requests notification
- An office is created for micro-finance (office or branch of an office) e.g head office
- Topics are created for each role under the office e.g loan_managers_of_head_office
- A user account is created under the microfinance with a particular role. e.g Jane Doe with role - loan manager under office head office
- User is automatically subscribed to the topic(s) corresponding to her role and office e.g Jane Doe is subscribed to topic - loan_managers_of_head_office
topic: id - the uuid of the topic title - the title of the topic (for example, branch managers of branch XXX) status - Activation state of office entity_id - id of office using topic entity_type - can take two values office for the main office or branch for a branch of the office member_type - roles using the topic (for example, branch managers) topic_subscribers : Id - the uuid of the record Topic_id - the foreign key to the topic userId - the foreign key to the users (subscribers to topic) subscription_date - user subscription date
Links to work done
- Topic Subscriber architecture : https://docs.google.com/document/d/1ZK5Byyy_mDmYqOHI9_0Ft39LXjZqJ_y87p5gVy3fFHE/edit?usp=sharing
- Pull request (back-end) : https://github.com/apache/fineract/pull/405
- Pull request (front-end) : https://github.com/openMF/community-app/pull/2438
Contributing to Mifos has been an amazing experience, I have learned alot of new technologies and have improved on my engineering. First, I will like to thank Mifos for giving me this opportunity and I would like to thank Edward Cable (Director of community programs, Mifos Initiative) for being so instrumental during the entire Google Summer Of Code period. and finally I will like to thank my mentor (Pranjal Goswami) who has guided through till the end of this summer internship.
- Email: email@example.com
- GitHub: https://github.com/Anh3h
- LinkedIn: https://www.linkedin.com/in/courage-angeh-01aa29122/