I have conducted a code review of the SFR bot. This will pave the way for future improvements and innovations. The foremost being the SFR credit system via our newly created Steem-Engine token.
1. Moved all rank-related lists to the config file.
This included both mod and flagger ranks. This part of the report adds a nice visual element to what we do. I do imagine I will use these ranks for future role playing games. Let's just say I have a few ideas up my sleeve.
Mod Ranks
2. Updated Flagger Beneficiary Report Verbage
...Flaggers have been designated as post beneficiaries. Our goal is to empower abuse fighting
plankton and minnowsSteemians and promote aSteemplatform that is less-friendly to abuse. It is simple. Building abuse fighters equals less abuse.
3. Redesigned Flaggable Post Query
It now displays all flagged content that is less than 5 days old. This helps us to focus our voting power where it is most effective and avoid the late voting penalty. The entire query for flaggable posts is below. If you have any ideas, feel free to drop a comment.
sql_flaggable = cursor.execute( #Queries obtains flagged posts within the 5 day mark for report includsion and action
"SELECT DISTINCT CASE WHEN category LIKE '%nsfw%' OR category LIKE '%porn spam%' THEN '[NSFW link](https://steemit.com/' || post || '#' || comment || ')' " \
"ELSE '[Comment](https://steemit.com/\' || post || '#' || comment || ')' END, '@' || approved_by, category, post, comment, " \
"CASE WHEN category LIKE '%nsfw%' OR category LIKE '%porn spam%' THEN '[NSFW link](https://steemit.com/' || post || ')' " \
"ELSE '[Comment](https://steemit.com/\' || post || ')' END " \
"FROM steemflagrewards WHERE created > DATETIME(\'now\', \'-5 days\')")
4. Added batch method for mods to approve follow ons.
This function allows to submit all child mentions for approval in batch. This greatly improved the amount of time it takes when a mod finds a post that has many flag mentions. It's a great timesaver so we can focus more on abuse fighting and related development. The downside is it has a tendency to affect the accounting of approvals. This is because we now track in two channels.
5. Insert Mention Function
To condense our code, we have eliminated the repetion of database inserts. These inserts occur throughout our approval workflows. This was achieved by standardazing the queries. We took hard coded boolean values (True of False) and passed the variable as a parameter of said function. The greatly improves the readability of the code not to mention the amount of lines.
6. Export SFR Database to CSV function
This function exports the SFR database as a comma separated values file. This allows performance of various types of analytics. The function was recently used to provide @imacryptorick with our flag data used in his recent SFR flag trail tutorial. I highly recommend giving it a look to better understand. It breaks it down quite well.
Summary of Code Review
- 334 lines of code added or updated
- 56 lines of code trimmed
- 5 functions added
- 1 DB Query updated
This code review will help us prepare for the migration to the SFR credit system, a extensive undertaking in its own right. The DRY ("Don't Repeat Yourself") changes will ensure I only have to update the main bot code in 1 place instead of 7. If we ever need to add a column, this will reduce the time cost and chance for human error.
Because even though I am technically a cyborg, I still make mistakes.
These things will help pave the wave for the implementation of the SFR credit system. On that note, I have developed about 50% of the functionality required which have been mentioned at greater length in this comment.
Links to all GitHub commits:
Moved all rank-related lists to the config file.
Updated Flagger Beneficiary Report Verbage
Redesigned Flaggable Post Query
Batch Follow On Approval
Insert Mention Function - DRY Principle
Updated Flag LeaderBoard / Added Mod Leaderboard
Removed extraneous variables from main script
export_sfr_db function / add paid column to db
Thanks for all that believe in and support the work we are completing together for this chain.
It has taken a lot of time and effort for us to get this far and appreciate the community support / good vibes. I'm glad to add value to something that bolsters abuse fighting capability on chain. Like to think of what we do as force-multiplier of the stake we have assembled together as a community.
We can affect much greater change when we coordinate our efforts and our Steem Power together.

Would you like to delegate to the Steem Flag Rewards project and promote decentralized moderation?
It's much more fashionable than self-voting.
Here are some handy delegation links!
New Supporter Incentives Coming!
I will be providing increased flag incentives to those that:
- Follow me
- Follow @steemflagrewards
- Follow @smartmeme
- Follow @sfr-mod-fund
- Follow @admiralbot
This will improve our @busy.org support and flag capabilities. It is NOT a requirement but will be a perk for those willing to support. Furthermore, I will be working flagger / delegator incentives into the @steemflagrewards upvote algorithm. Stay Tuned.
Note: The primary incentive is reducing the profitability of abuse platform wide. This benefits all users of the Steem blockchain so please consider support.

