vantage6-algorithm-tools 4.15.1__tar.gz → 5.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. vantage6_algorithm_tools-5.0.0/.gitignore +37 -0
  2. vantage6_algorithm_tools-5.0.0/Makefile +19 -0
  3. vantage6_algorithm_tools-5.0.0/PKG-INFO +48 -0
  4. vantage6_algorithm_tools-5.0.0/README.md +25 -0
  5. vantage6_algorithm_tools-5.0.0/pyproject.toml +44 -0
  6. vantage6_algorithm_tools-4.15.1/tests/test_deserialization.py → vantage6_algorithm_tools-5.0.0/tests/_test_deserialization.py +1 -0
  7. vantage6_algorithm_tools-4.15.1/tests/test_docker_wrapper.py → vantage6_algorithm_tools-5.0.0/tests/_test_docker_wrapper.py +72 -4
  8. vantage6_algorithm_tools-5.0.0/tests/_test_preprocessing.py +656 -0
  9. {vantage6_algorithm_tools-4.15.1 → vantage6_algorithm_tools-5.0.0}/tests/algorithm/test___init__.py +22 -17
  10. vantage6_algorithm_tools-5.0.0/tests/mock/__init__.py +0 -0
  11. vantage6_algorithm_tools-5.0.0/tests/mock/test_algorithm_client.py +76 -0
  12. vantage6_algorithm_tools-5.0.0/tests/mock/test_network.py +131 -0
  13. vantage6_algorithm_tools-5.0.0/tests/mock/test_node.py +243 -0
  14. vantage6_algorithm_tools-5.0.0/tests/mock/test_server.py +73 -0
  15. vantage6_algorithm_tools-5.0.0/tests/mock/test_user_client.py +48 -0
  16. vantage6_algorithm_tools-5.0.0/tests/mock/test_util.py +51 -0
  17. {vantage6_algorithm_tools-4.15.1 → vantage6_algorithm_tools-5.0.0}/vantage6/algorithm/client/__init__.py +77 -254
  18. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/data_extraction/__init__.py +272 -0
  19. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/data_extraction/mock_extract.py +117 -0
  20. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/decorator/__init__.py +27 -0
  21. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/decorator/action.py +251 -0
  22. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/decorator/algorithm_client.py +91 -0
  23. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/decorator/data.py +275 -0
  24. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/decorator/metadata.py +67 -0
  25. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/decorator/ohdsi.py +191 -0
  26. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/mock/__init__.py +3 -0
  27. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/mock/client.py +694 -0
  28. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/mock/globals.py +11 -0
  29. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/mock/hq.py +273 -0
  30. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/mock/network.py +215 -0
  31. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/mock/node.py +315 -0
  32. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/mock/util.py +46 -0
  33. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/preprocessing/__init__.py +7 -0
  34. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/preprocessing/aggregation.py +242 -0
  35. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/preprocessing/algorithm_json_data.py +311 -0
  36. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/preprocessing/column.py +190 -0
  37. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/preprocessing/datetime.py +342 -0
  38. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/preprocessing/encoding.py +574 -0
  39. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/preprocessing/filtering.py +352 -0
  40. {vantage6_algorithm_tools-4.15.1 → vantage6_algorithm_tools-5.0.0}/vantage6/algorithm/tools/__init__.py +3 -1
  41. vantage6_algorithm_tools-5.0.0/vantage6/algorithm/tools/error_handling.py +59 -0
  42. {vantage6_algorithm_tools-4.15.1 → vantage6_algorithm_tools-5.0.0}/vantage6/algorithm/tools/exceptions.py +14 -4
  43. {vantage6_algorithm_tools-4.15.1 → vantage6_algorithm_tools-5.0.0}/vantage6/algorithm/tools/util.py +39 -3
  44. {vantage6_algorithm_tools-4.15.1 → vantage6_algorithm_tools-5.0.0}/vantage6/algorithm/tools/wrap.py +80 -48
  45. vantage6_algorithm_tools-4.15.1/PKG-INFO +0 -232
  46. vantage6_algorithm_tools-4.15.1/setup.cfg +0 -4
  47. vantage6_algorithm_tools-4.15.1/setup.py +0 -58
  48. vantage6_algorithm_tools-4.15.1/vantage6/algorithm/client/__build__ +0 -1
  49. vantage6_algorithm_tools-4.15.1/vantage6/algorithm/client/_version.py +0 -23
  50. vantage6_algorithm_tools-4.15.1/vantage6/algorithm/tools/decorators.py +0 -530
  51. vantage6_algorithm_tools-4.15.1/vantage6/algorithm/tools/mock_client.py +0 -618
  52. vantage6_algorithm_tools-4.15.1/vantage6/algorithm/tools/preprocessing/__init__.py +0 -65
  53. vantage6_algorithm_tools-4.15.1/vantage6/algorithm/tools/preprocessing/functions.py +0 -73
  54. vantage6_algorithm_tools-4.15.1/vantage6/algorithm/tools/wrappers.py +0 -318
  55. vantage6_algorithm_tools-4.15.1/vantage6_algorithm_tools.egg-info/PKG-INFO +0 -232
  56. vantage6_algorithm_tools-4.15.1/vantage6_algorithm_tools.egg-info/SOURCES.txt +0 -26
  57. vantage6_algorithm_tools-4.15.1/vantage6_algorithm_tools.egg-info/dependency_links.txt +0 -1
  58. vantage6_algorithm_tools-4.15.1/vantage6_algorithm_tools.egg-info/requires.txt +0 -12
  59. vantage6_algorithm_tools-4.15.1/vantage6_algorithm_tools.egg-info/top_level.txt +0 -2
  60. {vantage6_algorithm_tools-4.15.1 → vantage6_algorithm_tools-5.0.0}/tests/__init__.py +0 -0
  61. vantage6_algorithm_tools-4.15.1/tests/test_serialization.py → vantage6_algorithm_tools-5.0.0/tests/_test_serialization.py +1 -1
  62. {vantage6_algorithm_tools-4.15.1 → vantage6_algorithm_tools-5.0.0}/tests/algorithm/__init__.py +0 -0
  63. {vantage6_algorithm_tools-4.15.1 → vantage6_algorithm_tools-5.0.0}/tests/algorithm_module.py +0 -0
  64. {vantage6_algorithm_tools-4.15.1 → vantage6_algorithm_tools-5.0.0}/tests/base/__init__.py +0 -0
