样本接收 UC… 此前无内置匹配规则导致工单空任务;新增 5 步原代培养模版与回补脚本,且不影响 BC 六步模版。 Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1.3 KiB
Python
31 lines
1.3 KiB
Python
"""按实验室入库编码前缀匹配内置生产任务组合模版。"""
|
|
|
|
from typing import List, Optional, Tuple
|
|
|
|
# 科研捐赠脐带间充质:UC… → 5 步原代培养模版(与细胞存储 BC 的 6 步模版分离)
|
|
UC_MSC_BUILTIN_SET_NAME = "脐带MSC原代培养(内置模版)"
|
|
BC_MSC_BUILTIN_SET_NAME = "干细胞培养(内置模版)"
|
|
HSC_BUILTIN_SET_NAME = "造血干样本处理(内置模版)"
|
|
UBMC_BUILTIN_SET_NAME = "UBMC冻存(内置模版)"
|
|
PBMC_BUILTIN_SET_NAME = "PBMC冻存(内置模版)"
|
|
|
|
# 最长前缀优先:BC 必须在 B 之前,避免 BC… 误匹配造血干
|
|
_LAB_CODE_BUILTIN_SET_RULES: List[Tuple[str, str]] = [
|
|
("UBMC", UBMC_BUILTIN_SET_NAME),
|
|
("PBMC", PBMC_BUILTIN_SET_NAME),
|
|
("UC", UC_MSC_BUILTIN_SET_NAME),
|
|
("BC", BC_MSC_BUILTIN_SET_NAME),
|
|
("B", HSC_BUILTIN_SET_NAME),
|
|
]
|
|
|
|
|
|
def match_builtin_task_set_name_by_lab_storage_code(lab_storage_code: str) -> Optional[str]:
|
|
"""返回应使用的内置模版集合名称;无匹配返回 None。大小写不敏感。"""
|
|
text = (lab_storage_code or "").strip().upper()
|
|
if not text:
|
|
return None
|
|
for prefix, set_name in _LAB_CODE_BUILTIN_SET_RULES:
|
|
if text.startswith(prefix.upper()):
|
|
return set_name
|
|
return None
|