feat: add merge.py for log summaries and tags.py for word indexing with Makefile targets

This commit is contained in:
2025-01-06 23:53:41 +00:00
parent 9c360b7783
commit 82feb53f3c
6 changed files with 258 additions and 3 deletions
+12 -2
View File
@@ -150,7 +150,7 @@ def get_score_per_week():
def get_score_per_day():
sql ="SELECT count(0) as total, CASE WHEN strftime('%w', timestamp) = 0 THEN 'Sunday' WHEN strftime('%w', timestamp) = 1 THEN 'Monday' WHEN strftime('%w', timestamp) = 2 THEN 'Tuesday' WHEN strftime('%w', timestamp) = 3 THEN 'Wednesday' WHEN strftime('%w', timestamp) = 4 THEN 'Thursday' WHEN strftime('%w', timestamp) = 5 THEN 'Friday' WHEN strftime('%w', timestamp) = 6 THEN 'Saturday' END as weekday, strftime('%w', timestamp) as day, strftime('%U', timestamp) as week FROM kevent WHERE event = 'REPEATED' AND week = '50' GROUP BY week, day ORDER BY day"
sql ="SELECT count(0) as total, CASE WHEN strftime('%w', timestamp) = 0 THEN 'Sunday' WHEN strftime('%w', timestamp) = 1 THEN 'Monday' WHEN strftime('%w', timestamp) = 2 THEN 'Tuesday' WHEN strftime('%w', timestamp) = 3 THEN 'Wednesday' WHEN strftime('%w', timestamp) = 4 THEN 'Thursday' WHEN strftime('%w', timestamp) = 5 THEN 'Friday' WHEN strftime('%w', timestamp) = 6 THEN 'Saturday' END as weekday, strftime('%w', timestamp) as day, strftime('%U', timestamp) as week FROM kevent WHERE event = 'REPEATED' GROUP BY week, day ORDER BY day"
sql = (
f"SELECT strftime('%U',timestamp) as week, {weekday_sql} as wday, event, COUNT(0) as total "
@@ -215,5 +215,15 @@ if __name__ == "__main__":
print("Done")
f.write(response)
print(response)
for file in pathlib.Path(".").glob("logs_summaries/*.txt"):
dest_file = file.parent.parent.joinpath("logs_lines").joinpath(file.name)
if dest_file.exists():
print("One liner already exists for" + file.name)
continue
with dest_file.open("w+") as f:
source = file.read_text().replace("@","").replace("`","")
response = api.gpt4o_mini("The following data is a hour of work summarized from the user. Describe what user was doing in a onliner.: "+source)
f.write(response)
print("Made one liner for" + file.name)
print("Duration: {}".format(time.time() - time_start))