@@ -0,0 +1,37 @@
1
+
2
+ # documentation
3
+ docs/_build
4
+ docs/api-docs/_autosummary
5
+
6
+ # Python
7
+ .ipynb_checkpoints
8
+ **/__pycache__
9
+ **/.coverage
10
+
11
+ # IDE's
12
+ .idea/
13
+ *.sublime-project
14
+ *.sublime-workspace
15
+ .vscode/
16
+
17
+ # build files
18
+ **/build/
19
+ **/dist/
20
+ *.egg-info
21
+ *.code-workspace
22
+
23
+ # UI build files
24
+ **/node_modules/
25
+
26
+ # Ignore DevSpace cache and log folder
27
+ .devspace/
28
+ dev/.data/
29
+ dev/.tasks/
30
+ dev/.db/
31
+ dev/.log/
32
+
33
+ # Helm
34
+ charts/**/*.tgz
35
+
36
+ # MacOS
37
+ .DS_Store
@@ -0,0 +1,19 @@
1
+ # `make` is expected to be called from the directory that contains
2
+ # this Makefile
3
+
4
+ TAG ?= latest
5
+
6
+ rebuild: clean build-dist
7
+
8
+ build-dist:
9
+ # Build the PyPI package
10
+ uv build
11
+
12
+ publish:
13
+ # Uploading to pypi.org
14
+ twine upload --repository pypi dist/*
15
+
16
+ clean:
17
+ # Cleaning ...
18
+ -rm -r build
19
+ -rm dist/*
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.4
2
+ Name: vantage6-algorithm-tools
3
+ Version: 5.0.0
4
+ Summary: Vantage6 algorithm tools
5
+ Author: Vantage6 Team
6
+ Maintainer-email: Frank Martin <f.martin@iknl.nl>, Bart van Beusekom <b.vanbeusekom@iknl.nl>
7
+ License: MIT
8
+ Requires-Python: >=3.13
9
+ Requires-Dist: openpyxl>=3.0.0
10
+ Requires-Dist: pandas>=2.2.3
11
+ Requires-Dist: psycopg2-binary==2.9.10
12
+ Requires-Dist: pyarrow>=16.1.0
13
+ Requires-Dist: pyfiglet==1.0.4
14
+ Requires-Dist: pyjwt==2.12.1
15
+ Requires-Dist: sparqlwrapper>=2.0.0
16
+ Requires-Dist: sqlalchemy>=1.4.46
17
+ Requires-Dist: vantage6-common==5.0.0
18
+ Provides-Extra: dev
19
+ Requires-Dist: black; extra == 'dev'
20
+ Requires-Dist: coverage==7.10.2; extra == 'dev'
21
+ Requires-Dist: pre-commit; extra == 'dev'
22
+ Description-Content-Type: text/markdown
23
+
24
+ <h1 align="center">
25
+ <br>
26
+ <a href="https://vantage6.ai"><img src="https://github.com/IKNL/guidelines/blob/master/resources/logos/vantage6.png?raw=true" alt="vantage6" width="350"></a>
27
+ </h1>
28
+
29
+ <h3 align=center> A Privacy Enhancing Technology (PET) Operations platform</h3>
30
+
31
+ ---
32
+
33
+ # Vantage6 Algorithm Tools
34
+
35
+ This package provides Python tools to facilitate algorithm development for vantage6.
36
+
37
+ ## Documentation
38
+
39
+ For complete documentation, installation instructions, and usage examples, please see
40
+ the **[main Vantage6 README](https://github.com/vantage6/vantage6/blob/main/README.md)**
41
+ .
42
+
43
+ ## About Vantage6
44
+
45
+ Vantage6 is a Privacy Enhancing Technology (PET) Operations platform that enables
46
+ federated learning and multi-party computation. For more information, visit
47
+ [vantage6.ai](https://vantage6.ai) or view our
48
+ [documentation](https://docs.vantage6.ai).
@@ -0,0 +1,25 @@
1
+ <h1 align="center">
2
+ <br>
3
+ <a href="https://vantage6.ai"><img src="https://github.com/IKNL/guidelines/blob/master/resources/logos/vantage6.png?raw=true" alt="vantage6" width="350"></a>
4
+ </h1>
5
+
6
+ <h3 align=center> A Privacy Enhancing Technology (PET) Operations platform</h3>
7
+
8
+ ---
9
+
10
+ # Vantage6 Algorithm Tools
11
+
12
+ This package provides Python tools to facilitate algorithm development for vantage6.
13
+
14
+ ## Documentation
15
+
16
+ For complete documentation, installation instructions, and usage examples, please see
17
+ the **[main Vantage6 README](https://github.com/vantage6/vantage6/blob/main/README.md)**
18
+ .
19
+
20
+ ## About Vantage6
21
+
22
+ Vantage6 is a Privacy Enhancing Technology (PET) Operations platform that enables
23
+ federated learning and multi-party computation. For more information, visit
24
+ [vantage6.ai](https://vantage6.ai) or view our
25
+ [documentation](https://docs.vantage6.ai).
@@ -0,0 +1,44 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "vantage6-algorithm-tools"
7
+ version = "5.0.0"
8
+ description = "Vantage6 algorithm tools"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "Vantage6 Team"}
13
+ ]
14
+ maintainers = [
15
+ {name = "Frank Martin", email = "f.martin@iknl.nl"},
16
+ {name = "Bart van Beusekom", email = "b.vanbeusekom@iknl.nl"}
17
+ ]
18
+ requires-python = ">=3.13"
19
+ dependencies = [
20
+ "openpyxl>=3.0.0",
21
+ "pandas>=2.2.3",
22
+ # psycopg2-binary is not used directly in algorithm tools, but is necessary when
23
+ # running SQL queries on a postgres database.
24
+ "psycopg2-binary==2.9.10",
25
+ "pyarrow>=16.1.0",
26
+ "pyjwt==2.12.1",
27
+ "pyfiglet==1.0.4",
28
+ "SPARQLWrapper>=2.0.0",
29
+ "sqlalchemy>=1.4.46",
30
+ "vantage6-common==5.0.0",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ dev = [
35
+ "coverage==7.10.2",
36
+ "black",
37
+ "pre-commit",
38
+ ]
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["vantage6"]
42
+
43
+ [tool.hatch.build.targets.wheel.sources]
44
+ "vantage6" = "vantage6"
@@ -1,4 +1,5 @@
1
1
  from pathlib import Path
2
+
2
3
  from vantage6.common.client import deserialization
3
4
 
4
5
  SIMPLE_TARGET_DATA = {"key": "value"}
@@ -4,22 +4,24 @@
4
4
 
5
5
  # import pandas as pd
6
6
 
7
+ # from vantage6.common.globals import ContainerEnvNames
8
+
7
9
  # from vantage6.algorithm.tools import wrapper
8
10
 
9
11
  # MODULE_NAME = "algorithm_module"
10
12
  # DATA = "column1,column2\n1,2"
11
13
  # TOKEN = "This is a fake token"
12
- # INPUT_PARAMETERS = {"method": "hello_world"}
14
+ # # INPUT_PARAMETERS = {"method": "hello_world"}
13
15
  # SEPARATOR = "."
14
16
  # SAMPLE_DB = pd.DataFrame([[1, 2]], columns=["column1", "column2"])
15
17
 
16
18
  # MOCK_SPARQL_ENDPOINT = "sparql://some_triplestore"
17
19
 
18
20
 
19
- # # def test_json_input_without_format_raises_deserializationexception(tmp_path):
21
+ # # def test_json_input_without_format_raises_deserializationerror(tmp_path):
20
22
  # # """
21
23
  # # It should only be possible to provide json input if it is preceded by the
22
- # # string "json." in unicode. Otherwise a `DeserializationException` should
24
+ # # string "json." in unicode. Otherwise a `DeserializationError` should
23
25
  # # be thrown.
24
26
  # # """
25
27
  # # input_file = tmp_path / 'input.json'
@@ -27,7 +29,7 @@
27
29
  # # with input_file.open('wb') as f:
28
30
  # # f.write(json.dumps(INPUT_PARAMETERS).encode())
29
31
 
30
- # # with raises(DeserializationException):
32
+ # # with raises(DeserializationError):
31
33
  # # run_docker_wrapper_with_echo_db(input_file, tmp_path)
32
34
 
33
35
 
@@ -123,5 +125,71 @@
123
125
 
124
126
  # _run_algorithm_method.assert_called_once()
125
127
 
128
+ # def run_docker_wrapper_with_echo_db(input_file, tmp_path):
129
+ # """
130
+ # Run the `echo_db` testing algorithm through the wrapper code. The wrapper
131
+ # communicates through files whose locations are stored in the `INPUT_FILE`,
132
+ # `TOKEN_FILE` and `DATABASE_URI` environment variables. The output of the
133
+ # algorithm is stored in the location specified in environment variable
134
+ # `OUTPUT_FILE`.
135
+
136
+ # :param input_file: input arguments to the wrapper and algorithm
137
+ # :param tmp_path: temporary path to store additional files.
138
+ # :return:
139
+ # """
140
+ # db_file = tmp_path / "db_file.csv"
141
+ # token_file = tmp_path / "token.txt"
142
+ # output_file = tmp_path / "output_file.pkl"
143
+ # db_file.write_text(DATA)
144
+ # token_file.write_text(TOKEN)
145
+ # with patch("vantage6.algorithm.tools.docker_wrapper.os") as mock_os:
146
+ # mock_os.environ = {
147
+ # ContainerEnvNames.INPUT_FILE.value: input_file,
148
+ # ContainerEnvNames.TOKEN_FILE.value: token_file,
149
+ # ContainerEnvNames.DATABASE_URI.value: db_file,
150
+ # ContainerEnvNames.OUTPUT_FILE.value: output_file,
151
+ # }
152
+
153
+ # wrapper.docker_wrapper(MODULE_NAME)
154
+ # return output_file
155
+
156
+
157
+ # @patch("vantage6.algorithm.tools.wrap._run_algorithm_method")
158
+ # @patch("vantage6.algorithm.tools.docker_wrapper.os")
159
+ # @patch("vantage6.algorithm.tools.docker_wrapper.SPARQLWrapper")
160
+ # def test_sparql_docker_wrapper_passes_dataframe(
161
+ # SPARQLWrapper: MagicMock,
162
+ # os: MagicMock,
163
+ # _run_algorithm_method: MagicMock,
164
+ # tmp_path: Path,
165
+ # ):
166
+ # input_file = tmp_path / "input_file.pkl"
167
+ # token_file = tmp_path / "token.txt"
168
+ # output_file = tmp_path / "output.pkl"
169
+
170
+ # environ = {
171
+ # ContainerEnvNames.INPUT_FILE.value: str(input_file),
172
+ # ContainerEnvNames.TOKEN_FILE.value: str(token_file),
173
+ # ContainerEnvNames.DATABASE_URI.value: MOCK_SPARQL_ENDPOINT,
174
+ # ContainerEnvNames.OUTPUT_FILE.value: str(output_file),
175
+ # }
176
+
177
+ # os.environ = environ
178
+
179
+ # input_args = {"query": "select *"}
180
+
181
+ # with input_file.open("wb") as f:
182
+ # json.dumps(input_args, f)
183
+
184
+ # with token_file.open("w") as f:
185
+ # f.write(TOKEN)
186
+
187
+ # _run_algorithm_method.return_value = pd.DataFrame()
188
+ # SPARQLWrapper.return_value.query.return_value.convert.return_value = DATA.encode()
189
+
190
+ # wrapper.sparql_wrapper(MODULE_NAME)
191
+
192
+ # _run_algorithm_method.assert_called_once()
193
+
126
194
  # target_df = pd.DataFrame([[1, 2]], columns=["column1", "column2"])
127
195
  # pd.testing.assert_frame_equal(target_df, _run_algorithm_method.call_args[0][0])