|
1 | | -# BAM Data Store: MasterDataChecker |
| 1 | +# Masterdata Checker |
2 | 2 |
|
3 | | -The `masterdata_checker` is a Python package used to check the correctness of a given Masterdata definitions file with respect to the entities already registered in the BAM Data Store. The package provides a Graphical User Interface (GUI) on which the user can: |
4 | | -- Choose a local Masterdata file to be checked. |
| 3 | +The `masterdata_checker` is a Django app used to check the correctness of a given Masterdata definitions file with respect to the entities already registered in the BAM Data Store (as defined in the [`bam-masterdata`](https://github.com/BAMresearch/bam-masterdata) package). In the app, you can: |
| 4 | +- Log in your openBIS instance. |
| 5 | +- Run checks of a local Masterdata Excel file. **Note**: only supported file formats are `.xls` and `.xlsx` |
5 | 6 | - Revise the errors logs to correct mistakes in the original Masterdata file. |
6 | | -- Depending on the credentials access, select a specific BAM Data Store instance and the Masterdata definitions therein. |
7 | 7 |
|
8 | | -We also provide a Jupyter Notebook as a tutorial to execute the API of `masterdata_checker`. |
9 | | - |
10 | | - |
11 | | -<!-- |
12 | | -## Getting started |
13 | | -
|
14 | | - Add here installation instructions once the package is deployed --> |
15 | 8 |
|
16 | 9 | ## Development |
17 | 10 |
|
18 | 11 | If you want to develop locally this package, clone the project and enter in the workspace folder: |
19 | 12 | ```sh |
20 | | -git clone https://git.bam.de/bam-data-store/development/masterdata_checker.git |
| 13 | +git clone https://github.com/BAMresearch/masterdata-checker |
21 | 14 | cd masterdata_checker |
22 | 15 | ``` |
23 | 16 |
|
24 | | -Note you need to have installed the Python interface for the Tcl/Tk GUI toolkit ([`tkinter`](https://docs.python.org/3/library/tkinter.html)). If you don't have it, you can run: |
25 | | -```sh |
26 | | -sudo apt-get install python3-tk |
27 | | -``` |
28 | | - |
29 | | -#### Option 1: Virtual environment with `venv` |
30 | | - |
31 | | -Create a virtual environment (you can use Python>3.9) in your workspace: |
32 | | -```sh |
33 | | -python3 -m venv .venv |
34 | | -source .venv/bin/activate |
35 | | -``` |
36 | | - |
37 | | -Make sure `pip` is upgraded: |
38 | | -```sh |
39 | | -pip install --upgrade pip |
40 | | -``` |
41 | | - |
42 | | -Install the package with the desired optional dependencies (specified in between brackets, e.g., `[dev]` or `[jupy]`) and in editable mode (with the added `-e` flag): |
43 | | -```sh |
44 | | -pip install -e '.[dev,jupy,docu]' |
45 | | -``` |
46 | | - |
47 | | -#### Option 2: `uv` virtual environment |
48 | | - |
49 | 17 | We recommend using `uv` for fast pip installation of the package. In this case, you can instead create a virtual environment by doing: |
50 | 18 | ```sh |
51 | 19 | uv venv |
52 | 20 | source .venv/bin/activate |
53 | 21 | ``` |
54 | 22 |
|
55 | | -Install the package with the desired optional dependencies (specified in between brackets, e.g., `[dev]` or `[jupy]`) and in editable mode (with the added `-e` flag): |
| 23 | +Install the package with the desired optional dependencies (specified in between brackets, e.g., `[dev]`) and in editable mode (with the added `-e` flag): |
56 | 24 | ```sh |
57 | | -uv pip install -e '.[dev,jupy,docu]' |
| 25 | +uv pip install -e '.[dev]' |
58 | 26 | ``` |
59 | 27 |
|
60 | | -### Run the tests |
| 28 | +### Launch the Django app |
61 | 29 |
|
62 | | -You can locally run the tests by doing: |
| 30 | +In order to launch the Django app, navigate to the `masterdata_checker/` subfolder: |
63 | 31 | ```sh |
64 | | -python -m pytest -sv tests |
65 | | -``` |
66 | | - |
67 | | -where the `-s` and `-v` options toggle the output verbosity. |
68 | | - |
69 | | -You can also generate a local coverage report: |
70 | | -```sh |
71 | | -python -m pytest --cov=src tests |
72 | | -``` |
73 | | - |
74 | | -### Run auto-formatting and linting |
75 | | - |
76 | | -We use [Ruff](https://docs.astral.sh/ruff/) for formatting and linting the code following the rules specified in the `pyproject.toml`. You can run locally: |
77 | | -```sh |
78 | | -ruff check . |
79 | | -``` |
80 | | - |
81 | | -This will produce an output with the specific issues found. In order to auto-fix them, run: |
82 | | -```sh |
83 | | -ruff format . --check |
84 | | -``` |
85 | | - |
86 | | -If some issues are not possible to fix automatically, you will need to visit the file and fix them by hand. |
87 | | - |
88 | | -<!-- ### Debugging |
89 | | -
|
90 | | -For interactive debugging of the tests, use `pytest` with the `--pdb` flag. We recommend using an IDE for debugging, e.g., _VSCode_. If that is the case, add the following snippet to your `.vscode/launch.json`: |
91 | | -```json |
92 | | -{ |
93 | | - "configurations": [ |
94 | | - { |
95 | | - "name": "<descriptive tag>", |
96 | | - "type": "debugpy", |
97 | | - "request": "launch", |
98 | | - "cwd": "${workspaceFolder}", |
99 | | - "program": "${workspaceFolder}/.pyenv/bin/pytest", |
100 | | - "justMyCode": true, |
101 | | - "env": { |
102 | | - "_PYTEST_RAISE": "1" |
103 | | - }, |
104 | | - "args": [ |
105 | | - "-sv", |
106 | | - "--pdb", |
107 | | - "<path-to-plugin-tests>", |
108 | | - ] |
109 | | - } |
110 | | - ] |
111 | | -} |
| 32 | +cd masterdata_checker |
112 | 33 | ``` |
113 | 34 |
|
114 | | -where `<path-to-plugin-tests>` must be changed to the local path to the test module to be debugged. |
115 | | -
|
116 | | -The settings configuration file `.vscode/settings.json` automatically applies the linting and formatting upon saving the modified file. --> |
117 | | - |
118 | | -### Documentation on Github pages |
119 | | - |
120 | | -To view the documentation locally, install the extra packages using: |
| 35 | +And run: |
121 | 36 | ```sh |
122 | | -uv pip install -e '[docu]' |
| 37 | +python manage.py runserver |
123 | 38 | ``` |
124 | 39 |
|
125 | | -The first time, build the server: |
| 40 | +This will run the Django app server: |
126 | 41 | ```sh |
127 | | -mkdocs build |
128 | | -``` |
| 42 | +Performing system checks... |
129 | 43 |
|
130 | | -Run the documentation server: |
131 | | -```sh |
132 | | -mkdocs serve |
| 44 | +System check identified no issues (0 silenced). |
| 45 | +June 05, 2025 - 06:24:20 |
| 46 | +Django version 5.2.1, using settings 'checker.settings' |
| 47 | +Starting development server at http://127.0.0.1:8000/ |
| 48 | +Quit the server with CONTROL-C. |
133 | 49 | ``` |
134 | 50 |
|
135 | | -The output looks like: |
136 | | -```sh |
137 | | -INFO - Building documentation... |
138 | | -INFO - Cleaning site directory |
139 | | -INFO - [14:07:47] Watching paths for changes: 'docs', 'mkdocs.yml' |
140 | | -INFO - [14:07:47] Serving on http://127.0.0.1:8000/ |
141 | | -``` |
| 51 | +Simply click on the localhost address `http://127.0.0.1:8000/` to launch the app. |
142 | 52 |
|
143 | | -Simply click on `http://127.0.0.1:8000/`. The changes in the `md` files of the documentation are inmediately reflected when the files are saved (the local web will automatically refresh). |
144 | 53 |
|
145 | 54 | ## Main contributors |
146 | 55 |
|
147 | 56 | | Name | E-mail | Role | |
148 | | -|------|------------|--------|-----------------| |
| 57 | +|------|------------|--------| |
149 | 58 | | Carlos Madariaga | [[email protected]]([email protected]) | Admin | |
150 | 59 | | Dr. Jose M. Pizarro | [[email protected]]([email protected]) | Maintainer | |
151 | 60 | | Jörg Rädler | [[email protected]]([email protected]) | Maintainer | |
|
0 commit comments