Community Connect

January 14, 2021 · View on GitHub

A Mock Social Media Platform to Study Online Behavior

Community Connect is a social media platform for conducting controlled experiments of human behavior, created with the goal of facilitating research on data collected through controlled experiments on social networks. The key distinguishing feature of Community Connect is the ability to control the visibility of user posts based on the groups they belong to, allowing careful and controlled investigation into how information propagates through a social network. We release this platform as a resource to the broader community, with the goal of faciliating research on data collected through controlled experiments.

User Interface for Community Connect

Interface

System Architecture

Interface

Web Sequence Diagram

Features

  • Bridge Users and Information Flow Control*: Setup bridge users who are connected to multiple groups, and control information flow through them since posts only become available across groups when a bridge user interacts with them
  • Outcomes: Collect information about likes, reposts, replies and quotes for each post
  • Images: Attach images to any post or comment
  • Conversation Threads: Follow conversation threads following any post through a unique conversation ID
  • Emojis: Emoji support for text
  • Notifications: Help users catch up with posts they missed

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for documentation on how to deploy the project on a live system.

Prerequisites

Installation

Follow these steps to install prerequisites on the local machine, or the server where the platform will be hosted.

  1. Install Node.js - this also installs NPM.
  2. Install MongoDB Community Edition.
  3. Verify installation by running following commands on the terminal or command line: npm -v, node -v, mongod --version.
  4. Clone the repo locally then install all the dependencies using NPM, running npm install should install all the dependencies and create a folder called node_modules:
$ git clone https://github.com/khyatimahajan/Community-Connect-Platform.git
$ cd Community-Connect-Platform
$ npm install
  1. Optionally, install pm2 to help with managing the process. This step is recommended if using EC2. PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.

Please note that all third party dependencies are managed through NPM and a package.json file. NPM is the default package management system for javascript programming and aids in package installation, dependency management and version management.

Setup for running the platform

If using Amazon EC2, follow these additional steps

Main setup starts here

  1. Start the MongoDB server.
  2. Optionally, check if running npm start works smoothly. If yes, continue to next step.
  3. Run pm2 start index.js to start the platform. Your app is now daemonized, monitored and kept alive forever.
  4. Go to your browser, copy the public URL displayed on your EC2 instance, add :5000 at the end to access port 5000. If this works, your platform is all set!

Populating the database using the Excel

When the platform first runs, it creates users and groups specified in this excel file:

To customize the users and groups, edit this excel file.

  • "User name": Name of the user.
  • "user_id": Unique ID for each user - this is used by the users to sign up for the platform. Without it, they cannot sign up for the platform.
  • email-ids: Enter user email. They will be using this to sign into the platform.
  • Group in column E is used to assign the users to their individual groups. (Users who are assigned in multiple groups are Bridge Users)

Setting up the environment file

ENV

  1. AWS_BUCKET_NAME: Create an S3 bucket on Amazon AWS, and add the name of this newly created S3 bucket here.
  2. AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY: Check the access keys using the Security Credentials menu from your user dropdown on the navigation bar top right. Fill these fields using data in these access keys. If you do not already have one, create a new one. To get information from the keys, follow this guide.
  3. AWS_REGION: AWS_REGION You can use the Amazon EC2 console or the command line interface to determine which Regions, Availability Zones, and Local Zones are available for your account. Fill in the region you will be using for your EC2 instance.
  4. SESSION_SECRET_KEY: Setup a SESSION_SECRET_KEY for Express middleware.

Folder Structure

Frontend

  • /assets contains all the images, some client side JS files and style sheets.
  • /views contains all the view templates (we have used Embedded javascript templating engine for node.js).
  • /style contains all the style sheets or the css files used for stylisation including colour, layout and fonts.

Middleware

  • /middleware contains the functions which have access to request object, response object and the next function in applications request response cycle.

Backend

  • /model contains all the ORM or the Virtual object database (specifically called schemas in mongoose).
  • /routes contains all the server side functions for different modules or areas of the application.
  • /controller contains all the major express routes seprated by major sections.

Data Storage and Retrieval

Schema for Backend

Users

Field_iduser_idusernamepasswordnamebiolocationEmail IDcreated_atprofile_picgroup_id
Functionprimary_key, system generated, do not changegenerate based on demo, experiment conditionassign default or emptyassign default or emptyassign default or emptyassign default or emptyassign default or emptyassign default or emptyassign default or emptyassign default or emptypre-populate
Data TypeObjectIdstringstringprivate passwordstringstringstringstringdatetimeURLlist of strings
Example of how this will look at setup<empty>jd_c1_06112020<empty><empty>John Doe<empty><empty>john.doe​@gmail.com<empty><empty>[Blue] ([Blue, Red] if multiple)
Example of how this will look when the experiment is underwayx1y2jd_c1_06112020john_doejohn_doeJohn DoehelloCharlottejohn.doe​@gmail.comTIMESTAMP[link to profile pic][Red] ([Blue, Red] if multiple)

Groups

Fieldgroup_idgroup_namegroup_desc
Functionprimary key, system_generated, do not changeexperiment-assigned group name, same as group info from Users tablefield to store group descriptions
Data TypeObjectIdlist of stringsstring
Example of how this will look at setupa1b2[Blue, Red]All bridge users
Example of how this will look when the experiment is underwaya1b2[Blue, Red]All bridge users

Feeds

Field_iduser_idbodycreated_atliked_bylike_countretweet_countreply_countquote_countpost_typeparent_idconversation_idmentionsvisible_to
Functionprimary key, system generated, do not changecopy from user_id of person taking this actioncreated with postcreated with postmaintains list of people who liked this postupdates post is likedupdates post is repostedupdates when a reply is posted on this postupdates post is reposted with commentcreated with post based on how it was created - can be “tweet”, “retweet”, “reply”, “quote”if post_type is “tweet”, this is empty, otherwise this is the _id of the post on which action was taken to create this postif post_type is “tweet”, this is copy of _id, otherwise this is the conversation_id of the post on which action was taken to create this postif another user was mentioned, add their user_id from Users table here; also logically these can only be users in this user’s groupsmark this post visible to the user’s groups, then update based on interactions on this post
Data TypeObjectIdstringstringdatetimelist of stringsnumbernumbernumbernumberstringstringstringlist of stringslist of strings
Example of how this will look at setup<empty><empty><empty><empty><empty><empty><empty><empty><empty><empty><empty><empty>[]<empty>
Example of how this will look when someone posts123x1y2helloTIMESTAMP[]0001 (became 1 when x2y3 quoted this tweet)tweet<empty>123[][Blue]
Example of how this will look when someone quotes post 123234x2y3worldTIMESTAMP[]001 (became 1 when x3y4 replied on this tweet)0quote123 (copied from _id of post which was quoted)123 (copied from conversation_id of post which was quoted)[][Blue]
Example of how this will look when someone replies on post 234356x3y4everyoneTIMESTAMP[]0000reply234 (copied from _id of post on which reply was made)123 (copied from conversation_id of post which was quoted)[][Blue]

How to Retrieve Data

  1. Dumping MongoDB data
  2. Backing up and restoring data from MongoDB dump
  3. For python - using pymongo to read data from MongoDB
  4. For R - using the 'mongolite' R package to read MongoDB data

Demonstration Video

Watch the demonstration video on YouTube: https://youtu.be/mDJ5tji0XTg

Browser Support

Tested on:

  • Chrome (84.0.4147)
  • Firefox (78.0)
  • Safari (14.x)
  • Internet Explorer(11.0)

Contributors

License

This project is licensed under the MIT License - see the LICENSE.md file for details