2022-10-13 17:07:52 +08:00
|
|
|
|
from enum import Enum
|
|
|
|
|
from typing import List
|
|
|
|
|
|
|
|
|
|
import pydantic
|
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
|
ENameRegex = pydantic.constr(regex="^[a-z_]{1,}$")
|
2022-10-25 14:47:46 +08:00
|
|
|
|
CNameRegex = pydantic.constr(regex="^[\u4e00-\u9fa5a-zA-Z0-9()]+$")
|
2022-10-13 17:07:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Parameter(BaseModel):
|
|
|
|
|
ename: ENameRegex = "example_param"
|
2022-10-25 13:56:51 +08:00
|
|
|
|
cname: str = "示例参数"
|
2022-10-13 17:07:52 +08:00
|
|
|
|
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"
|
2022-10-25 13:56:51 +08:00
|
|
|
|
cname: str = "示例指标"
|
2022-10-13 17:07:52 +08:00
|
|
|
|
description: str = "指标介绍文字"
|
|
|
|
|
nature: NatureEnum
|
|
|
|
|
category: CategoryEnum
|
|
|
|
|
parameters: List[Parameter]
|
2022-11-09 00:53:00 +08:00
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
use_enum_values = True
|
|
|
|
|
|