mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-07-25 08:40:16 -07:00
Marshmallow Schemas for YAML files (#1497)
* Marshmallow Schemas for YAML files * completed ticket * passing tests * lint * click dep * staging BE map * Pr review
This commit is contained in:
parent
27311b11e2
commit
859177a877
11 changed files with 387 additions and 183 deletions
|
@ -0,0 +1,68 @@
|
|||
from dataclasses import dataclass, field
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
class FieldType(Enum):
|
||||
STRING = "string"
|
||||
INT64 = "int64"
|
||||
BOOL = "bool"
|
||||
FLOAT = "float"
|
||||
PERCENTAGE = "percentage"
|
||||
LOSS_RATE_PERCENTAGE = "loss_rate_percentage"
|
||||
|
||||
|
||||
@dataclass
|
||||
class RoundingNum:
|
||||
float: int
|
||||
loss_rate_percentage: int
|
||||
|
||||
|
||||
@dataclass
|
||||
class Field:
|
||||
score_name: str
|
||||
label: str
|
||||
format: FieldType = field(metadata={"by_value": True})
|
||||
|
||||
|
||||
@dataclass
|
||||
class CSVConfig:
|
||||
@dataclass
|
||||
class GlobalConfig:
|
||||
sort_by_label: str
|
||||
rounding_num: RoundingNum
|
||||
|
||||
global_config: GlobalConfig
|
||||
fields: List[Field]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ExcelConfig:
|
||||
@dataclass
|
||||
class GlobalConfig:
|
||||
@dataclass
|
||||
class ExcelGlobalConfig:
|
||||
default_column_width: int
|
||||
|
||||
sort_by_label: str
|
||||
rounding_num: RoundingNum
|
||||
excel_config: ExcelGlobalConfig
|
||||
|
||||
@dataclass
|
||||
class SheetItem:
|
||||
label: str
|
||||
fields: List[Field]
|
||||
|
||||
global_config: GlobalConfig
|
||||
sheets: List[SheetItem]
|
||||
|
||||
|
||||
@dataclass
|
||||
class CodebookConfig:
|
||||
@dataclass
|
||||
class Field:
|
||||
score_name: str
|
||||
notes: Optional[str]
|
||||
category: Optional[str]
|
||||
|
||||
fields: List[Field]
|
Loading…
Add table
Add a link
Reference in a new issue