Public Lab Research note

Outreachy proposal: Spam Management system

by ranavivek_me19 | April 22, 2022 10:47 22 Apr 10:47 | #30575 | #30575

About me

Name: Aayushi Singh


Location: Bangalore, Karnataka

Hello everyone, I'm Aayushi Singh, a self-taught developer from India. I am an undergrad student for a Bachelor of Engineering and have worked on various interesting projects including websites and other interesting applications under various organizations and communities.

Project description

MapKnitter is software developed by Public Lab to help you turn your photos into maps! It's SUPER easy to use and runs in the browser. They make aerial photos from the user-submitted images that float over our site's MapKnitter servers, running at . The manual process of making maps with MapKnitter differs greatly from automated aerial imaging systems. In those systems, the imaging is of higher precision and processed with spatial and telemetry data collected along with the imagery, typically at higher altitudes and with consistent image overlap in the flight path sequence.MapKnitter is user-friendly since all you need to understand how it works is a browser. It's also great because anyone can use both their desktop and their mobile phones to access the tool.

Abstract/summary (<20 words):

To make changes to the website and make it more illustrative and user-friendly and build an effective spam management system for


  • Display information about each map, such as the author's status, how many images it has, whether images have been placed, whether the author is new

This page provides all sorts of info related to the author's status, number of images, and comments on them, providing an overall comprehensive overview of the content held by an author.

image description

On this page, the tag of New Author with other tags will also be depicted as per the description. For that, we need to create Hashtags for Map Post.

When an author creates a new map post with a description like this: "I love #mapknitter, I am an #NewAuthor". I expect our system will also create 2 hashtags with the names are mapknitter and NewAuthor.

Step 1: Extract Hashtags from the description of the Map Post

Add an instance method to the Post model to extract hashtags:

image description

This method will return to an array of name hashtags. For example

image description

Step 2: Add a callback to create hashtags after creating a Map Post.

Active Record supports a lot of useful callbacks. We use the after_commit callback for our MapPost model, this callback is called after a post has been created, updated, or destroyed. But now, we just want to trigger this callback when a post is created, so we add more: on option for specific to create action.

image description

Define this callback in the Post model:image description

The create_hash_tags method will be called after a post is created.

  • Check via the Public Lab API whether the currently logged-in user is a moderator to determine if they can view the spam table

We can use Custom Middleware to implement this option, instead of an API to fetch the details of the role on each request to our rails application with a specific account, we don't have to change our routes.rb.

First, use ActiveSupport::CurrentAttributes. It will simplify the per-request attributes access.image description

Then our AccountMiddlreware will identify an Account by the id, and update the request path accordingly.

image description

NOTE: request.script_name is required to overwrite other links on the page. Otherwise, the new link will be: /projects/new w/o the account_id

image description**

In the Public Lab spam management dashboard, there is a section that lists links to other sites that provide additional information regarding issues in the community. For example, on the right-hand side, there is a link to Mapknitter (link), which serves as an effective tool for managing spam posts in the Public Lab forum.

  • Display a list of any maps banned, user has (if any) when they are banned

image description

Once a moderator bans a single author successfully, they will be redirected to a page displaying all the maps of the banned author. We can use the kaminari gem (an implementation of the blazing-fast infinite scroll for Ruby on Rails applications) to improve page loading times and make it efficient. It will consist of the information about the map and no of images with the preview of frequent 3 images in the card. Only Moderator will be able to see what is present inside the banned maps.

We can notify certain people about a map whenever it is banned.

Just create 'banned_maps_mailer.rb' in app/mailers/ folder.**

image description

In our Map model, we can use an after-commit to send an email when the banned attribute of the map model is made true.image description

image description

Once a moderator bans a single author successfully, they will be redirected to a page displaying all the maps of the author. The moderator will be able to click on a Spam All Maps button to bulk-spam all the maps belonging to that author.

  • Forbid login by users who've been banned on MapKnitter, by setting their status to 0

image description

As shown above, a message appears telling the banned users that they cannot be login.

The device comes with various features of forbidding certain users from signing in, the method is called active_for_authentication? Create a column called is_active for the User model. Then add the code below to the User model:image description

  • Regularly check (hourly? daily?) (when running the current_user function) if users have been banned from (via an API call)

We can Use the Devise gem of Rails to do the regular check. As we know Devise is composed of 10 modules in it, which will make it easier for us to handle other stuff like locking the account after a specified number of failed sign-in attempts by Lockable, expiring sessions that have not been active in a specified period of time by Timeoutable along with the support of Omniauthable.

Timeline/milestonesimage descriptionimage description


A diverse community that will help me review the changes and guide me with better solutions.

First-time contribution


I started contributing to open source in 2020 and learned a lot about software development during my tenure at the Center of Innovation Incubation and Entrepreneurship (CIIE BMSCE ). I used to lead a separate developer's community as part of this role there, which was especially rewarding. I got introduced to React, JavaScript/TypeScript, Ruby on Rails, Docker, DevOps, and other related technologies that are essential to building websites or apps, and I found it rather challenging coming from a mechanical background. However, after seeing how these supplies were used for projects to help simplify people's lives in all kinds of ways, I grew quite fond of technology.

