Skip to content

Commit b317891

Browse files
Merge pull request #1 from NHSDigital/rest_of_the_code
feat: rest of the codebase
2 parents 8f33717 + 3789a8c commit b317891

File tree

211 files changed

+28872
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+28872
-0
lines changed

.gitallowed

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# base
2+
.*git-secrets/.*:*
3+
.*terraform.tfstate.*:*
4+
.*.svg:*
5+
.*.jquery.*.js:*
6+
.*engine_version*
7+
.*127.0.0.1*
8+
.*assembly: AssemblyVersion*
9+
.*assembly: AssemblyFileVersion*
10+
.*Version=*
11+
12+
# poetry dependencies false flags
13+
pandas-stubs
14+
types-openpyxl
15+
types-PyYAML
16+
types-requests
17+
types-setuptools
18+
types-urllib3
19+
types-xmltodict

.gitignore

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Mesh folders
7+
mesh*/
8+
9+
# Spark warehouse
10+
spark-warehouse/*
11+
12+
# C extensions
13+
*.so
14+
15+
# Distribution / packaging
16+
.Python
17+
build/
18+
develop-eggs/
19+
dist/
20+
downloads/
21+
eggs/
22+
.eggs/
23+
lib/
24+
lib64/
25+
parts/
26+
sdist/
27+
var/
28+
wheels/
29+
pip-wheel-metadata/
30+
share/python-wheels/
31+
*.egg-info/
32+
.installed.cfg
33+
*.egg
34+
MANIFEST
35+
poetry.lock
36+
37+
# PyInstaller
38+
# Usually these files are written by a python script from a template
39+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
40+
*.manifest
41+
*.spec
42+
43+
# Installer logs
44+
pip-log.txt
45+
pip-delete-this-directory.txt
46+
47+
# Unit test / coverage reports
48+
htmlcov/
49+
.tox/
50+
.nox/
51+
.coverage
52+
.coverage.*
53+
.cache
54+
nosetests.xml
55+
coverage.xml
56+
*.cover
57+
*.py,cover
58+
.hypothesis/
59+
.pytest_cache/
60+
61+
# Translations
62+
*.mo
63+
*.pot
64+
65+
# Django stuff:
66+
*.log
67+
local_settings.py
68+
db.sqlite3
69+
db.sqlite3-journal
70+
71+
# Flask stuff:
72+
instance/
73+
.webassets-cache
74+
75+
# Scrapy stuff:
76+
.scrapy
77+
78+
# Sphinx documentation
79+
docs/_build/
80+
81+
# PyBuilder
82+
target/
83+
84+
# Jupyter Notebook
85+
.ipynb_checkpoints
86+
87+
# IPython
88+
profile_default/
89+
ipython_config.py
90+
91+
# pyenv
92+
.python-version
93+
94+
# pipenv
95+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
97+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
98+
# install all needed dependencies.
99+
#Pipfile.lock
100+
101+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
102+
__pypackages__/
103+
104+
# Celery stuff
105+
celerybeat-schedule
106+
celerybeat.pid
107+
108+
# SageMath parsed files
109+
*.sage.py
110+
111+
# Environments
112+
.env
113+
.venv
114+
env/
115+
venv/
116+
ENV/
117+
env.bak/
118+
venv.bak/
119+
120+
# Spyder project settings
121+
.spyderproject
122+
.spyproject
123+
124+
# Rope project settings
125+
.ropeproject
126+
127+
# mkdocs documentation
128+
/site
129+
130+
# mypy
131+
.mypy_cache/
132+
.dmypy.json
133+
dmypy.json
134+
135+
# Pyre type checker
136+
.pyre/
137+
138+
# Editor stuff:
139+
.vscode/
140+
.idea/
141+
.devcontainer/
142+
143+
# Exclude outputs from dve.pipelines
144+
/outputs/
145+
.~lock*
146+
147+
metastore_db/
148+
149+
mesh_folder/*
150+
in/*
151+
/runtime-image*/engine_package.tgz
152+
/run_configuration/
153+
/runtime-image-test*/
154+
/nhs_data_validation_engine-*-py3-none-any.whl
155+
whl/
156+
spark-warehouse/
157+
158+
#test ipynb
159+
testing.ipynb

.mise.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[tools]
2+
python="3.7.17"
3+
poetry="1.4.2"
4+
java="liberica-1.8.0"

.pre-commit-config.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
# See https://pre-commit.com for more information
3+
# See https://pre-commit.com/hooks.html for more hooks
4+
default_install_hook_types: [
5+
commit-msg,
6+
pre-push,
7+
]
8+
9+
repos:
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v3.2.0
12+
hooks:
13+
# - id: trailing-whitespace
14+
- id: end-of-file-fixer
15+
stages: [commit-msg]
16+
# - id: check-yaml
17+
# - id: check-added-large-files
18+
- repo: local
19+
hooks:
20+
- id: git-secrets
21+
name: Git Secrets
22+
description: git-secrets scans commits, commit messages, and --no-ff merges to prevent adding secrets into your git repositories.
23+
entry: 'scripts/git-secrets/pre-commit.sh'
24+
language: script
25+
- repo: https://github.com/psf/black
26+
rev: 22.6.0
27+
hooks:
28+
- id: black
29+
stages: [commit-msg]
30+
- repo: https://github.com/PyCQA/isort
31+
rev: 5.11.5
32+
hooks:
33+
- id: isort
34+
stages: [commit-msg]
35+
- repo: https://github.com/commitizen-tools/commitizen
36+
rev: v3.9.1
37+
hooks:
38+
- id: commitizen
39+
stages: [commit-msg]

