diff --git a/.gitignore b/.gitignore index 7ea6ec68ec2c5a6b4e552fddc0405ec2159ddadf..d5c686e955ffb227ad37e6fc7d239434469bf341 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,8 @@ venv *.pyc sage_validation/staticfiles sage_validation/frontend/node_modules -.env \ No newline at end of file +.env +docs/build +db.sqlite3 +coverage.xml +.coverage \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 5cb62b06f7730cd2c493e068b4f21a68c1df7e37..57b253090f83217d2830f7fd7240ffe6aabb3148 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -12,8 +12,11 @@ # import os import sys -sys.path.insert(0, os.path.abspath('../sage-validation')) +import django +sys.path.insert(0, os.path.abspath("../../")) +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sage_validation.settings") +django.setup() # -- Project information ----------------------------------------------------- diff --git a/docs/source/file_validator/forms.rst b/docs/source/file_validator/forms.rst new file mode 100644 index 0000000000000000000000000000000000000000..4898ae2f3027a9df4686d04c3a4748af40d0d940 --- /dev/null +++ b/docs/source/file_validator/forms.rst @@ -0,0 +1,8 @@ +========================================== +Sage Validation - File Validator Forms +========================================== + +.. automodule:: sage_validation.file_validator.forms + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/source/file_validator/index.rst b/docs/source/file_validator/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..2d169ebfccd7efcc772a84ad29b43ef165804cb6 --- /dev/null +++ b/docs/source/file_validator/index.rst @@ -0,0 +1,10 @@ +========================================== +File Validator Module +========================================== + + .. toctree:: + :maxdepth: 2 + :caption: Components: + + views + forms \ No newline at end of file diff --git a/docs/source/file_validator/views.rst b/docs/source/file_validator/views.rst new file mode 100644 index 0000000000000000000000000000000000000000..5d27fc39a43085f0b3b4802668b07c0a73613b27 --- /dev/null +++ b/docs/source/file_validator/views.rst @@ -0,0 +1,8 @@ +========================================== +Sage Validation - File Validator Views +========================================== + +.. automodule:: sage_validation.file_validator.views + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst index 2af1b6c9e73ac03dce2472f8a752e770c08ea653..a050f1caa539762e6b3e00d3a3a887b0c9efdc0d 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -10,11 +10,5 @@ Welcome to Sage Validation's documentation! :maxdepth: 2 :caption: Contents: - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` + validations + file_validator/index \ No newline at end of file diff --git a/docs/source/validations.rst b/docs/source/validations.rst new file mode 100644 index 0000000000000000000000000000000000000000..13bcc924a0d12787957fcbf346e91af60c155f65 --- /dev/null +++ b/docs/source/validations.rst @@ -0,0 +1,63 @@ +==================================== +CSV Upload Validation Rules +==================================== + +The following table describes the validation rules applied when uploading a CSV file. + +.. list-table:: + :header-rows: 1 + :widths: 20 20 40 20 + + * - **Type** + - **Field** + - **Logic** + - **Comments** + + * - Structural + - *(All Fields)* + - Ensure that all required field names are present. + - - + * - Update + - `...NominalAccountNumber` (*n) + - If value starts with `xx-`, map `NominalCostCentre` using `dbo.meoCostCentres` and retrieve `NominalAccountNumber` from `dbo.vw_xx-data`. + - Ensure the correct nominal code is assigned. + + * - Checks + - AccountNumber + - Validate against `dbo.meoValidSuppliers`. + - Ensure the account exists in the valid suppliers list. + + * - Checks + - Source + - Should always be `80`. + - Reject rows where `Source != 80`. + + * - Checks + - SYSTraderTranType + - Should always be `4`. + - Reject rows where `SYSTraderTranType != 4`. + + * - Update + - TransactionDate + - Set to today’s date (`dd/mm/yyyy`). + - Ensure all rows have a consistent transaction date. + + * - Checks + - `...NominalAccountNumber` (*n) + - Validate against `[Nom]` in `dbo.meoNominal`. + - Ensure all nominal account numbers exist. + + * - Checks + - `...NominalCostCentre` (*n) + - Validate against `dbo.meoCostCentres`. + - Ensure cost centres exist. + + * - Checks + - Combination of `...NominalAccountNumber`, `...NominalCostCentre`, and `...NominalDepartment` + - Validate against `dbo.meoValidSageAccounts`. + - The combination of the three fields must be valid. + + * - Checks + - `...TaxRate` + - Validate against `[Tax code]` in `dbo.meoValidVAT`. + - Ensure valid tax rates. \ No newline at end of file