apm-wo-analysis/lambdas/classifier/handler.py
Adam Moussa 58b91bda70 Scaffold apm-wo-analysis repository
Stand up the Phase 0 CDK scaffold for the daily APM work-order
analysis pipeline: two-stack CDK app (pipeline + grafana), classifier
and slack-post Lambda packages, dashboards-as-code, the local
drop-folder uploader, and a classifier smoke-test placeholder.

Wire CI/CD to the org reusable workflows: ci.yaml -> ci-python-sam
(ruff + cdk synth) and deploy.yaml -> cd-cdk (OIDC, cdk deploy --all).
Pin aws-cdk-lib==2.253.1; Lambdas target Python 3.12 / arm64.

Rewrite .gitignore to the org Python-CDK standard so the source-of-
truth files (CLAUDE.md, docs/, .claude/agents) are tracked while build
artifacts (.venv, cdk.out, caches) stay ignored.

Domain logic, stack resources, and dashboards are stubbed and filled
in across Phases 1-5 (docs/BUILD.md). cdk synth is green for both
stacks; ruff check/format pass.
2026-05-28 16:13:13 -04:00

19 lines
779 B
Python

"""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