Configuration Models API
Purpose
This module defines configuration models for RDEToolKit using Pydantic. It provides structured configuration management with type safety, validation, and automatic default value application for system settings and processing configurations.
Key Features
Configuration Data Models
- System settings management with type safety
- MultiDataTile settings for error handling
- Pydantic-based validation and serialization
Type Safety and Validation
- Automatic type checking and conversion
- Field validation with descriptive error messages
- Default value management
src.rdetoolkit.models.config.SystemSettings
Bases: BaseModel
SystemSettings is a configuration model for the RDEtoolkit system settings.
Attributes:
Name | Type | Description |
---|---|---|
extended_mode |
str | None
|
The mode to run the RDEtoolkit in. Options include 'rdeformat' and 'MultiDataTile'. Default is None. |
save_raw |
bool
|
Indicates whether to automatically save raw data to the raw directory. Default is False. |
save_nonshared_raw |
bool
|
Indicates whether to save nonshared raw data. If True, non-shared raw data will be saved. Default is True. |
save_thumbnail_image |
bool
|
Indicates whether to automatically save the main image to the thumbnail directory. Default is False. |
magic_variable |
bool
|
A feature where specifying '${filename}' as the data name results in the filename being transcribed as the data name. Default is False. |
extended_mode: str | None = Field(default=None, description='The mode to run the RDEtoolkit in. select: rdeformat, MultiDataTile')
class-attribute
instance-attribute
magic_variable: bool = Field(default=False, description="The feature where specifying '${filename}' as the data name results in the filename being transcribed as the data name.")
class-attribute
instance-attribute
save_nonshared_raw: bool = Field(default=True, description='Specifies whether to save nonshared raw data. If True, non-shared raw data will be saved.')
class-attribute
instance-attribute
save_raw: bool = Field(default=False, description='Auto Save raw data to the raw directory')
class-attribute
instance-attribute
save_thumbnail_image: bool = Field(default=False, description='Auto Save main image to the thumbnail directory')
class-attribute
instance-attribute
validate_extended_mode(v)
classmethod
Validate extended_mode to only allow exact matches for 'rdeformat' and 'MultiDataTile'.
src.rdetoolkit.models.config.MultiDataTileSettings
Bases: BaseModel
ignore_errors: bool = Field(default=False, description='If true, errors encountered during processing will be ignored, and the process will continue without stopping.')
class-attribute
instance-attribute
src.rdetoolkit.models.config.Config
Bases: BaseModel
The configuration class used in RDEToolKit.
Attributes:
Name | Type | Description |
---|---|---|
system |
SystemSettings
|
System related settings. |
multidata_tile |
MultiDataTileSettings | None
|
MultiDataTile related settings. |
smarttable |
SmartTableSettings | None
|
SmartTable related settings. |
excel_invoice |
ExcelInvoiceSettings | None
|
ExcelInvoice related settings. |
multidata_tile: MultiDataTileSettings | None = Field(default_factory=MultiDataTileSettings, description='MultiDataTile related settings')
class-attribute
instance-attribute
smarttable: SmartTableSettings | None = Field(default=None, description='SmartTable related settings')
class-attribute
instance-attribute
system: SystemSettings = Field(default_factory=SystemSettings, description='System related settings')
class-attribute
instance-attribute
Practical Usage
Basic Configuration Creation
basic_config.py | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
Configuration from File
config_from_file.py | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Dynamic Configuration Management
dynamic_config.py | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|