mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-27 23:35:01 +00:00
The service was the last one living wholly under backend/. It now follows the same layering as abri and the other newer services: domain/pashub_fetcher/ core file classification, subfolders infrastructure/pashub_fetcher/ PasHub client, token getter, wire DTOs orchestration/ PashubFetcherOrchestrator (was PashubService) applications/pashub_fetcher/ lambda handler, trigger request, dev tooling core_files.py is split along the layer boundary: the domain module keeps the filename/evidence-category classification rules and no longer imports infrastructure.postgres, while the CoreFiles -> FileTypeEnum translation moves to infrastructure/pashub_fetcher/core_file_types.py. Tests move into the tests/ tree by layer. Note this puts them in the only suite CI currently runs (unit_tests.yml is disabled), so these 73 tests now execute on PRs for the first time; they were previously reachable only via the legacy pytest.ini testpaths. sharepoint_renamer's image now copies just domain/pashub_fetcher/ rather than the whole service, since SharepointSubfolders is all it needed. Behaviour is unchanged. tests/ goes 9927 -> 10000 passed (+73, exactly the tests that moved in); the legacy suite keeps its same 17 pre-existing failures and 11 errors. tests/test_lambda_packaging.py confirms both changed Dockerfiles still copy their handler's full import closure. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
66 lines
1.8 KiB
Python
66 lines
1.8 KiB
Python
import json
|
|
import os
|
|
import re
|
|
from typing import Any, Dict, List
|
|
|
|
from openpyxl import load_workbook
|
|
|
|
from applications.pashub_fetcher.pashub_to_ara_trigger_request import (
|
|
PashubToAraTriggerRequest,
|
|
)
|
|
from applications.pashub_fetcher.handler import handler
|
|
|
|
if __name__ == "__main__":
|
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
|
filepath: str = os.path.join(
|
|
BASE_DIR,
|
|
"pashub_fetcher",
|
|
"local_run_02-06-2026",
|
|
"ECO_Approach_Coordination_Design_KN.xlsx",
|
|
)
|
|
|
|
wb = load_workbook(filepath, data_only=True)
|
|
ws = wb["filtered"]
|
|
|
|
HEADER_ROW = 1
|
|
|
|
headers: Dict[str, int] = {}
|
|
for col in range(1, ws.max_column + 1):
|
|
value = str(ws.cell(row=HEADER_ROW, column=col).value)
|
|
if value:
|
|
headers[value.strip()] = col
|
|
|
|
name_col = headers["Name"]
|
|
link_col = headers["PasHub ID"]
|
|
hubspot_deal_id_col = headers["HubSpot ID"]
|
|
|
|
trigger_requests: List[PashubToAraTriggerRequest] = []
|
|
|
|
for row in range(HEADER_ROW + 1, ws.max_row + 1):
|
|
name = ws.cell(row=row, column=name_col).value
|
|
link = ws.cell(row=row, column=link_col).value
|
|
hubspot_deal_id = ws.cell(row=row, column=hubspot_deal_id_col).value
|
|
|
|
if not name or not link or not hubspot_deal_id:
|
|
continue
|
|
|
|
match = re.search(r"/jobs/([0-9a-fA-F\-]+)/", str(link))
|
|
if not match:
|
|
continue
|
|
|
|
trigger_requests.append(
|
|
PashubToAraTriggerRequest(
|
|
pashub_link=str(link),
|
|
hubspot_deal_id=str(hubspot_deal_id),
|
|
address=str(name),
|
|
get_other_files=True,
|
|
)
|
|
)
|
|
|
|
# ---- Build fake SQS event ----
|
|
event: Dict[str, Any] = {
|
|
"Records": [{"body": json.dumps(req.model_dump())} for req in trigger_requests]
|
|
}
|
|
|
|
context = None
|
|
handler(event, context)
|