CoolFace
Apppublic

ashnaali22/phase-3-h2

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
priority_classifier.cpython-313.pyc71 linesDownload Raw Back to __pycache__
1�

2L�Si��3�|�SrSSKJrJrJr SSKJr /SQrS\S\\S\4SjrS\\S\\S	\S4\\S\45Sjr	g)
a�6Priority Classification Service for Task Management7 8This module implements automatic priority classification based on task urgency9keywords and due date proximity, following the Skills & Subagents Architecture.10 11Classification Rules:12- VERY_IMPORTANT: Urgency keyword in title OR due date within 6 hours13- HIGH: Due date within 24 hours14- MEDIUM: Due date within 7 days15- LOW: Due date beyond 7 days OR no due date16�)�datetime�	timedelta�timezone)�Optional)�urgent�asap�critical�	important�	emergency�title�due_date�returnc��^�UR5m[U4Sj[55nUcU(aS$S$[R"[17R5RSS9nURcUR[18RS9nUR[19RS9nX-20nU[SS9::agU[SS9::ag	U[S21S9::agg)
aX22Classify task priority based on title urgency keywords and due date proximity.23 24Args:25    title: Task title to check for urgency keywords26    due_date: Optional task due date (timezone-aware datetime)27 28Returns:29    Priority level: 'VERY_IMPORTANT' | 'HIGH' | 'MEDIUM' | 'LOW'30 31Examples:32    >>> classify_priority("Urgent: Fix production bug", None)33    'VERY_IMPORTANT'34 35    >>> from datetime import datetime, timezone, timedelta36    >>> now = datetime.now(timezone.utc)37    >>> classify_priority("Normal task", now + timedelta(hours=3))38    'VERY_IMPORTANT'39 40    >>> classify_priority("Normal task", now + timedelta(hours=20))41    'HIGH'42 43    >>> classify_priority("Normal task", now + timedelta(days=5))44    'MEDIUM'45 46    >>> classify_priority("Normal task", now + timedelta(days=10))47    'LOW'48 49    >>> classify_priority("Normal task", None)50    'LOW'51c3�,># �UH	oT;v� M g7f)N�)�.0�keyword�title_lowers  ��[D:\code\Q4\hackathon-2\todo-app\phase-3\backend\src\backend\services\priority_classifier.py�	<genexpr>�$classify_priority.<locals>.<genexpr>8s����U�DT���4�DT�s�N�VERY_IMPORTANT�LOW)�tzinfo�)�hours��HIGH�)�days�MEDIUM)52�lower�any�URGENCY_KEYWORDSr�nowr�utc�replacerr)rr
�has_urgency_keywordr%�time_until_duers     @r�classify_priorityr*s����B�+�+�-�K��U�DT�U�U����#6��A�E�A��,�,�x�|�|�53$�54,�55,�D�56,�579�C������#�#�8�<�<�#�8���+�+�X�\�\�+�58*�C��^�N����+�+��	�9�2�.�	.��	�9�!�,�	,����
current_title�current_due_datec�4�UbUOUnUbUOUn[XE5$)ab59Re-classify priority when task is updated.60 61Args:62    title: New title (None if not being updated)63    due_date: New due date (None if not being updated, could be explicitly set to None to clear)64    current_title: Current task title65    current_due_date: Current task due date66 67Returns:68    Priority level: 'VERY_IMPORTANT' | 'HIGH' | 'MEDIUM' | 'LOW'69)r*)rr
r,r-�effective_title�effective_due_dates      r�reclassify_priority_on_updater1Zs+��& %�0�e�m�O�&.�%9��?O���_�A�Ar+N)70�__doc__rrr�typingrr$�strr*r1rr+r�<module>r5s����3�2��L��A�S�A�H�X�,>�A�3�A�HB��C�=�B��x� �B��B��x�(�	B�71	�Br+