Skip to main content

last price revision validation rules

Project description

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.DeltaPercentageFromLastDayRule',  
     ]
    

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
    ]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

price-val-engine-0.1.9.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

price_val_engine-0.1.9-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file price-val-engine-0.1.9.tar.gz.

File metadata

  • Download URL: price-val-engine-0.1.9.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for price-val-engine-0.1.9.tar.gz
Algorithm Hash digest
SHA256 ac0e4345c3b7f488d6916cae8c54c69199d8ce015ef51d893a2c79d234e9316b
MD5 3ba8791cf0a4be2abbba0cb91bf78057
BLAKE2b-256 6e003598f4985e6e148167d41f09fb88710cb4cfdd6ced177f21926e2f834382

See more details on using hashes here.

File details

Details for the file price_val_engine-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for price_val_engine-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 c34404a4c6e509b71a31f1fbce37305a50c86de8261c2750d9cb1b488a210520
MD5 77517a761b94f11626175b4ab106f060
BLAKE2b-256 de01b8f8438c5db7d2fb896455c2a18c640852bcb56899f559842c076441888c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page