Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions archive/decision_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#################

import bson
from datetime import datetime, timezone, timedelta
import logging
import uuid
import zlib
Expand Down Expand Up @@ -68,13 +69,17 @@ def get_annotations(message, headers=[], public: bool=True, direct_upload: bool=

Return: A dictionary of annotations
"""
ingest_time = datetime.now(timezone.utc)
# convert to a unix timestamp, and then to milliseconds
its = int((receive_time-datetime(1970, 1, 1, tzinfo=timezone.utc))/timedelta(milliseconds=1))
annotations = {}
text_uuid, is_client_uuid = get_text_uuid(headers)
annotations["con_text_uuid"] = text_uuid
annotations["con_is_client_uuid"] = is_client_uuid
annotations["con_message_crc32"] = zlib.crc32(message)
annotations["public"] = public
annotations["direct_upload"] = direct_upload
annotations["ingest_time"] = its
return annotations


Expand Down