During my time as a technical intern at Las Innovations, I got familiarise with 3D surveying and aerial mapping which helps in solving problems faced in modern industries regarding human safety, they aim at solving the same using Robust Unmanned Systems with our diverse products and provide remote access to people

During my time as a full-stack developer at, I used Ruby on Rails for their project stack and helped them with some new functionality. Along with working alongside developers from different educational backgrounds, I also developed my own knowledge of development from the ground up.

During the pandemic, I started writing technical articles -, which gave me a new edge on how communities can help each other out by sharing their knowledge and experiences.


Working collaboratively with a team that learns from one another is one of the most fulfilling ways of working. As a part of BigBuddy, I have experienced exactly this kind of environment and it has helped me grow tremendously over the past couple of months I have been here. One of my main responsibilities here is to optimize the user experience and develop and maintain various pre-existing components as well as redefine internal tools and make them easy for everyone to use.

While I am never tired of learning -- at CIIE BMSCE -- my main goal at CIIE is to learn new skills by leading the community innovatively. I used to lead a separate developer's community as part of this role there, which was especially rewarding. I got introduced to HTML/CSS, React, JavaScript/TypeScript, Ruby on Rails, Docker, DevOps, and other related technologies that are essential to building websites or apps, and I found it rather challenging coming from a mechanical background.


The internet is a blank canvas. Public Lab is an open science and environmental justice community committed to making this canvas less white, and more green and appropriate for the future.

A person's passion is what drives them to pursue opportunities and activities without reservation. We all want to help the world and make it a better place. But it's hard to know where to start! To the rescue comes open science: the idea of using advances in technology, data analytics, and citizen science. My development in programming accelerated because of the fact that I have unlimited access to instructional videos, blogs, tutorials, and articles on the internet. If these were reserved for a single demographic such as people who went to college for Computer Sciences majors only, then a valuable opportunity for knowledge would be inhibited and I think this holds true for other people like me.

Before stumbling across PublicLab, I was convinced that combating environmental injustice was largely impossible for those living in poor communities, other low-income earners, and even communities living with environmental pollution issues. I now realize that these types of barriers can be overcome by the average individual and community group due to the wealth of readily available data monitoring tools from Public Labs at So, should I go for open science or environmental justice? I would love to do both at some point.


This project is for the Public Lab open network that consists of community organizers, educators, technologists, and researchers working to create an issue management platform so that truth-seekers can verify facts more efficiently, and open source contributors like myself who want to make the world a better place in our own way by MapKnitter allows communities to monitor environmental injustice on a global level. It shows how implementing small tasks can be useful, and in the long run, it contributes to bigger changes by creating code for collaborative environmental advocacy projects. I want to contribute to its continued success by creating applications that help improve the community's day-to-day experience by managing their spam effectively.


During the summer months, I'll be devoting my time to contributing to the Mapknitter by making it more user-friendly and easy to use.I do understand that this is a full-time commitment, and I am readily available to work for 60-66 hours every week from 9 AM to 8 PM GMT+1.


Hi @TildaDares , @jywarren and @cesswairimu . I am Aayushi Singh an Outreachy applicant.Kindly review it and give feedback , suggestions on my proposal. Thankyou!

Reply to this comment...

Hi @TildaDares , @jywarren and @cesswairimu . Wating for your feedback so that I can make a require changes. Thank You!

Hi @ranavivek_me19, thank you for your proposal! I'll leave a few comments I hope are helpful feedback.

The hashtags idea is interesting - can you tell a little bit more about what goals the feature will help achieve? Do you see it as being useful for assessing if content is spammy, or is it more like a way to aggregate similar authors by topic?

I like how you've highlighted the comments on different maps. It does seem that the comment display should be moved from the editor page to the view page, and I think it's the way it is now because we didn't used to have 2 separate pages. This can simplify the editor page and make it easier to see where to comment as well.

I appreciate the email system you're imagining but I am not convinced if we need email notifications. Are the emails for the map authors, or for the admins who are doing the banning? What are the pros/cons of email notifications for each?

I also like the visual mockups of how the error messages will look. Be sure to keep in mind the Bootstrap UI library for consistency as this helps us keep complexity low!

Thanks so much again, we appreciate your application!

Is this a question? Click here to post it to the Questions page.

Hey! @jywarren , thanks a lot for ur feedback.

For the hashtag idea, it will be useful to aggregate similar kinds of authors and even during the spamming of authors of the same kind of topic. The user can get to know whether the author is a first-timer or regular, if he/she is a regular author then automatically one hashtag will be granted to the author stating the credibility of the respective author. Apart from it, if the author has put the place name or country name with a hashtag it will be easier for the user to segregate the maps according to the specific region using the search bar.

It is important to set up proper notification systems as a site admin when it comes to banning authors on the website. Emails will be sent to both administrators and authors whose content was banned. The email will mention that the author has been banned and is undergoing a review period in which they may not upload any new content. After the review time is complete, members will receive a follow-up notification from the administrator stating whether or not their account was unbanned.

Regarding the UI which I have designed from scratch using figma and it can be integrated with Bootstrap UI library or any other SC.

Reply to this comment...

Login to comment.