update
This commit is contained in:
parent
d6c1ad9931
commit
9d620da015
|
|
@ -2,6 +2,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from decimal import Decimal, InvalidOperation
|
from decimal import Decimal, InvalidOperation
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
@ -49,9 +50,33 @@ def _date_only(v: Any) -> str:
|
||||||
s = str(v or "").strip()
|
s = str(v or "").strip()
|
||||||
if not s:
|
if not s:
|
||||||
return ""
|
return ""
|
||||||
s = s.replace("T", " ")
|
s2 = s.replace("T", " ")
|
||||||
if " " in s:
|
if re.match(r"^\d{4}-\d{2}-\d{2}$", s2):
|
||||||
s = s.split(" ", 1)[0]
|
return s2
|
||||||
|
if re.match(r"^\d{4}-\d{2}-\d{2}\s", s2):
|
||||||
|
return s2.split(" ", 1)[0]
|
||||||
|
|
||||||
|
m = re.match(r"^[A-Za-z]{3}\s+([A-Za-z]{3})\s+(\d{1,2})\s+\d{2}:\d{2}:\d{2}\s+[A-Za-z]{3,5}\s+(\d{4})$", s)
|
||||||
|
if m:
|
||||||
|
month_map = {
|
||||||
|
"Jan": "01",
|
||||||
|
"Feb": "02",
|
||||||
|
"Mar": "03",
|
||||||
|
"Apr": "04",
|
||||||
|
"May": "05",
|
||||||
|
"Jun": "06",
|
||||||
|
"Jul": "07",
|
||||||
|
"Aug": "08",
|
||||||
|
"Sep": "09",
|
||||||
|
"Oct": "10",
|
||||||
|
"Nov": "11",
|
||||||
|
"Dec": "12",
|
||||||
|
}
|
||||||
|
mon = month_map.get(m.group(1).title())
|
||||||
|
day = int(m.group(2))
|
||||||
|
year = m.group(3)
|
||||||
|
if mon:
|
||||||
|
return f"{year}-{mon}-{day:02d}"
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -499,7 +524,7 @@ class SyncEhrLeavesToOaMonthJob(BaseJob):
|
||||||
chunk_failed,
|
chunk_failed,
|
||||||
str(rj.get("message") or ""),
|
str(rj.get("message") or ""),
|
||||||
)
|
)
|
||||||
if debug_trace and isinstance(fd, dict) and fd:
|
if isinstance(fd, dict) and fd:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"OA batch-update failedData sample: chunk=%s sample=%s",
|
"OA batch-update failedData sample: chunk=%s sample=%s",
|
||||||
i // batch_size + 1,
|
i // batch_size + 1,
|
||||||
|
|
@ -531,7 +556,8 @@ class SyncEhrLeavesToOaMonthJob(BaseJob):
|
||||||
matched_after_write = len(aggregated_keys & verify_key_set)
|
matched_after_write = len(aggregated_keys & verify_key_set)
|
||||||
missing_after_write = sorted(list(aggregated_keys - verify_key_set))[:50]
|
missing_after_write = sorted(list(aggregated_keys - verify_key_set))[:50]
|
||||||
logger.info(
|
logger.info(
|
||||||
"OA 写入后复核:aggregated_keys=%s matched_after_write=%s missing_after_write=%s",
|
"OA 写入后复核:verify_indexed=%s aggregated_keys=%s matched_after_write=%s missing_after_write=%s",
|
||||||
|
len(verify_key_set),
|
||||||
len(aggregated_keys),
|
len(aggregated_keys),
|
||||||
matched_after_write,
|
matched_after_write,
|
||||||
len(aggregated_keys - verify_key_set),
|
len(aggregated_keys - verify_key_set),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue