{"id":13567027,"url":"https://github.com/umitkaanusta/reddit-detective","last_synced_at":"2025-04-06T11:10:47.481Z","repository":{"id":45473976,"uuid":"305747382","full_name":"umitkaanusta/reddit-detective","owner":"umitkaanusta","description":"Play detective on Reddit: Discover political disinformation campaigns, secret influencers and more","archived":false,"fork":false,"pushed_at":"2023-12-07T02:15:03.000Z","size":275,"stargazers_count":213,"open_issues_count":4,"forks_count":15,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-30T09:09:55.552Z","etag":null,"topics":["analysis","analytics","api","data","database","elt","etl","graph","graph-database","neo4j","network","politics","reddit","social","social-media","social-network"],"latest_commit_sha":null,"homepage":"https://reddit-detective.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/umitkaanusta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-20T15:10:49.000Z","updated_at":"2024-12-14T03:22:41.000Z","dependencies_parsed_at":"2024-08-01T13:39:29.474Z","dependency_job_id":null,"html_url":"https://github.com/umitkaanusta/reddit-detective","commit_stats":{"total_commits":91,"total_committers":3,"mean_commits":"30.333333333333332","dds":"0.10989010989010994","last_synced_commit":"21a1b3a8e45a28a9ad94090a3efcd67586bd8fba"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umitkaanusta%2Freddit-detective","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umitkaanusta%2Freddit-detective/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umitkaanusta%2Freddit-detective/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umitkaanusta%2Freddit-detective/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/umitkaanusta","download_url":"https://codeload.github.com/umitkaanusta/reddit-detective/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247471521,"owners_count":20944158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analysis","analytics","api","data","database","elt","etl","graph","graph-database","neo4j","network","politics","reddit","social","social-media","social-network"],"created_at":"2024-08-01T13:02:21.921Z","updated_at":"2025-04-06T11:10:47.459Z","avatar_url":"https://github.com/umitkaanusta.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# reddit-detective: Play detective on Reddit\n![Python version](https://img.shields.io/badge/python-v3.7-blue)\n![Neo4j version](https://badgen.net/badge/neo4j/v4.1.0/cyan)\n![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)\n![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)\n[![Documentation Status](https://readthedocs.org/projects/reddit-detective/badge/?version=latest)](https://reddit-detective.readthedocs.io/en/latest/?badge=latest)\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=umitkaanusta_reddit-detective\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=umitkaanusta_reddit-detective)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=umitkaanusta_reddit-detective\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=umitkaanusta_reddit-detective)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=umitkaanusta_reddit-detective\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=umitkaanusta_reddit-detective)\n[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=umitkaanusta_reddit-detective\u0026metric=sqale_index)](https://sonarcloud.io/dashboard?id=umitkaanusta_reddit-detective)\n\n```\npip install reddit_detective\n```\n\n**reddit-detective** represents reddit in a graph structure using Neo4j. \n\nCreated to help researchers, developers and people who are curious about\nhow Redditors behave.\n\n\n## Helping you to:\n- Detect political disinformation campaigns\n- Find trolls manipulating the discussion\n- Find secret influencers and idea spreaders (it might be you!)\n- Detect \"cyborg-like\" activities\n    - \"What's that?\" Check `reddit_detective/analytics/metrics.py` for detailed information\n\n\n## Installation and Usage\n- Install Neo4j 4.1.0 [here](https://neo4j.com/docs/operations-manual/current/installation/)\n- Neo4j uses Cypher language as its query language. \nKnowing Cypher dramatically increases what you can do with reddit-detective \n[Click here to learn Cypher](https://neo4j.com/graphacademy/online-training/introduction-to-neo4j-40/)\n- Install reddit-detective with `pip install reddit_detective`\n    - **Note:** Version 0.1.2 is broken, any other version is fine\n\n\n## Code Samples\n\n### Creating a Reddit network graph\n**Note:** Due to limitations of the Reddit API, Each API call may have some delay, so using reddit-detective to collect large data might be unscalable for now. **Functionality to convert tabular Reddit data to network graph will be added.**\n```python\nimport praw\nfrom neo4j import GraphDatabase\n\nfrom reddit_detective import RedditNetwork, Comments\nfrom reddit_detective.data_models import Redditor\n\n# Create PRAW client instance\napi = praw.Reddit(\n    client_id=\"yourclientid\",\n    client_secret=\"yourclientsecret\",\n    user_agent=\"reddit-detective\"\n)\n\n# Create driver instance\ndriver = GraphDatabase.driver(\n    \"url_of_database\",\n    auth=(\"your_username\", \"your_password\")\n)\n\n# Create network graph\nnet = RedditNetwork(\n        driver=driver,\n        components=[\n            # Other relationship types are Submissions and CommentsReplies\n            # Other data models available as components are Subreddit and Submission\n            Comments(Redditor(api, \"BloodMooseSquirrel\", limit=5)),\n            Comments(Redditor(api, \"Anub_Rekhan\", limit=5))\n        ]\n    )\nnet.create_constraints() # Optional, doing once is enough\nnet.run_cypher_code()\nnet.add_karma(api)  # Shows karma as a property of nodes, optional\n```\n**Output (in Neo4j):**\n![Result](docs/images/network_img.PNG)\n\n\n### Finding interaction score\n```python\n# Assuming a network graph is created and database is started\n\n# Interaction score = A / (A + B)\n# Where A is the number of comments received in user's submissions\n# And B is the number of comments made by the user\nfrom reddit_detective.analytics import metrics\n\nscore = metrics.interaction_score(driver, \"Anub_Rekhan\")\nscore_norm = metrics.interaction_score_normalized(driver, \"Anub_Rekhan\")\nprint(\"Interaction score for Anub_Rekhan:\", score)\nprint(\"Normalized interaction score for Anub_Rekhan:\", score_norm)\n```\n**Output:**\n```\nInteraction score for Anub_Rekhan: 0.375\nNormalized interaction score for Anub_Rekhan: 0.057324840764331204\n```\n\n\n### Finding cyborg score\n```python\n# Assuming a network graph is created and database is started\n\n# For a user, submission or subreddit, return the ratio of cyborg-like comments to all comments\n# A cyborg-like comment is basically a comment posted within 6 seconds of the submission's creation\n# Why 6? Can't the user be a fast typer? \n#   See reddit_detective/analytics/metrics.py for detailed information\n\nfrom reddit_detective.analytics import metrics\n\nscore, comms = metrics.cyborg_score_user(driver, \"Anub_Rekhan\")\nprint(\"Cyborg score for Anub_Rekhan:\", score)\nprint(\"List of Cyborg-like comments of Anub_Rekhan:\", comms)\n```\n**Output:**\n```\nCyborg score for Anub_Rekhan: 0.2\nList of Cyborg-like comments of Anub_Rekhan: ['q3qm5mo']\n```\n\n\n### Running a Cypher statement\n```python\n# Assuming a network graph is created and database is started\n\nsession = driver.session()\nresult = session.run(\"Some cypher code\")\nsession.close()\n```\n\n\n## Upcoming features\n- [ ] Convert any tabular Reddit data to Neo4j Graph with given instructions from the user\n- [ ] UserToUser relationships\n    - A relationship to link users with its only property being the amount of **encounters**\n    - Having ties with the same submission is defined as an **encounter**\n- [ ] Add more paper-inspired metrics\n- [ ] Create a wrapper for centrality metrics of Neo4j GDSC (Graph data science library)\n\n\n## Inspiration\nList of works/papers that inspired reddit-detective:\n```\nauthors: [Sachin Thukral (TCS Research), Hardik Meisheri (TCS Research),\nArnab Chatterjee (TCS Research), Tushar Kataria (TCS Research),\nAman Agarwal (TCS Research), Lipika Dey (TCS Research),\nIshan Verma (TCS Research)]\n\ntitle: Analyzing behavioral trends in community driven\ndiscussion platforms like Reddit\n\npublished_in: 2018 IEEE/ACM International Conference on Advances in \nSocial Networks Analysis and Mining (ASONAM)\n\nDOI: 10.1109/ASONAM.2018.8508687\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumitkaanusta%2Freddit-detective","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumitkaanusta%2Freddit-detective","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumitkaanusta%2Freddit-detective/lists"}