Browse Source

take received date into account to generate messages instead of date_iso

Loann Peurey 1 year ago
parent
commit
3a2ad5586a
1 changed files with 6 additions and 1 deletions
  1. 6 1
      generate_messages/messages.py

+ 6 - 1
generate_messages/messages.py

@@ -181,6 +181,7 @@ def build_messages(metrics_recordings, metrics_columns, message_file_path, date)
     :return: dataframe containing messages associated with a recording filename
     :rtype: pandas.Dataframe
     """
+    og_date = date
     try:
         date_time = datetime.strptime(date, "%Y%m%d")
         date = date_time.strftime("%Y-%m-%d")
@@ -207,7 +208,11 @@ def build_messages(metrics_recordings, metrics_columns, message_file_path, date)
 
         # If the first row is not the desired date, skip as no message was/will be generated for this family as
         # this recording is too old
-        if sorted_metrics_grouped_items.iloc[0]['date_iso'] != date:
+        #if sorted_metrics_grouped_items.iloc[0]['date_iso'] != date:
+        #    continue
+        #tmp fix where the date iso of the recording os not the date is was submitted, in this case,
+        #we want to compute according to the reception date and note the recording date_iso
+        if sorted_metrics_grouped_items.iloc[0]['recording_filename'].split('/')[0] != og_date:
             continue
 
         # Only one audio (first week), generated default message