Uploads¶
Upload Introduction¶
In addition to scenarios, spreadsheets containing risk factor history values,
portfolio data, transition matrices, or model unit testing data can be uploaded.
These spreadsheets can be varied in format, and therefore they are uploaded as is.
Uploading Other Spreadsheets¶
- Navigate to the Upload tab.
- Click the icon on the upper right.
- Select the appropriate Upload Type from the drop-down menu.
-
Select the relevant spreadsheets by checking the box to the left of it in
the list that appears.Multiple files can be uploaded at the same time.
If the upload is successful, the status of the uploaded files will say so. -
View an uploaded file before saving it by clicking the icon to the right of the file name.
-
Save the file by clicking the icon to the right of the name. In the pop-up screen that appears, enter a Description and a Comment for the Save Upload. Then click the Save button. If the save is successful, it will say so.
Uploaded files appear in the Upload Inventory on the screen. If a
spreadsheet of the same name is uploaded multiple times, the platform
keeps track of the version history. -
Approve an uploaded file by clicking the icon to the right of the filename.
Files in the Upload Inventory can be downloaded and used as the basis
for new spreadsheets. -
Download an uploaded file by clicking the icon to the right of the file name in the Upload Inventory.
Customizing Validation Logic for Uploads¶
Users can customize their own validation logic for each upload type in VOR. The customization allows users to implement specific validation rules for different upload types, while integrating some pre-defined base validations. The validation process occurs automatically when user uploads a file on UI.
Base Validation Class(Non-User-Editable)¶
The validation_base.py
file contains the ValidationRule
class,
which serves as the base class for validation.
- Abstract method: The
validate()
method must be implemented by subclasses to define specific validation logic for an upload type. - Base validations: The
base_validations()
method provides common validation logic applicable to multiple upload types. Subclasses should call this method to perform shared validations. - Response Generation: The
generate_success_response()
andgenerate_error_response()
serve as wrappers to return standardized response structures.
Custom Validation Overrides (User-Editable)¶
The validation_overrides.py
file is where the users can define custom
validation logic for different upload types.
To create custom validation rules:
-
Create a New Validation Class: Define a new class that inherits
ValidationRule
class, using the format:class <upload-type>_ValidationRule(ValidationRule):
-
Override the
validate()
method: Implement your own custom validation logic in this method. - Use Response Handling Wrappers: Utilize the
generate_success_response()
andgenerate_error_response()
methods to return standardized responses.
Example: Custom Validation for ME_HISTORY
Upload Type¶
Below is a sample implementation of custom validation for ME_HISTORY
upload type:
from .validation_base import ValidationRule
class ME_HISTORY_ValidationRule(ValidationRule):
"""Validation rule specific to the 'ME_HISTORY' upload type."""
def validate_sheet(self):
"""Validate the 'ME_HISTORY' sheets"""
return None
def validate(self):
# Perform base validations
error_message = self.base_validations()
if error_message:
return self.generate_error_response(error_message)
# Custom sheet validation
error_message = self.validate_sheet()
if error_message:
return self.generate_error_response(error_message)
# Return success response if all validations pass
return self.generate_success_response()