mirror of
https://github.com/Sea-Haven-Industries/procurement-ingest.git
synced 2026-10-04 14:51:57 +00:00
Fix test_local.py import path and remove dead shared/models.py
test_local.py referenced the old lambdas/email_processor path. Updated to lambdas/wo/email_processor. Removed shared/ directory entirely as nothing imports from it.
This commit is contained in:
parent
5a1e774b7c
commit
d663983fb1
4 changed files with 2 additions and 86 deletions
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
|
|
@ -7,6 +7,6 @@ jobs:
|
||||||
ci:
|
ci:
|
||||||
uses: Sea-Haven-Industries/.github/.github/workflows/ci-python-sam.yaml@main
|
uses: Sea-Haven-Industries/.github/.github/workflows/ci-python-sam.yaml@main
|
||||||
with:
|
with:
|
||||||
source-dirs: "lambdas cdk shared"
|
source-dirs: "lambdas cdk"
|
||||||
run-cdk-synth: true
|
run-cdk-synth: true
|
||||||
run-sam-validate: false
|
run-sam-validate: false
|
||||||
|
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
"""Data models for work order ingestion."""
|
|
||||||
|
|
||||||
from dataclasses import dataclass, field, asdict
|
|
||||||
from datetime import datetime
|
|
||||||
from enum import Enum
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
|
|
||||||
class EmailType(str, Enum):
|
|
||||||
NEW_WORK_ORDER = "new_work_order"
|
|
||||||
UPDATE = "update"
|
|
||||||
COMMENT = "comment"
|
|
||||||
UNKNOWN = "unknown"
|
|
||||||
|
|
||||||
|
|
||||||
class WorkOrderStatus(str, Enum):
|
|
||||||
NEW = "new"
|
|
||||||
ASSIGNED = "assigned"
|
|
||||||
IN_PROGRESS = "in_progress"
|
|
||||||
ON_HOLD = "on_hold"
|
|
||||||
COMPLETED = "completed"
|
|
||||||
CANCELLED = "cancelled"
|
|
||||||
UNKNOWN = "unknown"
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class Comment:
|
|
||||||
work_order_id: str
|
|
||||||
comment_id: str # generated: {work_order_id}#{timestamp}
|
|
||||||
commenter: str
|
|
||||||
text: str
|
|
||||||
created_at: str # ISO 8601
|
|
||||||
source_email_s3_key: str
|
|
||||||
ingested_at: str = field(default_factory=lambda: datetime.utcnow().isoformat())
|
|
||||||
|
|
||||||
def to_dynamo_item(self) -> dict:
|
|
||||||
return {k: v for k, v in asdict(self).items() if v is not None}
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class WorkOrder:
|
|
||||||
work_order_id: str
|
|
||||||
description: Optional[str] = None
|
|
||||||
status: str = WorkOrderStatus.UNKNOWN.value
|
|
||||||
customer: str = "AMAZON"
|
|
||||||
site_code: Optional[str] = None
|
|
||||||
building: Optional[str] = None
|
|
||||||
address: Optional[str] = None
|
|
||||||
severity: Optional[str] = None
|
|
||||||
priority: Optional[str] = None
|
|
||||||
date_reported: Optional[str] = None
|
|
||||||
scheduled_start: Optional[str] = None
|
|
||||||
due_date: Optional[str] = None
|
|
||||||
assigned_to: Optional[str] = None
|
|
||||||
source_email_s3_key: Optional[str] = None
|
|
||||||
created_at: str = field(default_factory=lambda: datetime.utcnow().isoformat())
|
|
||||||
updated_at: str = field(default_factory=lambda: datetime.utcnow().isoformat())
|
|
||||||
|
|
||||||
def to_dynamo_item(self) -> dict:
|
|
||||||
return {k: v for k, v in asdict(self).items() if v is not None}
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ParsedEmail:
|
|
||||||
"""Result of AI parsing an inbound email."""
|
|
||||||
|
|
||||||
email_type: str # EmailType value
|
|
||||||
work_order_id: Optional[str] = None
|
|
||||||
description: Optional[str] = None
|
|
||||||
status: Optional[str] = None
|
|
||||||
site_code: Optional[str] = None
|
|
||||||
building: Optional[str] = None
|
|
||||||
address: Optional[str] = None
|
|
||||||
severity: Optional[str] = None
|
|
||||||
priority: Optional[str] = None
|
|
||||||
date_reported: Optional[str] = None
|
|
||||||
scheduled_start: Optional[str] = None
|
|
||||||
due_date: Optional[str] = None
|
|
||||||
assigned_to: Optional[str] = None
|
|
||||||
commenter: Optional[str] = None
|
|
||||||
comment_text: Optional[str] = None
|
|
||||||
comment_time: Optional[str] = None
|
|
||||||
raw_subject: Optional[str] = None
|
|
||||||
|
|
@ -11,8 +11,7 @@ import json
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# Add project root to path so we can import the handler's parsing logic
|
sys.path.insert(0, str(Path(__file__).parent / "lambdas" / "wo" / "email_processor"))
|
||||||
sys.path.insert(0, str(Path(__file__).parent / "lambdas" / "email_processor"))
|
|
||||||
|
|
||||||
from handler import parse_raw_email, extract_with_claude
|
from handler import parse_raw_email, extract_with_claude
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue