apm-wo-analysis/lambdas/classifier/handler.py

20 lines
779 B
Python
Raw Normal View History

"""S3-triggered classifier Lambda: parse export → two-axis classify → Parquet.
Triggered on ``s3:ObjectCreated`` under the ``raw/`` prefix regardless of how
the file arrives (direct upload or local drop-folder). For each non-blank-comment
row it strips HTML, runs ``classify()``, derives ``is_escalation`` / ``is_action``
/ ``mismatch``, writes a per-WO snapshot to ``analytics/dt=YYYY-MM-DD/`` as
Parquet (registering the Glue partition), emits a small ``summary.json`` for the
slack-post Lambda, then invokes it.
Runtime when wired up: Python 3.12, ARM64, 512 MB, 120 s, awswrangler layer.
Implemented in Phase 2 (docs/BUILD.md).
"""
from __future__ import annotations
def handler(event, context):
"""Lambda entry point. (Phase 2)"""
raise NotImplementedError