From 8d820d23c4fc84e72071428d4fac8ca33822dd45 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Mon, 12 Feb 2024 08:43:08 +0330 Subject: [PATCH] fix: Added discord summary type! To query the database for thread summaries, it wasn't possible to do with just checking the null values for thread in metadata. --- .../src/db/discord/summary/summary_utils.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/dags/hivemind_etl_helpers/src/db/discord/summary/summary_utils.py b/dags/hivemind_etl_helpers/src/db/discord/summary/summary_utils.py index a6b493cd..561b8af5 100644 --- a/dags/hivemind_etl_helpers/src/db/discord/summary/summary_utils.py +++ b/dags/hivemind_etl_helpers/src/db/discord/summary/summary_utils.py @@ -33,8 +33,9 @@ def transform_thread_summary_to_document( "date": summary_date, "thread": thread_name, "channel": thread_channel, + "type": "thread", }, - excluded_embed_metadata_keys=["date", "thread", "channel"], + excluded_embed_metadata_keys=["date", "thread", "channel", "type"], ) return thread_summary_document @@ -65,11 +66,8 @@ def transform_channel_summary_to_document( channel_summary_document = Document( text=channel_summary, - metadata={ - "date": summary_date, - "channel": channel_name, - }, - excluded_embed_metadata_keys=["date", "thread", "channel"], + metadata={"date": summary_date, "channel": channel_name, "type": "channel"}, + excluded_embed_metadata_keys=["date", "thread", "channel", "type"], ) return channel_summary_document @@ -99,10 +97,8 @@ def transform_daily_summary_to_document( summary = daily_summary[date] doc = Document( text=summary, - metadata={ - "date": date, - }, - excluded_embed_metadata_keys=["date", "thread", "channel"], + metadata={"date": date, "type": "day"}, + excluded_embed_metadata_keys=["date", "thread", "channel", "type"], ) daily_summary_documents.append(doc)