Skip to main content

A python module to interact with the data importing capabilities of the open-source FOLIO ILS

Project description

folio_data_import

Description

This project is designed to import data into the FOLIO LSP. It provides a simple and efficient way to import data from various sources using FOLIO's REST APIs.

Features

  • Import MARC records using FOLIO's Data Import system
  • Import User records using FOLIO's User APIs

Installation

Installation

To install the project using Poetry, follow these steps:

  1. Clone the repository.
  2. Navigate to the project directory: $ cd /path/to/folio_data_import.
  3. Install Poetry if you haven't already: $ pip install poetry.
  4. Install the project and its dependencies: $ poetry install.
  5. Run the application using Poetry: $ poetry run python -m folio_data_import --help.

Make sure to activate the virtual environment created by Poetry before running the application.

Usage

  1. Prepare the data to be imported in the specified format.
  2. Run the application and follow the prompts to import the data.
  3. Monitor the import progress and handle any errors or conflicts that may arise.

folio-user-import

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 -h. 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:

{
    "username": "checkin-all",
    "barcode": "1728439497039848103",
    "active": true,
    "type": "patron",
    "patronGroup": "staff",
    "departments": [],
    "personal": {
        "lastName": "Admin",
        "firstName": "checkin-all",
        "addresses": [
          {
            "countryId": "HU",
            "addressLine1": "Andrássy Street 1.",
            "addressLine2": "",
            "city": "Budapest",
            "region": "Pest",
            "postalCode": "1061",
            "addressTypeId": "Home",
            "primaryAddress": true
          }
        ],
        "preferredContactTypeId": "email"
    },
    "requestPreference": {
        "holdShelf": true,
        "delivery": false,
        "fulfillment": "Hold Shelf"
    }
    "servicePointsUser": {
        "defaultServicePointId": "cd1",
        "servicePointsIds": [
            "cd1",
            "Online",
            "000",
            "cd2"
        ]
    }
}

Matching Existing Users

Unlike mod-user-import, this importer does not require externalSystemId as the match point for your objects. If the user objects have id values, that will be used, falling back to externalSystemId. However, you can also specify username or barcode as the match point if desired, using the --user_match_key argument.

Preferred Contact Type Mapping

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 the 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.

Field Protection (experimental)

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 ca 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.

Example
{
    "protectedFields": "customFields.protectedFields,personal.preferredFirstName,barcode,personal.telephone,personal.addresses"
}

Would result in preferredFirstName, barcode, and telephone remaining unchanged, regardless of the contents of the incoming records.

How to use:

  1. Generate a JSON lines (one JSON object per line) file of FOLIO user objects in the style of mod-user-import
  2. Run the script and specify the required arguments (and any desired optional arguments), including the path to your file of user objects

Contributing

Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

folio_data_import-0.2.8rc1.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

folio_data_import-0.2.8rc1-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file folio_data_import-0.2.8rc1.tar.gz.

File metadata

  • Download URL: folio_data_import-0.2.8rc1.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for folio_data_import-0.2.8rc1.tar.gz
Algorithm Hash digest
SHA256 0e24c08b6f4819a20b0c471e7b5c2252fc0bcd70db32ab827f1baea21b1e552f
MD5 5991e61b100ba26bb34b2a333b425a4a
BLAKE2b-256 8ed78e4bbe3fa1241eaba1f1917b806fd0d1b0d481a616a470479b0be452920c

See more details on using hashes here.

Provenance

The following attestation bundles were made for folio_data_import-0.2.8rc1.tar.gz:

Publisher: python-publish.yml on FOLIO-FSE/folio_data_import

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file folio_data_import-0.2.8rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for folio_data_import-0.2.8rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd5054ce2f73709e2efea79817e54a9f24f828be2041ae8c5294f3c3918c15a3
MD5 896971c954c43210c6ddb22253b4f2f7
BLAKE2b-256 dbe3024f1e727f0ef96fdceec7e30cb31a15c53f01134adc7a94e921f3f5a0d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for folio_data_import-0.2.8rc1-py3-none-any.whl:

Publisher: python-publish.yml on FOLIO-FSE/folio_data_import

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page