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
|
## 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.
|
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]
|
[options.entry_points]
|
||||||
console_scripts =
|
console_scripts =
|
||||||
dr.sync = drstats.sync:sync
|
dr.sync = drstats.sync:sync
|
||||||
dr.rant_stats_per_day = drstats.statistics:rant_stats_per_day
|
dr.stats = drstats.statistics:rant_stats_all
|
||||||
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.dataset = drstats.dataset:dump
|
dr.dataset = drstats.dataset:dump
|
@ -1,38 +1,26 @@
|
|||||||
from drstats.db import get_db, Db, get_users
|
from drstats.db import get_db, Db, get_users
|
||||||
from drstats import sync
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from drstats.duration import Duration
|
from drstats.duration import Duration
|
||||||
|
|
||||||
from time import sleep
|
|
||||||
import importlib
|
|
||||||
|
|
||||||
|
|
||||||
def plt_reset():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
def new_plot():
|
||||||
_figure_count = 0
|
|
||||||
|
|
||||||
|
|
||||||
def figure_inc():
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
plt.clf()
|
plt.clf()
|
||||||
plt.cla()
|
plt.cla()
|
||||||
plt.close(0)
|
plt.close(0)
|
||||||
plt.figure(figsize=(8, 8))
|
plt.figure(figsize=(8, 8))
|
||||||
return plt
|
return plt
|
||||||
# return pyplot.figure(_figure_count)
|
|
||||||
|
|
||||||
|
|
||||||
def get_date_range():
|
def get_date_range():
|
||||||
db = get_db()
|
with Db() as db:
|
||||||
for record in db.query(
|
record = list(db.query(
|
||||||
"SELECT min(date(created)) as start_date, max(date(created)) as end_date FROM rants"
|
"SELECT min(date(created)) as start_date, max(date(created)) as end_date FROM rants"
|
||||||
):
|
))[0]
|
||||||
db.close()
|
|
||||||
return record["start_date"], record["end_date"]
|
return record["start_date"], record["end_date"]
|
||||||
db.close()
|
|
||||||
|
|
||||||
|
|
||||||
def get_date_range_str():
|
def get_date_range_str():
|
||||||
@ -42,7 +30,7 @@ def get_date_range_str():
|
|||||||
|
|
||||||
async def rant_stats_per_day():
|
async def rant_stats_per_day():
|
||||||
with Duration("Rant stats per day"):
|
with Duration("Rant stats per day"):
|
||||||
plt = figure_inc()
|
plt = new_plot()
|
||||||
async with Db() as db:
|
async with Db() as db:
|
||||||
x = []
|
x = []
|
||||||
y = []
|
y = []
|
||||||
@ -62,14 +50,13 @@ async def rant_stats_per_day():
|
|||||||
plt.title("Rants per day")
|
plt.title("Rants per day")
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.savefig(f"export/rants_per_day_{get_date_range_str()}.png")
|
plt.savefig(f"export/rants_per_day_{get_date_range_str()}.png")
|
||||||
plt_reset()
|
|
||||||
# plt.show()
|
|
||||||
|
|
||||||
|
|
||||||
async def comment_stats_per_day():
|
async def comment_stats_per_day():
|
||||||
with Duration("Comment stats per day"):
|
with Duration("Comment stats per day"):
|
||||||
|
|
||||||
plt = figure_inc()
|
plt = new_plot()
|
||||||
async with Db() as db:
|
async with Db() as db:
|
||||||
x = []
|
x = []
|
||||||
y = []
|
y = []
|
||||||
@ -89,13 +76,12 @@ async def comment_stats_per_day():
|
|||||||
plt.title("Comments per day")
|
plt.title("Comments per day")
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.savefig(f"export/comments_per_day_{get_date_range_str()}.png")
|
plt.savefig(f"export/comments_per_day_{get_date_range_str()}.png")
|
||||||
plt_reset()
|
|
||||||
# plt.show()
|
|
||||||
|
|
||||||
|
|
||||||
async def rant_stats_per_weekday():
|
async def rant_stats_per_weekday():
|
||||||
with Duration("Rant stats per weekday"):
|
with Duration("Rant stats per weekday"):
|
||||||
plt = figure_inc()
|
plt = new_plot()
|
||||||
async with Db() as db:
|
async with Db() as db:
|
||||||
x = []
|
x = []
|
||||||
y = []
|
y = []
|
||||||
@ -111,13 +97,12 @@ async def rant_stats_per_weekday():
|
|||||||
plt.title("Rants per weekday")
|
plt.title("Rants per weekday")
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.savefig(f"export/rants_per_weekday_{get_date_range_str()}.png")
|
plt.savefig(f"export/rants_per_weekday_{get_date_range_str()}.png")
|
||||||
plt_reset()
|
|
||||||
# plt.show()
|
|
||||||
|
|
||||||
|
|
||||||
async def comment_stats_per_weekday():
|
async def comment_stats_per_weekday():
|
||||||
with Duration("Comment stats per weekday"):
|
with Duration("Comment stats per weekday"):
|
||||||
plt = figure_inc()
|
plt = new_plot()
|
||||||
async with Db() as db:
|
async with Db() as db:
|
||||||
x = []
|
x = []
|
||||||
y = []
|
y = []
|
||||||
@ -133,13 +118,12 @@ async def comment_stats_per_weekday():
|
|||||||
plt.title("Comments per weekday")
|
plt.title("Comments per weekday")
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.savefig(f"export/comments_per_weekday_{get_date_range_str()}.png")
|
plt.savefig(f"export/comments_per_weekday_{get_date_range_str()}.png")
|
||||||
plt_reset()
|
|
||||||
# plt.show()
|
|
||||||
|
|
||||||
|
|
||||||
async def rant_stats_per_hour():
|
async def rant_stats_per_hour():
|
||||||
with Duration("Rant stats per hour"):
|
with Duration("Rant stats per hour"):
|
||||||
plt = figure_inc()
|
plt = new_plot()
|
||||||
async with Db() as db:
|
async with Db() as db:
|
||||||
x = []
|
x = []
|
||||||
y = []
|
y = []
|
||||||
@ -155,13 +139,12 @@ async def rant_stats_per_hour():
|
|||||||
plt.title("Rants per hour")
|
plt.title("Rants per hour")
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.savefig(f"export/rants_per_hour_{get_date_range_str()}.png")
|
plt.savefig(f"export/rants_per_hour_{get_date_range_str()}.png")
|
||||||
plt_reset()
|
|
||||||
# plt.show()
|
|
||||||
|
|
||||||
|
|
||||||
async def comment_stats_per_hour():
|
async def comment_stats_per_hour():
|
||||||
with Duration("Comment stats per hour"):
|
with Duration("Comment stats per hour"):
|
||||||
plt = figure_inc()
|
plt = new_plot()
|
||||||
async with Db() as db:
|
async with Db() as db:
|
||||||
x = []
|
x = []
|
||||||
y = []
|
y = []
|
||||||
@ -177,13 +160,12 @@ async def comment_stats_per_hour():
|
|||||||
plt.title("Comments per hour")
|
plt.title("Comments per hour")
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.savefig(f"export/comments_per_hour_{get_date_range_str()}.png")
|
plt.savefig(f"export/comments_per_hour_{get_date_range_str()}.png")
|
||||||
plt_reset()
|
|
||||||
# plt.show()
|
|
||||||
|
|
||||||
|
|
||||||
async def score_most_ignored_last_7_days():
|
async def score_most_ignored_last_7_days():
|
||||||
with Duration("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:
|
async with Db() as db:
|
||||||
x = []
|
x = []
|
||||||
y = []
|
y = []
|
||||||
@ -195,7 +177,6 @@ async def score_most_ignored_last_7_days():
|
|||||||
y.append(record["userscore"])
|
y.append(record["userscore"])
|
||||||
|
|
||||||
plt.bar(x, y, label="Upvotes")
|
plt.bar(x, y, label="Upvotes")
|
||||||
# plt.plot(x, y, label=get_date_range_str(), color='pink')
|
|
||||||
plt.xticks(rotation=45)
|
plt.xticks(rotation=45)
|
||||||
plt.xlabel("Ranter")
|
plt.xlabel("Ranter")
|
||||||
plt.ylabel("Times ignored")
|
plt.ylabel("Times ignored")
|
||||||
@ -204,13 +185,12 @@ async def score_most_ignored_last_7_days():
|
|||||||
plt.savefig(
|
plt.savefig(
|
||||||
f"export/score_ignored_most_last_7_days_{get_date_range_str()}.png"
|
f"export/score_ignored_most_last_7_days_{get_date_range_str()}.png"
|
||||||
)
|
)
|
||||||
plt_reset()
|
|
||||||
# plt.show()
|
|
||||||
|
|
||||||
|
|
||||||
async def score_last_7_days():
|
async def score_last_7_days():
|
||||||
with Duration("Upvotes (score) last 7 days"):
|
with Duration("Upvotes (score) last 7 days"):
|
||||||
plt = figure_inc()
|
plt = new_plot()
|
||||||
async with Db() as db:
|
async with Db() as db:
|
||||||
x = []
|
x = []
|
||||||
y = []
|
y = []
|
||||||
@ -220,20 +200,18 @@ async def score_last_7_days():
|
|||||||
y.append(record["userscore"])
|
y.append(record["userscore"])
|
||||||
|
|
||||||
plt.bar(x, y, label="Upvotes")
|
plt.bar(x, y, label="Upvotes")
|
||||||
# plt.plot(x, y, label=get_date_range_str(), color='pink')
|
|
||||||
plt.xticks(rotation=45)
|
plt.xticks(rotation=45)
|
||||||
plt.xlabel("Ranter")
|
plt.xlabel("Ranter")
|
||||||
plt.ylabel("Upvote count")
|
plt.ylabel("Upvote count")
|
||||||
plt.title("Most ignored based on score regarding last 7 days")
|
plt.title("Most ignored based on score regarding last 7 days")
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.savefig(f"export/score_last_7_days_{get_date_range_str()}.png")
|
plt.savefig(f"export/score_last_7_days_{get_date_range_str()}.png")
|
||||||
plt_reset()
|
|
||||||
# plt.show()
|
|
||||||
|
|
||||||
|
|
||||||
async def user_score_per_day(username):
|
async def user_score_per_day(username):
|
||||||
with Duration("User {} score per day".format(username)):
|
with Duration("User {} score per day".format(username)):
|
||||||
plt = figure_inc()
|
plt = new_plot()
|
||||||
async with Db() as db:
|
async with Db() as db:
|
||||||
|
|
||||||
plt.xticks(rotation=45)
|
plt.xticks(rotation=45)
|
||||||
@ -280,12 +258,10 @@ async def user_score_per_day(username):
|
|||||||
|
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.savefig(f"export/score_user_{username}_{get_date_range_str()}.png")
|
plt.savefig(f"export/score_user_{username}_{get_date_range_str()}.png")
|
||||||
plt_reset()
|
|
||||||
|
|
||||||
|
|
||||||
def rant_stats_all():
|
def stats():
|
||||||
print("Did you sync all rants before running this?")
|
|
||||||
sleep(3)
|
|
||||||
with Duration("Complete process"):
|
with Duration("Complete process"):
|
||||||
asyncio.run(rant_stats_per_day())
|
asyncio.run(rant_stats_per_day())
|
||||||
asyncio.run(rant_stats_per_weekday())
|
asyncio.run(rant_stats_per_weekday())
|
||||||
|
Loading…
Reference in New Issue
Block a user