From 5e91986bd2fa34fcecbb9be7d604f29005b0af97 Mon Sep 17 00:00:00 2001 From: Neda Moeini <neda.moeini@geant.org> Date: Fri, 28 Feb 2025 14:41:50 +0100 Subject: [PATCH 1/5] Update the sphinx docs. --- docs/source/conf.py | 6 ++- docs/source/file_validator/forms.rst | 8 ++++ docs/source/file_validator/index.rst | 10 +++++ docs/source/file_validator/views.rst | 8 ++++ docs/source/index.rst | 12 ++---- docs/source/validations.rst | 63 ++++++++++++++++++++++++++++ requirements.txt | 1 + 7 files changed, 99 insertions(+), 9 deletions(-) create mode 100644 docs/source/file_validator/forms.rst create mode 100644 docs/source/file_validator/index.rst create mode 100644 docs/source/file_validator/views.rst create mode 100644 docs/source/validations.rst diff --git a/docs/source/conf.py b/docs/source/conf.py index 5cb62b0..a7b6713 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -12,8 +12,12 @@ # import os import sys -sys.path.insert(0, os.path.abspath('../sage-validation')) +import django +sys.path.insert(0, os.path.abspath("../../")) +sys.path.insert(0, os.path.abspath("../../sage_validation/")) +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 0000000..9ec6c70 --- /dev/null +++ b/docs/source/file_validator/forms.rst @@ -0,0 +1,8 @@ +========================================== +Sage Validation - File Validator Forms +========================================== + +.. automodule:: 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 0000000..c984a6a --- /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 0000000..548bc76 --- /dev/null +++ b/docs/source/file_validator/views.rst @@ -0,0 +1,8 @@ +========================================== +Sage Validation - File Validator Views +========================================== + +.. automodule:: 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 2af1b6c..cc6b075 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -10,11 +10,7 @@ Welcome to Sage Validation's documentation! :maxdepth: 2 :caption: Contents: - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` + validations + file_validator/index + file_validator/views + file_validator/forms \ No newline at end of file diff --git a/docs/source/validations.rst b/docs/source/validations.rst new file mode 100644 index 0000000..13bcc92 --- /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 diff --git a/requirements.txt b/requirements.txt index a1b9380..dbfb9a1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ mypy tox sphinx sphinx-autodoc-typehints +sphinx-autodoc mssql-django pytest pytest-django -- GitLab From 887d050c4e3cab17505d16cc10aee6d36e316fb2 Mon Sep 17 00:00:00 2001 From: Neda Moeini <neda.moeini@geant.org> Date: Mon, 24 Mar 2025 13:35:40 +0100 Subject: [PATCH 2/5] Update the docs --- docs/source/file_validator/forms.rst | 2 +- docs/source/file_validator/index.rst | 2 +- docs/source/file_validator/views.rst | 2 +- docs/source/index.rst | 6 ++---- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/source/file_validator/forms.rst b/docs/source/file_validator/forms.rst index 9ec6c70..4898ae2 100644 --- a/docs/source/file_validator/forms.rst +++ b/docs/source/file_validator/forms.rst @@ -2,7 +2,7 @@ Sage Validation - File Validator Forms ========================================== -.. automodule:: 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 index c984a6a..2d169eb 100644 --- a/docs/source/file_validator/index.rst +++ b/docs/source/file_validator/index.rst @@ -2,7 +2,7 @@ File Validator Module ========================================== -.. toctree:: + .. toctree:: :maxdepth: 2 :caption: Components: diff --git a/docs/source/file_validator/views.rst b/docs/source/file_validator/views.rst index 548bc76..5d27fc3 100644 --- a/docs/source/file_validator/views.rst +++ b/docs/source/file_validator/views.rst @@ -2,7 +2,7 @@ Sage Validation - File Validator Views ========================================== -.. automodule:: 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 cc6b075..a050f1c 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -10,7 +10,5 @@ Welcome to Sage Validation's documentation! :maxdepth: 2 :caption: Contents: - validations - file_validator/index - file_validator/views - file_validator/forms \ No newline at end of file + validations + file_validator/index \ No newline at end of file -- GitLab From 8a94e661a9c7b4faea17b41fd044d68cf2b33efd Mon Sep 17 00:00:00 2001 From: Neda Moeini <neda.moeini@geant.org> Date: Mon, 24 Mar 2025 13:36:18 +0100 Subject: [PATCH 3/5] Modify Sphinx conf file --- docs/source/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index a7b6713..57b2530 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -15,7 +15,6 @@ import sys import django sys.path.insert(0, os.path.abspath("../../")) -sys.path.insert(0, os.path.abspath("../../sage_validation/")) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sage_validation.settings") django.setup() -- GitLab From a59b8f2f2c71286353f46f0bf855ecc6a8ac14cd Mon Sep 17 00:00:00 2001 From: Neda Moeini <neda.moeini@geant.org> Date: Mon, 24 Mar 2025 13:41:32 +0100 Subject: [PATCH 4/5] Update requirements file --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index dbfb9a1..a1b9380 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,6 @@ mypy tox sphinx sphinx-autodoc-typehints -sphinx-autodoc mssql-django pytest pytest-django -- GitLab From a76c9c03476e672f96d9586471a5e8ee2319f13f Mon Sep 17 00:00:00 2001 From: Neda Moeini <neda.moeini@geant.org> Date: Mon, 24 Mar 2025 13:44:09 +0100 Subject: [PATCH 5/5] Update gitignore --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7ea6ec6..d5c686e 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 -- GitLab