folio-data-import 0.3.2__tar.gz → 0.4.1__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.
Potentially problematic release.
This version of folio-data-import might be problematic. Click here for more details.
- {folio_data_import-0.3.2 → folio_data_import-0.4.1}/PKG-INFO +58 -7
- {folio_data_import-0.3.2 → folio_data_import-0.4.1}/README.md +52 -3
- {folio_data_import-0.3.2 → folio_data_import-0.4.1}/pyproject.toml +7 -8
- {folio_data_import-0.3.2 → folio_data_import-0.4.1}/src/folio_data_import/MARCDataImport.py +295 -159
- {folio_data_import-0.3.2 → folio_data_import-0.4.1}/src/folio_data_import/UserImport.py +386 -255
- folio_data_import-0.4.1/src/folio_data_import/__main__.py +12 -0
- folio_data_import-0.4.1/src/folio_data_import/_progress.py +27 -0
- {folio_data_import-0.3.2 → folio_data_import-0.4.1}/src/folio_data_import/marc_preprocessors/_preprocessors.py +12 -8
- folio_data_import-0.3.2/src/folio_data_import/__main__.py +0 -115
- {folio_data_import-0.3.2 → folio_data_import-0.4.1}/LICENSE +0 -0
- {folio_data_import-0.3.2 → folio_data_import-0.4.1}/src/folio_data_import/__init__.py +0 -0
- {folio_data_import-0.3.2 → folio_data_import-0.4.1}/src/folio_data_import/custom_exceptions.py +0 -0
- {folio_data_import-0.3.2 → folio_data_import-0.4.1}/src/folio_data_import/marc_preprocessors/__init__.py +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: folio_data_import
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: A python module to
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: A python module to perform bulk import of data into a FOLIO environment. Currently supports MARC and user data import.
|
|
5
5
|
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
6
7
|
Author: Brooks Travis
|
|
7
8
|
Author-email: brooks.travis@gmail.com
|
|
8
9
|
Requires-Python: >=3.9,<4.0
|
|
@@ -13,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
13
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
16
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
18
|
Requires-Dist: aiofiles (>=24.1.0,<25.0.0)
|
|
17
19
|
Requires-Dist: flake8-bandit (>=4.1.1,<5.0.0)
|
|
18
20
|
Requires-Dist: flake8-black (>=0.3.6,<0.4.0)
|
|
@@ -24,7 +26,7 @@ Requires-Dist: inquirer (>=3.4.0,<4.0.0)
|
|
|
24
26
|
Requires-Dist: pyhumps (>=3.8.0,<4.0.0)
|
|
25
27
|
Requires-Dist: pymarc (>=5.2.2,<6.0.0)
|
|
26
28
|
Requires-Dist: tabulate (>=0.9.0,<0.10.0)
|
|
27
|
-
Requires-Dist:
|
|
29
|
+
Requires-Dist: typer (>=0.17.4,<0.18.0)
|
|
28
30
|
Description-Content-Type: text/markdown
|
|
29
31
|
|
|
30
32
|
# folio_data_import
|
|
@@ -42,7 +44,16 @@ This project is designed to import data into the FOLIO LSP. It provides a simple
|
|
|
42
44
|
|
|
43
45
|
## Installation
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
Using `pip`
|
|
48
|
+
```shell
|
|
49
|
+
pip install folio_data_import
|
|
50
|
+
```
|
|
51
|
+
or `uv pip`
|
|
52
|
+
```shell
|
|
53
|
+
uv pip install folio_data_import
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
To install the project from the git repo using Poetry, follow these steps:
|
|
46
57
|
|
|
47
58
|
1. Clone the repository.
|
|
48
59
|
2. Navigate to the project directory: `$ cd /path/to/folio_data_import`.
|
|
@@ -58,8 +69,27 @@ Make sure to activate the virtual environment created by Poetry before running t
|
|
|
58
69
|
2. Run the application and follow the prompts to import the data.
|
|
59
70
|
3. Monitor the import progress and handle any errors or conflicts that may arise.
|
|
60
71
|
|
|
72
|
+
### folio-data-import
|
|
73
|
+
This command provides access to subcommands for importing user and marc data. To import users:
|
|
74
|
+
```shell
|
|
75
|
+
folio-data-import users --help
|
|
76
|
+
```
|
|
77
|
+
(for more information, see [folio-user-import](#folio-user-import), below)
|
|
78
|
+
|
|
79
|
+
For MARC data:
|
|
80
|
+
```shell
|
|
81
|
+
folio-data-import marc --help
|
|
82
|
+
```
|
|
83
|
+
(for more information, see [folio-marc-import](#folio-marc-import), below)
|
|
84
|
+
|
|
85
|
+
As an added convenience, this script can also install tab-completions for itself in your shell:
|
|
86
|
+
```shell
|
|
87
|
+
folio-data-import --install-completion
|
|
88
|
+
```
|
|
89
|
+
Once installed, you can `[tab][tab]` after typing `--` and be presented with a list of availabl command options.
|
|
90
|
+
|
|
61
91
|
### folio-user-import
|
|
62
|
-
When this package is installed via PyPI or using `poetry install` from this repository, it installs a convenience script in your `$PATH` called `folio-user-import`. To view all command line options for this script, run `folio-user-import
|
|
92
|
+
When this package is installed via PyPI or using `poetry install` from this repository, it installs a convenience script in your `$PATH` called `folio-user-import`. To view all command line options for this script, run `folio-user-import --help`. In addition to supporting `mod-user-import`-style JSON objects, this script also allows you to manage service point assignments for users by specifying a `servicePointsUser` object in the JSON object, using service point codes in place of UUIDs in the `defaultServicePointId` and `servicePointIds` fields:
|
|
63
93
|
```
|
|
64
94
|
{
|
|
65
95
|
"username": "checkin-all",
|
|
@@ -109,7 +139,7 @@ Unlike mod-user-import, this importer does not require `externalSystemId` as the
|
|
|
109
139
|
|
|
110
140
|
Another point of departure from the behavior of `mod-user-import` is the handling of `preferredContactTypeId`. This importer will accept either the `"001", "002", "003"...` values stored by FOLIO, or the human-friendly strings used by `mod-user-import` (`"mail", "email", "text", "phone", "mobile"`). It will also __*set a customizable default for all users that do not otherwise have a valid value specified*__ (using `--default_preferred_contact_type`), unless a (valid) value is already present in the user record being updated.
|
|
111
141
|
|
|
112
|
-
#### Field Protection (*experimental*)
|
|
142
|
+
#### Per-record Field Protection (*experimental*)
|
|
113
143
|
|
|
114
144
|
This script offers a rudimentary field protection implementation using custom fields. To enable this functionality, create a text custom field that has the field name `protectedFields`. In this field, you can specify a comma-separated list of User schema field names, using dot-notation for nested fields. This protection should support all standard fields except addresses within `personal.addresses`. If you include `personal.addresses` in a user record, any existing addresses will be replaced by the new values.
|
|
115
145
|
|
|
@@ -123,11 +153,32 @@ This script offers a rudimentary field protection implementation using custom fi
|
|
|
123
153
|
|
|
124
154
|
Would result in `preferredFirstName`, `barcode`, and `telephone` remaining unchanged, regardless of the contents of the incoming records.
|
|
125
155
|
|
|
156
|
+
#### Job-level field protection
|
|
157
|
+
|
|
158
|
+
To protect fields for all records in a particular import job, you can pass a list of field paths with the `--fields-to-protect` flag. These protections will be applied in combination with any record-level protections specified.
|
|
159
|
+
|
|
160
|
+
##### Example
|
|
161
|
+
```Shell
|
|
162
|
+
folio-user-import ... --fields-to-protect "personal.preferredFirstName,customFields.exampleCustomField"
|
|
163
|
+
```
|
|
126
164
|
|
|
127
165
|
#### How to use:
|
|
128
166
|
1. Generate a JSON lines (one JSON object per line) file of FOLIO user objects in the style of [mod-user-import](https://github.com/folio-org/mod-user-import)
|
|
129
167
|
2. Run the script and specify the required arguments (and any desired optional arguments), including the path to your file of user objects
|
|
168
|
+
3. Watch the pretty progress bars...
|
|
169
|
+
|
|
170
|
+
### folio-marc-import
|
|
171
|
+
`folio-marc-import` provides direct access to the MARC import functionality of FOLIO. It can be used to import any file (or files) of binary MARC records via FOLIO's Data Import system using the [change-manager](https://github.com/folio-org/mod-source-record-manager?tab=readme-ov-file#data-import-workflow) APIs directly.
|
|
130
172
|
|
|
173
|
+
#### How to use:
|
|
174
|
+
1. Have a binary MARC21 file (or directory of files)
|
|
175
|
+
2. Have a [Data Import Job Profile](https://docs.folio.org/docs/metadata/additional-topics/jobprofiles/) that you want to use to import your records already set up in FOLIO
|
|
176
|
+
3. Run the script and specify the required arguments. (`folio-marc-import --help` for more details)
|
|
177
|
+
4. Select the job profile you want to use
|
|
178
|
+
5. Watch the pretty progress bars...
|
|
179
|
+
|
|
180
|
+
#### A note on logging
|
|
181
|
+
The import logs and job summaries provided by FOLIO can be unreliable in certain circumstances. The scripts have been written to balance the need to retrieve job summary information at the end of each job with the the need to move on to the next import job. If you don't see a job summary when your job completes, check Data Import in FOLIO (Data Import > Actions > View all logs...)
|
|
131
182
|
|
|
132
183
|
## Contributing
|
|
133
184
|
|
|
@@ -13,7 +13,16 @@ This project is designed to import data into the FOLIO LSP. It provides a simple
|
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Using `pip`
|
|
17
|
+
```shell
|
|
18
|
+
pip install folio_data_import
|
|
19
|
+
```
|
|
20
|
+
or `uv pip`
|
|
21
|
+
```shell
|
|
22
|
+
uv pip install folio_data_import
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
To install the project from the git repo using Poetry, follow these steps:
|
|
17
26
|
|
|
18
27
|
1. Clone the repository.
|
|
19
28
|
2. Navigate to the project directory: `$ cd /path/to/folio_data_import`.
|
|
@@ -29,8 +38,27 @@ Make sure to activate the virtual environment created by Poetry before running t
|
|
|
29
38
|
2. Run the application and follow the prompts to import the data.
|
|
30
39
|
3. Monitor the import progress and handle any errors or conflicts that may arise.
|
|
31
40
|
|
|
41
|
+
### folio-data-import
|
|
42
|
+
This command provides access to subcommands for importing user and marc data. To import users:
|
|
43
|
+
```shell
|
|
44
|
+
folio-data-import users --help
|
|
45
|
+
```
|
|
46
|
+
(for more information, see [folio-user-import](#folio-user-import), below)
|
|
47
|
+
|
|
48
|
+
For MARC data:
|
|
49
|
+
```shell
|
|
50
|
+
folio-data-import marc --help
|
|
51
|
+
```
|
|
52
|
+
(for more information, see [folio-marc-import](#folio-marc-import), below)
|
|
53
|
+
|
|
54
|
+
As an added convenience, this script can also install tab-completions for itself in your shell:
|
|
55
|
+
```shell
|
|
56
|
+
folio-data-import --install-completion
|
|
57
|
+
```
|
|
58
|
+
Once installed, you can `[tab][tab]` after typing `--` and be presented with a list of availabl command options.
|
|
59
|
+
|
|
32
60
|
### folio-user-import
|
|
33
|
-
When this package is installed via PyPI or using `poetry install` from this repository, it installs a convenience script in your `$PATH` called `folio-user-import`. To view all command line options for this script, run `folio-user-import
|
|
61
|
+
When this package is installed via PyPI or using `poetry install` from this repository, it installs a convenience script in your `$PATH` called `folio-user-import`. To view all command line options for this script, run `folio-user-import --help`. In addition to supporting `mod-user-import`-style JSON objects, this script also allows you to manage service point assignments for users by specifying a `servicePointsUser` object in the JSON object, using service point codes in place of UUIDs in the `defaultServicePointId` and `servicePointIds` fields:
|
|
34
62
|
```
|
|
35
63
|
{
|
|
36
64
|
"username": "checkin-all",
|
|
@@ -80,7 +108,7 @@ Unlike mod-user-import, this importer does not require `externalSystemId` as the
|
|
|
80
108
|
|
|
81
109
|
Another point of departure from the behavior of `mod-user-import` is the handling of `preferredContactTypeId`. This importer will accept either the `"001", "002", "003"...` values stored by FOLIO, or the human-friendly strings used by `mod-user-import` (`"mail", "email", "text", "phone", "mobile"`). It will also __*set a customizable default for all users that do not otherwise have a valid value specified*__ (using `--default_preferred_contact_type`), unless a (valid) value is already present in the user record being updated.
|
|
82
110
|
|
|
83
|
-
#### Field Protection (*experimental*)
|
|
111
|
+
#### Per-record Field Protection (*experimental*)
|
|
84
112
|
|
|
85
113
|
This script offers a rudimentary field protection implementation using custom fields. To enable this functionality, create a text custom field that has the field name `protectedFields`. In this field, you can specify a comma-separated list of User schema field names, using dot-notation for nested fields. This protection should support all standard fields except addresses within `personal.addresses`. If you include `personal.addresses` in a user record, any existing addresses will be replaced by the new values.
|
|
86
114
|
|
|
@@ -94,11 +122,32 @@ This script offers a rudimentary field protection implementation using custom fi
|
|
|
94
122
|
|
|
95
123
|
Would result in `preferredFirstName`, `barcode`, and `telephone` remaining unchanged, regardless of the contents of the incoming records.
|
|
96
124
|
|
|
125
|
+
#### Job-level field protection
|
|
126
|
+
|
|
127
|
+
To protect fields for all records in a particular import job, you can pass a list of field paths with the `--fields-to-protect` flag. These protections will be applied in combination with any record-level protections specified.
|
|
128
|
+
|
|
129
|
+
##### Example
|
|
130
|
+
```Shell
|
|
131
|
+
folio-user-import ... --fields-to-protect "personal.preferredFirstName,customFields.exampleCustomField"
|
|
132
|
+
```
|
|
97
133
|
|
|
98
134
|
#### How to use:
|
|
99
135
|
1. Generate a JSON lines (one JSON object per line) file of FOLIO user objects in the style of [mod-user-import](https://github.com/folio-org/mod-user-import)
|
|
100
136
|
2. Run the script and specify the required arguments (and any desired optional arguments), including the path to your file of user objects
|
|
137
|
+
3. Watch the pretty progress bars...
|
|
138
|
+
|
|
139
|
+
### folio-marc-import
|
|
140
|
+
`folio-marc-import` provides direct access to the MARC import functionality of FOLIO. It can be used to import any file (or files) of binary MARC records via FOLIO's Data Import system using the [change-manager](https://github.com/folio-org/mod-source-record-manager?tab=readme-ov-file#data-import-workflow) APIs directly.
|
|
101
141
|
|
|
142
|
+
#### How to use:
|
|
143
|
+
1. Have a binary MARC21 file (or directory of files)
|
|
144
|
+
2. Have a [Data Import Job Profile](https://docs.folio.org/docs/metadata/additional-topics/jobprofiles/) that you want to use to import your records already set up in FOLIO
|
|
145
|
+
3. Run the script and specify the required arguments. (`folio-marc-import --help` for more details)
|
|
146
|
+
4. Select the job profile you want to use
|
|
147
|
+
5. Watch the pretty progress bars...
|
|
148
|
+
|
|
149
|
+
#### A note on logging
|
|
150
|
+
The import logs and job summaries provided by FOLIO can be unreliable in certain circumstances. The scripts have been written to balance the need to retrieve job summary information at the end of each job with the the need to move on to the next import job. If you don't see a job summary when your job completes, check Data Import in FOLIO (Data Import > Actions > View all logs...)
|
|
102
151
|
|
|
103
152
|
## Contributing
|
|
104
153
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "folio_data_import"
|
|
3
|
-
version = "0.
|
|
4
|
-
description = "A python module to
|
|
3
|
+
version = "0.4.1"
|
|
4
|
+
description = "A python module to perform bulk import of data into a FOLIO environment. Currently supports MARC and user data import."
|
|
5
5
|
authors = ["Brooks Travis <brooks.travis@gmail.com>"]
|
|
6
6
|
license = "MIT"
|
|
7
7
|
readme = "README.md"
|
|
8
|
-
packages = [{include = "folio_data_import", from="src"}]
|
|
8
|
+
packages = [{ include = "folio_data_import", from = "src" }]
|
|
9
9
|
|
|
10
10
|
[tool.poetry.scripts]
|
|
11
|
-
folio-data-import = "folio_data_import.__main__:
|
|
12
|
-
folio-marc-import = "folio_data_import.MARCDataImport:
|
|
13
|
-
folio-user-import = "folio_data_import.UserImport:
|
|
11
|
+
folio-data-import = "folio_data_import.__main__:app"
|
|
12
|
+
folio-marc-import = "folio_data_import.MARCDataImport:app"
|
|
13
|
+
folio-user-import = "folio_data_import.UserImport:app"
|
|
14
14
|
|
|
15
15
|
[tool.poetry.dependencies]
|
|
16
16
|
python = "^3.9"
|
|
@@ -18,7 +18,6 @@ folioclient = "^0.70.1"
|
|
|
18
18
|
pymarc = "^5.2.2"
|
|
19
19
|
pyhumps = "^3.8.0"
|
|
20
20
|
inquirer = "^3.4.0"
|
|
21
|
-
tqdm = "^4.66.5"
|
|
22
21
|
tabulate = "^0.9.0"
|
|
23
22
|
aiofiles = "^24.1.0"
|
|
24
23
|
flake8-black = "^0.3.6"
|
|
@@ -26,7 +25,7 @@ flake8-bugbear = "^24.8.19"
|
|
|
26
25
|
flake8-bandit = "^4.1.1"
|
|
27
26
|
flake8-isort = "^6.1.1"
|
|
28
27
|
flake8-docstrings = "^1.7.0"
|
|
29
|
-
|
|
28
|
+
typer = "^0.17.4"
|
|
30
29
|
|
|
31
30
|
[tool.poetry.group.dev.dependencies]
|
|
32
31
|
pytest = "^8.3.2"
|