Add moderator's "review comment" to Utopian.info database

in utopian-io •  7 years ago  (edited)

Utopian.info uses Python, and this feature should be implemented using Python, so the only prerequisite for this task is knowledge of the Python programming language.

Details about the task

image.png

I want to add the comment a moderator posts after reviewing a contribution (see the above image) to the database of Utopian.info (the utopian.info domain is currently down, but you can access it via https://www.utopian.rocks/ or run it offline (instructions are in the README)). The way it works: I have a cron that executes update_database.py every 30 minutes, which uses utopian_client.py to update the database's posts. Currently a post in the database looks like this for example

{
  "_id": "5a9595fc655e7642505a7d73",
  "moderator": {
    "flagged": false,
    "pending": false,
    "reviewed": true,
    "time": "2018-02-27 17:45:48.692000",
    "account": "ulkembetil"
  },
  "author": "omersurer",
  "permlink": "dollar-street-translation-contribution-en-to-nl-10",
  "title": "Dollar Street - Translation Contribution - EN to NL #10",
  "repository": {
    "owner": {
      "login": "Gapminder"
    },
    "fork": false,
    "html_url": "https:\/\/github.com\/Gapminder\/dollar-street-pages",
    "full_name": "Gapminder\/dollar-street-pages",
    "name": "dollar-street-pages",
    "id": 51510431
  },
  "last_update": "2018-02-27 17:45:48",
  "created": "2018-02-27 17:31:36",
  "active": "2018-02-28 12:51:21",
  "category": "translations",
  "modified": false,
  "status": "any",
  "updated": "2018-03-21 22:27:11.136000",
  "score": 0,
  "questions": [
    
  ]
}

and I would like the key comment to be added, where the value of it is the text of the comment made by the moderator who reviewed it. I have tried implementing this myself using steem-python (see the code below)

author = new_post["author"]
permlink = new_post["permlink"]
new_post["comment"] = "N/A"
steemit_post = Post(f"@{author}/{permlink}")

for post in Post.get_all_replies(steemit_post):
    if (post["author"] == moderator["account"] and
        "[[utopian-moderator]]" in post["body"]):
        new_post["comment"] = post["body"]
        return new_post

which can be found (commented out) in utopian_client.py within the create_post() function (see here). However, this is too slow to be feasible (how I've implemented it at least), so it must either be done using the above code in combination with multiprocessing (tried adding that, but still seems too slow), or any other way you see fit (web crawling for example) - the only requirement I have is that it must work on a droplet that only has 1GB of RAM and that the time it takes to update the database (so all posts that were submitted in the last 7 days) does not take more than 5 minutes. Obviously just checking if the string "[[utopian-moderator]]" is in the comment is not the best way to find a moderator's comment, so this could be improved as well, because if a comment exists I want it to be added to the database with 100% accuracy.

Components

The only file that really needs to be changed is utopian_client.py. As I mentioned above, I've already tried adding multiprocessing, so you can start with that.

Deadline

The scope of this feature isn't that big (it's hard for me to determine how much work this will be, as I've spent the last few days working on it with no luck), so I will set 23:59 on 5 April 2018 (two weeks from now) as the deadline, which should be more than enough time.

Communication

The best way to contact me with questions regarding this task request is on Discord at Amos#4622.

Any help with this would be appreciated greatly, as I think it would be really nice to add this to each moderator's page that is already available on Utopian.info (e.g. mine).



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Your task request has been approved in Utopian.

You can contact us on Discord.
[utopian-moderator]

Looks like very nice task ;)

I sent you few questions on discord. I will work on it 👍

Congratulations @amosbastian! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on any badge to view your own Board of Honor on SteemitBoard.

To support your work, I also upvoted your post!
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

Upvote this notification to help all Steemit users. Learn why here!

  ·  7 years ago (edited)

from api,
post:
api.utopian.io/api/posts/[author]/[permlink]
comment after moderation:
api.utopian.io/api/posts/[moderator.account]/re-[author]-[permlink]-[moderator.time]

not sure about timestamp convertion.
might be a way to solve it.

Hey @amosbastian I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x