from enum import Enum from typing import List import pydantic from pydantic import BaseModel ENameRegex = pydantic.constr(regex="^[a-z_]{1,}$") CNameRegex = pydantic.constr(regex="^[\u4e00-\u9fa5a-zA-Z0-9()]+$") class Parameter(BaseModel): ename: ENameRegex = "example_param" cname: str = "示例参数" description: str = "参数介绍文字" class NatureEnum(Enum): quantity = "定量" quality = "定性" class CategoryEnum(str, Enum): profit = "盈利能力" income = "收益质量" flows = "现金流量" capital = "资本结构" debt = "偿债能力" operating = "运营能力" growth = "成长能力" business = "经营指标" qualification = "资质指标" industry = "行业指标" green = "绿色指标" judicial = "司法指标" compliance = "合规指标" public_opinion = "舆情指标" others = "其他" class IndicatorDescription(BaseModel): ename: ENameRegex = "example_indicator" cname: str = "示例指标" description: str = "指标介绍文字" nature: NatureEnum category: CategoryEnum parameters: List[Parameter]