create account

Utopian.rocks -> Utopian.info - Category overview by amosbastian

View this thread on: hive.blogpeakd.comecency.com
· @amosbastian · (edited)
$105.75
Utopian.rocks -> Utopian.info - Category overview
The last week I have been working on adding a category overview. This took longer than expected, as I have been sick this week, and also faced some challenges where I had to remake huge parts of my code, but here I am! @wehmoen has also provided the https://utopian.info/ domain (thanks!), so I will be referring to it as such from now on. I hope it's useful!

### Features
As I mentioned above, I added a category overview for all categories. Each overview has a graph that shows the amount of accepted/rejected contributions submitted to that category, each day, in the last week. Above this graph there's a bar showing the total amount of accepted/rejected/pending contributions for that category in the same time frame. Finally, there are three "leaderboards" at the bottom of the page, showing the contributors with the most accepted contributions, contributors with the most rejected contributions and moderators with the most reviewed contributions respectively. You can see this in action by going here https://utopian.info/category/all or watching the GIF below!

![categoryoverview.gif](https://res.cloudinary.com/hpiynhbhq/image/upload/v1520723172/nzgjahyfagbgu4xee02z.gif)

I tried to make it look relatively decent, but hopefully someone that is actually good at CSS and UX will make it look much better in the future (wanted to add some other statistics to the leaderboards, but couldn't make it look right)! I will probably add some more stuff to this overview in the future (like the original pie chart on utopian.info) once I think of it.  I also changed the supervisor overview slightly; supervisors themselves are now also shown in the overview (excluding points earned from task-requests) and each category on there links to its respective overview.

I also definitely want to add a proper homepage, instead of the current one, because it's currently pretty hard to find the category overview if you don't know it exists. The problem with this is that I have no idea how to make it look good, so if anyone can help with that, please contact me!

### How was it implemented?
#### Creating the dictionary
When I first started implementing everything, I created one function that created a huge dictionary containing *all* information about *all* categories, and I wanted to show everything on 1 page. After realising this wasn't the best way to do this, I created the route `/categories/<category>`, where `category` is a parameter for the `categories()` function in `app.py`. This function then retrieves all contributions made to the given category from the database and passes this to the `category_information()` function. This function creates three dictionaries, one for the category itself, one for the contributors and one for the moderators. Information is then extracted from each post to the relevant dictionary, and finally the functions `category_plot()` (creates the graph using [Bokeh](https://bokeh.pydata.org/en/latest/)), `author_leaderboard()` and `moderator_leaderboard()` are used to calculate some additional information/variables used on the page, which is then added to the `category` dictionary. This dictionary is then passed to the template, which is used to display all the information you see.
### Rendering the templates
There are actually two Jinja2 templates that are used to show each category's overview. The first one is `categories.html`, which uses a for loop to create the category sidebar on the left of the page. It is also the parent template of `category.html`, which is the template used to display the bar, the graph and the three leaderboards. This is also done using for loops to create the leaderboards, Bootstrap's progress bar to create the bar at the top, and the `<div>` and `<script>` returned by the  `category_plot()` function in `app.py` are used to create the graph.
### Styling the templates
The CSS for the leaderboards was adapted from [here](https://codepen.io/anon/pen/OvJxeq), and after watching some CSS tutorials (finally learned the difference between padding and margin...) I managed to style the rest myself. As I mentioned earlier, some people have contacted me to maybe help out with the UX/CSS etc. so my goal was to just make it presentable. Hopefully in the future it will look a lot better once others start working on it!

To see how to contribute and what my plans/roadmap are please check out [this post](https://utopian.io/utopian-io/@amosbastian/introducing-utopian-rocks) or the README! The next thing I'm probably going to work on is adding a way to change the time frame for both the category overview and the team overview. I also want to add sorting to the team overview tables and implement a proper homepage.

<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@amosbastian/utopian-rocks-utopian-info-category-overview">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authoramosbastian
permlinkutopian-rocks-utopian-info-category-overview
categoryutopian-io
json_metadata"{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":123324842,"name":"utopian","full_name":"amosbastian/utopian","html_url":"https://github.com/amosbastian/utopian","fork":false,"owner":{"login":"amosbastian"}},"pullRequests":[],"platform":"github","type":"development","tags":["utopian-io","steemdev","programming","utopian","info"],"users":["wehmoen","amosbastian"],"links":["https://res.cloudinary.com/hpiynhbhq/image/upload/v1520723172/nzgjahyfagbgu4xee02z.gif","https://bokeh.pydata.org/en/latest/","https://codepen.io/anon/pen/OvJxeq","https://utopian.io/utopian-io/@amosbastian/introducing-utopian-rocks"],"image":["https://res.cloudinary.com/hpiynhbhq/image/upload/v1520723172/nzgjahyfagbgu4xee02z.gif"],"moderator":{"account":"ms10398","time":"2018-03-11T08:49:57.760Z","reviewed":true,"pending":false,"flagged":false},"questions":[{"question":"Is the project description formal?","answers":[{"value":"Yes it’s straight to the point","selected":true,"score":10},{"value":"Need more description ","selected":false,"score":5},{"value":"Not too descriptive","selected":false,"score":0}],"selected":0},{"question":"Is the language / grammar correct?","answers":[{"value":"Yes","selected":true,"score":20},{"value":"A few mistakes","selected":false,"score":10},{"value":"It's pretty bad","selected":false,"score":0}],"selected":0},{"question":"Was the template followed?","answers":[{"value":"Yes","selected":true,"score":10},{"value":"Partially","selected":false,"score":5},{"value":"No","selected":false,"score":0}],"selected":0},{"question":"How do you rate the amount of work?","answers":[{"value":"Very High","selected":true,"score":20},{"value":"High","selected":false,"score":16},{"value":"Medium","selected":false,"score":12},{"value":"Low","selected":false,"score":7},{"value":"Very Low","selected":false,"score":3}],"selected":0},{"question":"How do you rate the impact on the Project?","answers":[{"value":"Very High","selected":true,"score":20},{"value":"High","selected":false,"score":16},{"value":"Medium","selected":false,"score":12},{"value":"Low","selected":false,"score":7},{"value":"Very Low","selected":false,"score":3}],"selected":0}],"score":100}"
created2018-03-10 23:11:15
last_update2018-03-11 08:50:06
depth0
children6
last_payout2018-03-17 23:11:15
cashout_time1969-12-31 23:59:59
total_payout_value74.418 HBD
curator_payout_value31.331 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,898
author_reputation174,473,586,900,705
root_title"Utopian.rocks -> Utopian.info - Category overview"
beneficiaries
0.
accountutopian.pay
weight2,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id43,600,127
net_rshares39,956,599,495,843
author_curate_reward""
vote details (59)
@ms10398 ·
$1.39
Thank you for the contribution. It has been approved.

You can contact us on [Discord](https://discord.gg/uTyJkNm).

**[[utopian-moderator]](https://utopian.io/moderators)**
πŸ‘  ,
properties (23)
authorms10398
permlinkre-amosbastian-utopian-rocks-utopian-info-category-overview-20180311t085013041z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-03-11 08:50:12
last_update2018-03-11 08:50:12
depth1
children2
last_payout2018-03-18 08:50:12
cashout_time1969-12-31 23:59:59
total_payout_value1.046 HBD
curator_payout_value0.344 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length173
author_reputation27,572,487,973,390
root_title"Utopian.rocks -> Utopian.info - Category overview"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id43,667,797
net_rshares423,500,217,901
author_curate_reward""
vote details (2)
@amosbastian ·
Thanks!
properties (22)
authoramosbastian
permlinkre-ms10398-re-amosbastian-utopian-rocks-utopian-info-category-overview-20180311t105235969z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"busy","app":"busy/2.4.0"}
created2018-03-11 10:52:45
last_update2018-03-11 10:52:45
depth2
children0
last_payout2018-03-18 10:52:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length7
author_reputation174,473,586,900,705
root_title"Utopian.rocks -> Utopian.info - Category overview"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id43,683,072
net_rshares0
@utopian.tip ·
Hey @ms10398, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!
properties (22)
authorutopian.tip
permlinkre-re-amosbastian-utopian-rocks-utopian-info-category-overview-20180311t085013041z-20180311t132727
categoryutopian-io
json_metadata""
created2018-03-11 13:27:27
last_update2018-03-11 13:27:27
depth2
children0
last_payout2018-03-18 13:27:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length157
author_reputation238,310,597,885
root_title"Utopian.rocks -> Utopian.info - Category overview"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id43,705,144
net_rshares0
@putra-muda ·
Good
properties (22)
authorputra-muda
permlinkre-amosbastian-2018312t12343642z
categoryutopian-io
json_metadata{"tags":["utopian-io","steemdev","programming","utopian","info"],"app":"esteem/1.5.1","format":"markdown+html","community":"esteem"}
created2018-03-11 18:23:48
last_update2018-03-11 18:23:48
depth1
children0
last_payout2018-03-18 18:23:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4
author_reputation124,424,702,323
root_title"Utopian.rocks -> Utopian.info - Category overview"
beneficiaries
0.
accountesteemapp
weight1,000
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id43,754,993
net_rshares0
@richardbmx ·
how well you have been left is a way to see utopian statistics in a very nice way excellent job regards ...
properties (22)
authorrichardbmx
permlinkre-amosbastian-utopian-rocks-utopian-info-category-overview-20180312t023358981z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-03-12 02:34:15
last_update2018-03-12 02:34:15
depth1
children0
last_payout2018-03-19 02:34:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length107
author_reputation16,631,452,005,431
root_title"Utopian.rocks -> Utopian.info - Category overview"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id43,816,358
net_rshares0
@utopian-io ·
### 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!
#### Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. <a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER!
- <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness With SteemConnect</a>
- <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness with SteemConnect</a>
- Or vote/proxy on <a href="https://steemit.com/~witnesses">Steemit Witnesses</a>

[![mooncryption-utopian-witness-gif](https://steemitimages.com/DQmYPUuQRptAqNBCQRwQjKWAqWU3zJkL3RXVUtEKVury8up/mooncryption-s-utopian-io-witness-gif.gif)](https://steemit.com/~witnesses)

**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**
properties (22)
authorutopian-io
permlinkre-amosbastian-utopian-rocks-utopian-info-category-overview-20180311t165722381z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-03-11 16:57:24
last_update2018-03-11 16:57:24
depth1
children0
last_payout2018-03-18 16:57:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,087
author_reputation152,955,367,999,756
root_title"Utopian.rocks -> Utopian.info - Category overview"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id43,740,955
net_rshares0