=**Profile**=
**Name:** Rohan Gupta
**Time zone:** UTC +5:30
**IRC nick:** Rohan-cod
**Email id:** rohaninjmu@gmail.com
**Zulip email:** rohaninjmu@gmail.com
**GitHub:** [[ https://github.com/Rohan-cod | Rohan-cod ]]
**Linkedin:** [[ https://www.linkedin.com/in/rohang4837b4124 | Rohan Gupta Linkedin ]]
**Location:** India
**Working hours:** 11:00 am to 01:00 am UTC +5:30
=**Synopsis**=
The task is to create a zulip bot for Wikimedia-Zulip that sends customized messages to new users who sign-up and/or who ask for information on getting started. Link to Phabricator: [[ https://phabricator.wikimedia.org/T233478 | T233478 ]].
==**Objectives:**==
- Welcome new members and share with them kick-start resources related to Wikimedia Outreach projects.
- Bot should provide help around FAQs (for example by using the following syntax: +search-faqs: <then question>), so we don't wait for a human (waste of time) and also avoid repeating answers.
- Direct channel members to the relevant members and/or relevant streams/topics.
==**Proposed Features:**==
- Welcome Message.
- Adding users to a particular stream.
- Answering queries.
- Static type checking and support for mypy.
- Smart bot using natural Language Processing.
- Automated testing and Mocking apis.
=**Mentors**=
- @D3r1ck01
- @Pavithraes
- @Medhabansal
=**Detailed explanation of the proposed features**=
- **Welcome Message -**
Whenever a new user joins the channel he expects some information about the project. Sending the same message to every new user is a tedious task and wastes a lot of time. Here's a solution, the zulip bot will send a welcome message to every new user that joins the channel. The message will contain information about the organization and details about the project. The message will be customized for each topic so that the user gets a message containing information related to the topic of the stream that he/she has joined.
- **Adding user to a particular stream -**
It's not the case everytime that a new user joins the exact stream he wanted to join. We have to add that user to the ideal stream manually or he/she has to join the stream himself/herself. Here's a solution, you can use the zulip_bot to be added to a particular stream or the admin can use it to add a particular user to the required stream.
- **Answering queries -**
Most of the questions that newcomers ask have been already asked by someone else. Answering the same questions again and again is a tedious task. Here's a solution. All the frequently asked questions would be grouped together and the bot will respond to all of them whenever someone asks them. If a new question comes for which the bot doesn't have an answer, will be sent to the admin so that he/she can answer them. He/She will also have an option to add them to the list of FAQS.
- **Static type Checking -**
Python uses dynamic type checking for checking the data type of the variables and the return type of the function at runtime. There is a tool called mypy which helps integrate static type checking into your code. This requires changing the code structure but in the long run it definitely pays off.
**Pros of type checking:**
- Type hints help document your code. Traditionally, you would use [[ https://realpython.com/documenting-python-code/ | docstrings ]] if you wanted to document the expected types of a function’s arguments. This works, but as there is no standard for docstrings.
- Type hints improve IDEs and linters. They make it much easier to statically reason about your code. This in turn allows IDEs to offer better code completion and similar features. With the type annotation, PyCharm knows that text is a string, and can give specific suggestions based on this:
{F31676297}
- Type hints help you build and maintain a cleaner architecture. The act of writing type hints forces you to think about the types in your program. While the dynamic nature of Python is one of its great assets, being conscious about relying on duck typing, overloaded methods, or multiple return types is a good thing.
- **Smart bot -**
All the above features will be pre programmed. The bot will do only the thing for which it has been programmed. This has a problem, what if a user wants to have a conversation just like having a conservation with a real human he/she would not be able to have that. Here's a solution, there is a library in Python called ChatterBot which can be used to create smart bots which will be like a real human. Apart from this it will keep on learning as the users chat with it. It will keep on improving.
This library requires ML, AI and nlp. The bot made using ChatterBot will be integrated with the zulip bot by placing the code with the zulip_bot code or using incoming and outgoing webhook integrations. This will make the bot a 'Smart Bot'.
- **Automated Testing and Mocking apis -**
Tests are the most important part of a software program. Most of the programmers ignore them. Tests help evaluate your code automatically. You don't have to manually test anything. Tests automates the process of confirming that the code works as expected. For some part of the code access to an api is required which inturn requires an internet connection. Here's a solution, there is a concept called mocking through which we can create a mock api and store it locally in the source code so that connection to the remote api is no longer required. You will be able to test the code even without an internet connection.
**In the words of Jacob Kaplan-Moss, one of Django’s original creators, **
//“Code without tests is broken as designed”.//
//Why is mocking useful?//
**---->** When writing tests, it often occurs that you make calls to functions taking complex arguments. Creating a real instance of such an argument would require the use of various different libraries, a lot of boilerplate code, etc. Another scenario is that the tested code accesses files or objects that don’t exist at testing time. Finally, it is good practice to keep tests independent from others. Mocks help you to isolate test cases by simulating objects and methods irrelevant to a test’s goal.
=**Timeline**=
|**Period** | **Task**
| April 27 to May 17 | **Community bonding period.**
| May 18 | **Coding officially begins!**
| May 18 to May 24 | Writing code for welcome message and information related messages for all the available streams on Wikimedia-Zulip.
| May 25 to May 31 | Writing code for adding users to a particular stream and FAQS.
| June 1 to June 7 | Structuring the code to support static type checking and mypy.
| June 8 to June 14 | Writing tests for the code written.
| June 15 to June 19 | **Phase 1 evaluations.**
| June 20 to June 26 | Adding support for ChatterBot, enabling it to have conversation with the users just like a human being.
| June 27 to July 4 | Adding ChatterBot support continues. The code written in this period will enable it to answer questions other than the FAQS, for example, the questions available on Stack Overflow.
| July 5 to July 12 | Writing tests for the code written.
| July 13 to July 17 | **Phase 2 evaluations.**
| July 18 to July 24 | Writing fixtures for all the apis used which will help in mocking the apis.
| July 25 to July 31 | Writing tests and structuring the code to support static type checking.
| August 1 to August 8 | Fixing all the bugs and deploying the bot.
| August 9 to August 17 | Writing documentation and Updating appropriate guides. Code cleanup for submission.
| August 17 to August 24 | **Mentors submit final student evaluations.**
| August 25 | **Final results of Google Summer of Code 2020 announced.**
| October | **Mentor Summit.**
=**Participation**=
- I will make a new repo on git and maintain two branches. Code will be uploaded to the dev branch periodically and will be merged with the master branch once review and testing is done.
- I will deploy the bot in production using Zulip Botserver and supervisord.
- I will be available on zulip in my working hours.
- I will use Phabricator for managing bugs and subtasks.
- Weekly reports will be published in my meta wiki [[ https://meta.wikimedia.org/wiki/User:Rohan-cod | user page ]].
=**About me**=
My name is Rohan Gupta. Currently I am in the second year(4th semester) of Btech C.S.E at Shri Mata Vaishno Devi University, Katra.
I found the organization on the GSoC organizations page.
I am planning to participate in GSoC 2020.
My final examination will commence on May 13 and will be over by May 22. I will be able to commit enough time from May 18 to May 22. After this I don’t have any other commitments and my complete focus will be on making a wonderful bot for Wikimedia.
This project seems interesting to me because i love to automate tasks. I created two bots using selenium and have past experience with ChatterBot and python-zulip-api.
=**Why me?**=
I have been working with python for a long time. I have gained a lot of knowledge about its different libraries and frameworks. I also work on those aspects of python which other programmers deem unimportant but are in reality, crucial to the overall functioning of the project.
I follow the [[ https://www.python.org/dev/peps/pep-0008/ | PEP 8 ]] style for writing my code which is highly recommended within the coding fraternity. Also, most of the code I write has support for static type checking through [[ http://mypy-lang.org | mypy ]].
I have been in constant contact with the mentors and have gained much knowledge about the project requirements. I am also in constant touch with the zulip support team so that I don't miss anything and learn tricks to optimise my code.
I have gained a considerable amount of familiarity with the codebase by submitting pull requests to the project. I have made very informative commit messages which are very important in efficiently maintaining an Open Source project.
A program can be written by anyone but not everyone can write the most optimised version of it, which I am confident enough that I can write.
=**Past Experience**=
I have been working with Python for a long time and have learned a lot about it. I have knowledge about a lot of libraries like argparse, selenium, tkinter, numpy, pandas and many more. I have also worked with Django and have a couple of webapps too.
==**//I have made a zulip bot which is a prototype for the project. This will give you an idea about how I will be implementing all the features.//**==
==**//[[ https://github.com/Rohan-cod/zulip_bot | Wikimedia_zulip_bot ]]//**==
==**//Demo of a fully functioning Zulip bot made by me//**==
==**[[ https://drive.google.com/file/d/1XuKBBDUBs_PDV-WY29ya2p6FGEFOtgjq/view?usp=drivesdk | RBOT ]]**==
(zulip)I have contributed to zulip where I added ImgBot for image optimization to their code.
[[ https://github.com/zulip/python-zulip-api/pull/544 | Image Optimisation with ImgBot. · Issue #544 · zulip/python-zulip-api ]]
==**My contributions to Wikimedia:**==
- (toolforge) I have also contributed to Paws which is a sub repository of Toolforge where I added a readme file and added ImgBot for image optimization to their code.
[[ https://github.com/toolforge/paws/pull/36 | https://github.com/toolforge/paws/pull/36 ]]
- (toolforge) I have also contributed to tool-toolforge-static which is a sub repository of Toolforge where I added a readme file.
[[ https://github.com/toolforge/tool-toolforge-static/pull/1 | https://github.com/toolforge/tool-toolforge-static/pull/1 ]]
- (toolforge) I have also contributed to tools-hitjitsu which is a sub repository of Toolforge where I corrected their readme file.
[[ https://github.com/toolforge/tools-hatjitsu/pull/3 | https://github.com/toolforge/tools-hatjitsu/pull/3 ]]
- (toolforge) I have also contributed to media-dubiety which is a sub repository of Toolforge where I added a readme file.
[[ https://github.com/toolforge/media-dubiety/pull/1 | https://github.com/toolforge/media-dubiety/pull/1 ]]
- (mediawiki) I have also contributed to BlueSpicePermissionManager where I added a readme file.
[[ https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/BlueSpicePermissionManager/+/578358/ | https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/BlueSpicePermissionManager/+/578358/ ]]
- (WikipediaLibrary) I have also contributed to WkikpediaLibrary/TWLight for the task T205531.
[[ https://github.com/WikipediaLibrary/TWLight/pull/430 | https://github.com/WikipediaLibrary/TWLight/pull/430 ]]
- (wikimedia) I have also contributed to analytics-wmde-WDCM-Overview-Dashboard where I added a readme file.
[[ https://gerrit.wikimedia.org/r/#/c/analytics/wmde/WDCM-Overview-Dashboard/+/579845/ | https://gerrit.wikimedia.org/r/#/c/analytics/wmde/WDCM-Overview-Dashboard/+/579845/ ]]
- (wikimedia) I have also contributed to mediawiki-extensions-Maintenance where I added a readme file.
https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Maintenance/+/579917/
=**Future**=
I will contribute to Wikimedia even after GSoC. There are many interesting projects like Pywikibot, TWLight, toolforge and many more Which seem interesting to me. I will learn a lot working on them. I want to become a core contributor of Wikimedia. The mentors at Wikimedia are really very good. They are very helpful. They have guided me all way long. Some of the people I have interacted with include @Pavithraes, @D3r1ck01, Samwalton9, bd808 and Chicocvenancio.
=**Resources**=
- [[ https://realpython.com | Real python ]]
- [[ https://zulipchat.com/api/ | Zulip api documentation ]]
- [[ https://zulip.readthedocs.io/en/latest/index.html | Zulip documentation ]]
- support@zulipchat.com
- [[ https://chatterbot.readthedocs.io/en/stable/ | ChatterBot documentation ]]
=**University information**=
- **University name:** Shri Mata Vaishno Devi University, Katra, Jammu and kashmir
- **Major:** Computer Science & Engineering
- **Current year:** 2nd Year
- **Expected graduation date:** August 2022
- **Degree:** Bachelor of Technology (B.Tech)