.tool-versions

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
python 3.7.17
2+
poetry 1.4.2
3+
java liberica-1.8.0

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## 1.0.0 (2025-10-09)
2+
3+
### Refactor
4+
5+
- release initial dve source code

CONTRIBUTE.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# DVE Contributing guidelines
2+
3+
# Developer information
4+
5+
## Getting started
6+
7+
To begin with I would recommend that users read all the documentation available within the [docs](./docs/). It gives an overview of how the DVE works and how to work with the dischema json document.
8+
9+
## General requirements
10+
To start contributing to the DVE project you will need the following tooling available:
11+
| Tool | Version | Reason |
12+
| ---- | ------- | ------ |
13+
| `Python` | 3.7.17 | Currently supported version of `Python` for the DVE. |
14+
| `Poetry` | 1.4.2 | Build and venv tool used for the DVE. |
15+
| `Java` | java liberica-1.8.0 | `Java` version required for `PySpark`. |
16+
| `pre-commit` | 2.21.0 | Currently installed as part of the `poetry` venv but seperate installation is fine. |
17+
| `commitizen` | 3.9.1 | Like `pre-commit`, installed as part of the `poetry` venv but seperate installation is fine. This is used to manage commits and automated semantic versioning. |
18+
| `git-secrets` | Latest | Utilised as part of the `pre-commit` to ensure that no secrets are commited to the repository. There is a helper installation script within [scripts](/scripts/git-secrets/). |
19+
20+
Additionally, we have created a [asdf support](.tool-versions) and [mise-en-toml](.mise.toml) for those utilising `asdf` or `mise-en-toml` software.
21+
22+
## Testing Requirements
23+
24+
Testing requirements are given in [pyproject.toml](./poetry.toml#48) under `tool.poetry.group.test.dependencies`. These are always pinned versions for consistency, but should be updated regularly if new versions are released. The following core packages are used for testing:
25+
- [pytest](https://docs.pytest.org/en/stable/): Used for Python unit tests, and some small e2e tests which check coverage.
26+
- [behave](https://github.com/behave/behave): Used for full, business-driven end-to-end tests.
27+
- [coverage](https://coverage.readthedocs.io/en/7.10.7/): Used to get coverage for `pytest` tests.
28+
29+
## Linting/Formatting/Type Checking Requirements
30+
31+
Additional dependencies for linting, type checking, and formatting are listed within the [pyproject.toml](./poetry.toml#58) under `tool.poetry.group.lint.dependencies`. Like the testing requirements, we use pinned versions for these.
32+
33+
This mostly breaks down to:
34+
- [black](https://github.com/psf/black): a tool to format Python, which ensures consistency of formatting across the project. We use a line length of 100.
35+
- [isort](https://pycqa.github.io/isort/): a tool to organise imports in a consistent way across the project.
36+
- [mypy](https://github.com/python/mypy): a type checker for Python. This ensures that our function signatures remain accurate and is very useful for spotting type-related issues (a significant category of bugs).
37+
- [pylint](https://pylint.readthedocs.io/en/stable/): a (very aggressive) linter for Python, which prevents errors and code style violations across the project. This pushes us to document the code and is often quite good at highlighting overly complex code.
38+
39+
We use these tools to ensure that code quality is not excessively compromised, even when working at pace.
40+
41+
## Installation for Development
42+
43+
We are utilising Poetry for build dependency management and packaging. If you're on a system that has `Make` available, you can simply run `make install` to setup a local virtual environment with all the dependencies installed (this won't install Poetry for you).
44+
45+
## Testing
46+
47+
Tests should be run after installing the package for development as outlined above.
48+
- To run unit tests without coverage, run `poetry run pytest tests/`
49+
- To run the unit tests with coverage, run `poetry run coverage run`
50+
- To check the coverage run `poetry run coverage report -m`
51+
- To run the behave tests, run `poetry run behave tests/features` (these are not included in coverage calculations)
52+
53+
## Submitting a pull request
54+
55+
If you want to contribute to the DVE then please follow the steps below:
56+
1. Fork the repository.
57+
2. Configure and install the dependencies.
58+
3. Ensure that new changes are fully tested and that you are reguarlly checking for changes within the DVE repository to sort any potential merge conflicts.
59+
4. Ensure linting passes.
60+
5. Push and then create a pull request from your fork to our repository.
61+
62+
Your pull request will then be reviewed. You may receive some feedback and suggested changes before it can be approved and merged.

Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
activate = poetry run
2+
3+
# dev
4+
install:
5+
poetry lock
6+
poetry install --with dev,test
7+
8+
# dist
9+
wheel:
10+
poetry build -f wheel
11+
poetry build -f sdist
12+
13+
dist: wheel
14+
15+
# testing
16+
behave:
17+
${activate} behave
18+
19+
pytest:
20+
${activate} pytest tests/
21+
22+
all-tests: pytest behave
23+
24+
coverage:
25+
$(activate) coverage run
26+
$(activate) coverage combine
27+
$(activate) coverage report
28+
$(activate) coverage xml
29+
30+
# pre-commit
31+
pre-commit-all:
32+
${activate} pre-commit run --all-files

behave.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[behave]
2+
paths=tests/features

0 commit comments

Comments
 (0)