Skip to main content

Price Validation Engine

Overview

Price Validation Engine is framework to create skeleton to validate last price revision

requirements

  • python 3.6+
  • Linux, MacOS, windows

install

pip install price-val-engine

Start Project

python -m price_val_engine startproject project_name 

Project template structure

- base_dir
    - project_name 
        - __init__.py
        - settings.py
        - validtion_rules.py
    - run.py

Run project

python run.py --input=input.csv --output=output.csv 

input as s3 csv file

python run.py --input=s3://bucket_name/path/input.csv --output=s3://bucket_name/path/input.csv

settings.py

  • default validation pipeline

     VALIDATION_PIPELINES = [  
         'price_val_engine.core.validations.general_rules.NullNegativeZeroValidationRule',  
         'price_val_engine.core.validations.general_rules.OutOfRangeValidationRule',  
         'price_val_engine.core.validations.revision_rules.AbsoluteDeltaPercentageRangeValidationRule',  
     ]
    

Add new custom validation rule

- step 1 you can define your custom validtion rules in the file `project_name/validation_rules.py`

    class MyValidationRule(BaseRule)
        name = "validation_rules.myvalidation_rule"
        message = "price could not be gte {max_price}"
        severity = ''

        def is_valid(self, item):
            max_price = 50
            if item['price'] >= max_price:
                self.message.format(max_price)
                self.severity = 'HIGH' # you can define severity LOW, MEDIUM and HIGH

- step 2 add your newly defined rule in `setting.py`

    VALIDATION_PIPELINES = [  
        ...,
        'project_name.validation_rules.MyValidationRule
    ]

Validation_rules

price_val_engine.core.validations.general_rules.NullNegativeZeroValidationRule

price_val_engine.core.validations.general_rules.OutOfRangeValidationRule

price_val_engine.core.validations.revision_rules.AbsoluteDeltaPercentageRangeValidationRule

price_val_engine.core.validations.revision_rules.DeltaPercentageValidationRule

price_val_engine.core.validations.revision_rules.DeltaValidationRule

Default Settings:

NullNegativeZeroValidationRule config
- EMPTY_VALUES:  (None, "", [], (), {})
OutOfRangeValidationRule config
- GEN_VAL_OUT_OF_RANGE_VALUE: 

        {
            'min_value': 100000.0,
            'max_value': 10000000.0
        }
AbsoluteDeltaPercentageRangeValidationRule config
- DEFAULT_LP_FIELD: 'final_liquidation_price'
- DEFAULT_PREV_DAY_LP_FIELD: 'lp'

- DELTA_PCT_VAL_DEFAULT:  (-5, 5)
- DELTA_PCT_VAL_LOW: (-7, 7)
- DELTA_PCT_VAL_MEDIUM: (-10, 10)
slack notification
- SLACK_ENABLED: False
- SLACK_BOT_TOKEN: os.environ.get("SLACK_BOT_TOKEN")
- SLACK_CHANNEL: os.environ.get("SLACK_CHANNEL")
- COLUMNS_TO_BE_SEND_ON_ALERT: '__all__'
Read Write CSV file from S3
- AWS_ACCESS_KEY_ID: os.environ.get('AWS_ACCESS_KEY_ID')
- AWS_SECRET_ACCESS_KEY: os.environ.get('AWS_SECRET_ACCESS_KEY')
- AWS_SESSION_TOKEN: os.environ.get('AWS_SESSION_TOKEN')

Release files for price-val-engine 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for price-val-engine 0.1.10
File Size Uploaded
price-val-engine-0.1.10.tar.gz 14.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for price-val-engine 0.1.10
File Interpreter ABI Platform
price_val_engine-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 34.5 kB

Release files / price-val-engine-0.1.10.tar.gz

Download URL price-val-engine-0.1.10.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3135a84f2e7428d60461b5be961f6ba26675de41f5f2528cb44e868f7e62bff8
BLAKE2b-256 checksum
How to use checksums
df72c6d81094b4d88764610217e042488a049b27859408f273715c062efba35d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.13

Release files / price_val_engine-0.1.10-py3-none-any.whl

Download URL price_val_engine-0.1.10-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e7076fe56dcfe15af3f930061b20d44321cc0aa84b151ed10d7b475fb90cc8b
BLAKE2b-256 checksum
How to use checksums
6b5eb86e5ce78d82bf84d9b83db5e3ad34353cf94b498834c681bafcade43371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.13
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page