Spaces:
Runtime error
Runtime error
Greg Thompson
commited on
Commit
·
1a2dfce
1
Parent(s):
3260908
Update date parsing
Browse files- mathtext_fastapi/nlu.py +5 -4
mathtext_fastapi/nlu.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from collections.abc import Mapping
|
| 2 |
from logging import getLogger
|
| 3 |
import datetime as dt
|
|
|
|
| 4 |
import re
|
| 5 |
|
| 6 |
from fuzzywuzzy import fuzz
|
|
@@ -141,7 +142,7 @@ def run_intent_classification(message_text):
|
|
| 141 |
|
| 142 |
def payload_is_valid(payload_object):
|
| 143 |
"""
|
| 144 |
-
>>> payload_is_valid({'author_id': '+
|
| 145 |
True
|
| 146 |
"""
|
| 147 |
return (
|
|
@@ -158,13 +159,13 @@ def payload_is_valid(payload_object):
|
|
| 158 |
isinstance(payload_object.get('message_inserted_at'), str) and
|
| 159 |
isinstance(payload_object.get('message_updated_at'), str) and
|
| 160 |
isinstance(
|
| 161 |
-
|
| 162 |
dt.datetime
|
| 163 |
) and
|
| 164 |
isinstance(
|
| 165 |
-
|
| 166 |
dt.datetime
|
| 167 |
-
)
|
| 168 |
)
|
| 169 |
|
| 170 |
|
|
|
|
| 1 |
from collections.abc import Mapping
|
| 2 |
from logging import getLogger
|
| 3 |
import datetime as dt
|
| 4 |
+
from dateutil.parser import isoparse
|
| 5 |
import re
|
| 6 |
|
| 7 |
from fuzzywuzzy import fuzz
|
|
|
|
| 142 |
|
| 143 |
def payload_is_valid(payload_object):
|
| 144 |
"""
|
| 145 |
+
>>> payload_is_valid({'author_id': '+5555555', 'author_type': 'OWNER', 'contact_uuid': '3246-43ad-faf7qw-zsdhg-dgGdg', 'message_body': 'thirty one', 'message_direction': 'inbound', 'message_id': 'SDFGGwafada-DFASHA4aDGA', 'message_inserted_at': '2022-07-05T04:00:34.03352Z', 'message_updated_at': '2023-04-06T10:08:23.745072Z'})
|
| 146 |
True
|
| 147 |
"""
|
| 148 |
return (
|
|
|
|
| 159 |
isinstance(payload_object.get('message_inserted_at'), str) and
|
| 160 |
isinstance(payload_object.get('message_updated_at'), str) and
|
| 161 |
isinstance(
|
| 162 |
+
isoparse(payload_object.get('message_inserted_at')),
|
| 163 |
dt.datetime
|
| 164 |
) and
|
| 165 |
isinstance(
|
| 166 |
+
isoparse(payload_object.get('message_updated_at')),
|
| 167 |
dt.datetime
|
| 168 |
+
)
|
| 169 |
)
|
| 170 |
|
| 171 |
|