refactor: countryRegion 统一中文归一化; label-ocr 改用 countryRegion; destinationCountry 还原 ISO2
This commit is contained in:
+7
-7
@@ -115,16 +115,16 @@ def process_all(pending: list) -> dict[str, int]:
|
||||
|
||||
@flow(name="label-ocr", log_prints=True)
|
||||
def label_ocr(
|
||||
destination_countries: list[str] | None = None,
|
||||
country_regions: list[str] | None = None,
|
||||
courier_source: str | None = None,
|
||||
days: int = 7,
|
||||
) -> dict:
|
||||
"""面单 OCR enrichment。默认处理英国(GB)+美国(US),近 7 天下单的订单。
|
||||
"""面单 OCR enrichment。默认处理英国+美国,近 7 天下单的订单。
|
||||
|
||||
手动跑其他国家: label_ocr(destination_countries=['德国'])
|
||||
手动跑其他国家: label_ocr(country_regions=['德国'])
|
||||
"""
|
||||
if destination_countries is None:
|
||||
destination_countries = ['英国', '美国']
|
||||
if country_regions is None:
|
||||
country_regions = ['英国', '美国']
|
||||
if _has_running_peer():
|
||||
print("已有 label-ocr 在运行,跳过本次")
|
||||
return {"skipped": True}
|
||||
@@ -133,11 +133,11 @@ def label_ocr(
|
||||
print(f"OCR 状态(开始): {before}")
|
||||
|
||||
pending = db.get_ocr_pending(
|
||||
destination_countries=destination_countries,
|
||||
country_regions=country_regions,
|
||||
courier_source=courier_source,
|
||||
days=days,
|
||||
)
|
||||
scope = f" [{'/'.join(destination_countries)}{f' {courier_source}' if courier_source else ''}]"
|
||||
scope = f" [{'/'.join(country_regions)}{f' {courier_source}' if courier_source else ''}]"
|
||||
print(f"待 OCR: {len(pending)} 单{scope} (RIIN+SDS, 近{days}天)")
|
||||
if not pending:
|
||||
emit_sync_summary(f"面单 OCR{scope}", build_stats_rows("ALL", {}, [
|
||||
|
||||
Reference in New Issue
Block a user