Cleanup
This commit is contained in:
parent
38c13427c6
commit
a6697fab58
@ -6,9 +6,9 @@ Also this data will be used for retoor9b, the newest AI hype! You're still using
|
||||
|
||||
## Statistics by last build
|
||||
|
||||
Click here for latest [dataset](https://retoor.molodetz.nl/retoor/drstats/src/branch/main/export/0_dataset.txt).
|
||||
Click here for latest [dataset](https://retoor.molodetz.nl/retoor/drstats/src/branch/main/export/0_dataset.txt) optimized for training LLM's like retoor9b.
|
||||
|
||||
Click here for latest [graphs compilaiton](https://retoor.molodetz.nl/retoor/drstats/src/branch/main/export/1_graphs_compliation.png).
|
||||
Click here for latest [graphs compilation](https://retoor.molodetz.nl/retoor/drstats/src/branch/main/export/1_graphs_compliation.png).
|
||||
|
||||
Click here for all generated [data](https://retoor.molodetz.nl/retoor/drstats/src/branch/main/export). It's a big dataset containing data for LLM's to train on, graphs per user or overal statistics and json files with all made observations.
|
||||
|
||||
|
@ -25,8 +25,5 @@ where = src
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
dr.sync = drstats.sync:sync
|
||||
dr.rant_stats_per_day = drstats.statistics:rant_stats_per_day
|
||||
dr.rant_stats_per_weekday = drstats.statistics:rant_stats_per_weekday
|
||||
dr.rant_stats_per_hour = drstats.statistics:rant_stats_per_hour
|
||||
dr.stats_all = drstats.statistics:rant_stats_all
|
||||
dr.stats = drstats.statistics:rant_stats_all
|
||||
dr.dataset = drstats.dataset:dump
|
@ -1,38 +1,26 @@
|
||||
from drstats.db import get_db, Db, get_users
|
||||
from drstats import sync
|
||||
import asyncio
|
||||
from drstats.duration import Duration
|
||||
|
||||
from time import sleep
|
||||
import importlib
|
||||
|
||||
|
||||
def plt_reset():
|
||||
pass
|
||||
|
||||
|
||||
_figure_count = 0
|
||||
|
||||
|
||||
def figure_inc():
|
||||
def new_plot():
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
plt.clf()
|
||||
plt.cla()
|
||||
plt.close(0)
|
||||
plt.figure(figsize=(8, 8))
|
||||
return plt
|
||||
# return pyplot.figure(_figure_count)
|
||||
|
||||
|
||||
def get_date_range():
|
||||
db = get_db()
|
||||
for record in db.query(
|
||||
"SELECT min(date(created)) as start_date, max(date(created)) as end_date FROM rants"
|
||||
):
|
||||
db.close()
|
||||
with Db() as db:
|
||||
record = list(db.query(
|
||||
"SELECT min(date(created)) as start_date, max(date(created)) as end_date FROM rants"
|
||||
))[0]
|
||||
return record["start_date"], record["end_date"]
|
||||
db.close()
|
||||
|
||||
|
||||
|
||||
def get_date_range_str():
|
||||
@ -42,7 +30,7 @@ def get_date_range_str():
|
||||
|
||||
async def rant_stats_per_day():
|
||||
with Duration("Rant stats per day"):
|
||||
plt = figure_inc()
|
||||
plt = new_plot()
|
||||
async with Db() as db:
|
||||
x = []
|
||||
y = []
|
||||
@ -62,14 +50,13 @@ async def rant_stats_per_day():
|
||||
plt.title("Rants per day")
|
||||
plt.legend()
|
||||
plt.savefig(f"export/rants_per_day_{get_date_range_str()}.png")
|
||||
plt_reset()
|
||||
# plt.show()
|
||||
|
||||
|
||||
|
||||
async def comment_stats_per_day():
|
||||
with Duration("Comment stats per day"):
|
||||
|
||||
plt = figure_inc()
|
||||
plt = new_plot()
|
||||
async with Db() as db:
|
||||
x = []
|
||||
y = []
|
||||
@ -89,13 +76,12 @@ async def comment_stats_per_day():
|
||||
plt.title("Comments per day")
|
||||
plt.legend()
|
||||
plt.savefig(f"export/comments_per_day_{get_date_range_str()}.png")
|
||||
plt_reset()
|
||||
# plt.show()
|
||||
|
||||
|
||||
|
||||
async def rant_stats_per_weekday():
|
||||
with Duration("Rant stats per weekday"):
|
||||
plt = figure_inc()
|
||||
plt = new_plot()
|
||||
async with Db() as db:
|
||||
x = []
|
||||
y = []
|
||||
@ -111,13 +97,12 @@ async def rant_stats_per_weekday():
|
||||
plt.title("Rants per weekday")
|
||||
plt.legend()
|
||||
plt.savefig(f"export/rants_per_weekday_{get_date_range_str()}.png")
|
||||
plt_reset()
|
||||
# plt.show()
|
||||
|
||||
|
||||
|
||||
async def comment_stats_per_weekday():
|
||||
with Duration("Comment stats per weekday"):
|
||||
plt = figure_inc()
|
||||
plt = new_plot()
|
||||
async with Db() as db:
|
||||
x = []
|
||||
y = []
|
||||
@ -133,13 +118,12 @@ async def comment_stats_per_weekday():
|
||||
plt.title("Comments per weekday")
|
||||
plt.legend()
|
||||
plt.savefig(f"export/comments_per_weekday_{get_date_range_str()}.png")
|
||||
plt_reset()
|
||||
# plt.show()
|
||||
|
||||
|
||||
|
||||
async def rant_stats_per_hour():
|
||||
with Duration("Rant stats per hour"):
|
||||
plt = figure_inc()
|
||||
plt = new_plot()
|
||||
async with Db() as db:
|
||||
x = []
|
||||
y = []
|
||||
@ -155,13 +139,12 @@ async def rant_stats_per_hour():
|
||||
plt.title("Rants per hour")
|
||||
plt.legend()
|
||||
plt.savefig(f"export/rants_per_hour_{get_date_range_str()}.png")
|
||||
plt_reset()
|
||||
# plt.show()
|
||||
|
||||
|
||||
|
||||
async def comment_stats_per_hour():
|
||||
with Duration("Comment stats per hour"):
|
||||
plt = figure_inc()
|
||||
plt = new_plot()
|
||||
async with Db() as db:
|
||||
x = []
|
||||
y = []
|
||||
@ -177,13 +160,12 @@ async def comment_stats_per_hour():
|
||||
plt.title("Comments per hour")
|
||||
plt.legend()
|
||||
plt.savefig(f"export/comments_per_hour_{get_date_range_str()}.png")
|
||||
plt_reset()
|
||||
# plt.show()
|
||||
|
||||
|
||||
|
||||
async def score_most_ignored_last_7_days():
|
||||
with Duration("Score most ignored last 7 days"):
|
||||
plt = figure_inc()
|
||||
plt = new_plot()
|
||||
async with Db() as db:
|
||||
x = []
|
||||
y = []
|
||||
@ -195,7 +177,6 @@ async def score_most_ignored_last_7_days():
|
||||
y.append(record["userscore"])
|
||||
|
||||
plt.bar(x, y, label="Upvotes")
|
||||
# plt.plot(x, y, label=get_date_range_str(), color='pink')
|
||||
plt.xticks(rotation=45)
|
||||
plt.xlabel("Ranter")
|
||||
plt.ylabel("Times ignored")
|
||||
@ -204,13 +185,12 @@ async def score_most_ignored_last_7_days():
|
||||
plt.savefig(
|
||||
f"export/score_ignored_most_last_7_days_{get_date_range_str()}.png"
|
||||
)
|
||||
plt_reset()
|
||||
# plt.show()
|
||||
|
||||
|
||||
|
||||
async def score_last_7_days():
|
||||
with Duration("Upvotes (score) last 7 days"):
|
||||
plt = figure_inc()
|
||||
plt = new_plot()
|
||||
async with Db() as db:
|
||||
x = []
|
||||
y = []
|
||||
@ -220,20 +200,18 @@ async def score_last_7_days():
|
||||
y.append(record["userscore"])
|
||||
|
||||
plt.bar(x, y, label="Upvotes")
|
||||
# plt.plot(x, y, label=get_date_range_str(), color='pink')
|
||||
plt.xticks(rotation=45)
|
||||
plt.xlabel("Ranter")
|
||||
plt.ylabel("Upvote count")
|
||||
plt.title("Most ignored based on score regarding last 7 days")
|
||||
plt.legend()
|
||||
plt.savefig(f"export/score_last_7_days_{get_date_range_str()}.png")
|
||||
plt_reset()
|
||||
# plt.show()
|
||||
|
||||
|
||||
|
||||
async def user_score_per_day(username):
|
||||
with Duration("User {} score per day".format(username)):
|
||||
plt = figure_inc()
|
||||
plt = new_plot()
|
||||
async with Db() as db:
|
||||
|
||||
plt.xticks(rotation=45)
|
||||
@ -280,12 +258,10 @@ async def user_score_per_day(username):
|
||||
|
||||
plt.legend()
|
||||
plt.savefig(f"export/score_user_{username}_{get_date_range_str()}.png")
|
||||
plt_reset()
|
||||
|
||||
|
||||
def rant_stats_all():
|
||||
print("Did you sync all rants before running this?")
|
||||
sleep(3)
|
||||
|
||||
def stats():
|
||||
with Duration("Complete process"):
|
||||
asyncio.run(rant_stats_per_day())
|
||||
asyncio.run(rant_stats_per_weekday())
|
||||
|
Loading…
Reference in New Issue
Block a user