From 34385c8bf82955cadd2ca2c90bf46969ceba1ac8 Mon Sep 17 00:00:00 2001 From: Dani Date: Sun, 27 Apr 2025 18:57:30 -0400 Subject: [PATCH] Added a new health page --- dashboard/dashboard.py | 41 +++++++++++++++++ dashboard/templates/brainmap.html | 1 + dashboard/templates/concepts.html | 1 + dashboard/templates/dreams.html | 1 + dashboard/templates/growth.html | 1 + dashboard/templates/health.html | 74 +++++++++++++++++++++++++++++++ dashboard/templates/index.html | 1 + dashboard/templates/journal.html | 1 + 8 files changed, 121 insertions(+) create mode 100644 dashboard/templates/health.html diff --git a/dashboard/dashboard.py b/dashboard/dashboard.py index d2e0229..339524d 100644 --- a/dashboard/dashboard.py +++ b/dashboard/dashboard.py @@ -141,6 +141,47 @@ def dreams(): return render_template("dreams.html", dreams=recent) +@app.route("/health") +def health(): + # Load vocab size + vocab_size = get_vocab_size() + + # Load brainmap size + brainmap_size = len(get_brainmap()) + + # Load dreams + dreams = load_dreams() + dream_count = len(dreams) + last_dream = dreams[-1]["sentence"] if dreams else "No dreams yet." + + # Load journal + try: + with open("data/memory/journal.json", "r", encoding="utf-8") as f: + journal_entries = json.load(f) + except Exception: + journal_entries = [] + + journal_count = len(journal_entries) + last_journal = journal_entries[-1] if journal_entries else "No journal entries yet." + + # Load books + books = get_books() + book_count = len(books) + progress = load_progress() + books_finished = sum(1 for b in books if progress.get(b, 0) > 0) + + return render_template("health.html", + vocab_size=vocab_size, + brainmap_size=brainmap_size, + book_count=book_count, + books_finished=books_finished, + dream_count=dream_count, + journal_count=journal_count, + last_dream=last_dream, + last_journal=last_journal) + + + def run_dashboard(): log = logging.getLogger('werkzeug') log.setLevel(logging.ERROR) diff --git a/dashboard/templates/brainmap.html b/dashboard/templates/brainmap.html index 381ef1d..1dd457b 100644 --- a/dashboard/templates/brainmap.html +++ b/dashboard/templates/brainmap.html @@ -41,6 +41,7 @@ πŸ•ΈοΈ Brain Map πŸ“ˆ Growth πŸŒƒ Dreams + ❀️ Health
diff --git a/dashboard/templates/concepts.html b/dashboard/templates/concepts.html index 0698de5..63703b5 100644 --- a/dashboard/templates/concepts.html +++ b/dashboard/templates/concepts.html @@ -48,6 +48,7 @@ πŸ•ΈοΈ Brain Map πŸ“ˆ Growth πŸŒƒ Dreams + ❀️ Health

🧠 Ruby's Concept Clusters

diff --git a/dashboard/templates/dreams.html b/dashboard/templates/dreams.html index bb8e9c7..0a5eb74 100644 --- a/dashboard/templates/dreams.html +++ b/dashboard/templates/dreams.html @@ -40,6 +40,7 @@ πŸ•ΈοΈ Brain Map πŸ“ˆ Growth πŸ’¬ Dreams + ❀️ Health

πŸ’¬ Ruby's Dream Stream

diff --git a/dashboard/templates/growth.html b/dashboard/templates/growth.html index b7b0cf8..274d559 100644 --- a/dashboard/templates/growth.html +++ b/dashboard/templates/growth.html @@ -39,6 +39,7 @@ πŸ•ΈοΈ Brain Map πŸ“ˆ Growth πŸ’¬ Dreams + ❀️ Health

πŸ“ˆ Ruby's Brain Growth

diff --git a/dashboard/templates/health.html b/dashboard/templates/health.html new file mode 100644 index 0000000..1855fa2 --- /dev/null +++ b/dashboard/templates/health.html @@ -0,0 +1,74 @@ + + + + + + Ruby's Health Monitor + + + + + + +

❀️ Ruby's Health Monitor

+ +
+
Vocabulary Size: {{ vocab_size }}
+
Brain Map Size: {{ brainmap_size }}
+
+ +
+
Books Available: {{ book_count }}
+
Books Finished: {{ books_finished }}
+
+ +
+
Dreams Generated: {{ dream_count }}
+
Latest Dream: {{ last_dream }}
+
+ +
+
Journal Entries: {{ journal_count }}
+
Latest Journal Entry: {{ last_journal }}
+
+ + + diff --git a/dashboard/templates/index.html b/dashboard/templates/index.html index 184235d..4573035 100644 --- a/dashboard/templates/index.html +++ b/dashboard/templates/index.html @@ -73,6 +73,7 @@ πŸ•ΈοΈ Brain Map πŸ“ˆ Growth πŸ’¬ Dreams + ❀️ Health
diff --git a/dashboard/templates/journal.html b/dashboard/templates/journal.html index a2e6720..23f849a 100644 --- a/dashboard/templates/journal.html +++ b/dashboard/templates/journal.html @@ -40,6 +40,7 @@ πŸ•ΈοΈ Brain Map πŸ“ˆ Growth πŸŒƒ Dreams + ❀️ Health

πŸ““ Ruby's Journal