INNER CODE UNIT · Python
_parse_urgency
skyportal/skyportal · services/assistant/app.py:499
def _parse_urgency(answer):
"""Pull a trailing ``NOTIFY: yes/no`` marker off a triage answer.
Returns (is_urgent, text_without_the_marker). A missing marker is treated as
not urgent, so a model that forgets it never spams notifications.
"""
text = answer or ""
match = None
for m in re.finditer(r"(?im)^[ \t>*_-]*NOTIFY:\s*(yes|no)\b.*$", text):
match = m
if match is None:
return False, text.strip()
is_urgent = match.group(1).lower() == "yes"
return is_urgent, (text[: match.start()] + text[match.end() :]).strip()
def post_triage_comment(session, author_id, notify, context_type, context_id, answer):
"""Post the full triage as a bot comment on the source, visible to the query's