Skip to main content

A library for generating predictive uuids for FOLIO data migrations

Project description

folio_uuid

A python module for creating deterministic UUIDs (UUID v5) outside of FOLIO when migrating data.

Installation

The module is uploaded to pypi. Just do

pip install folio-uuid

or

pipenv install folio-uuid      

Overview

The UUIDs (v5) are contstructed in the following way:

  • The namespace is the same for all "Folio UUIDs": 8405ae4d-b315-42e1-918a-d1919900cf3f
  • The name is contstructed by the following parts, delimited by a colon (:)
    • TENANT_STRING This should be a unique, system-specific string for the target system. We recommend using the target Tenant ID (the value passed in x-okapi-tenant when accessing FOLIO's APIs), but you can use the system's API gateway URL, as well. Example: diku
    • OBJECT_TYPE_NAME This should be the name of the type of object that the ID is generated for. In plural. the file folio_namespaces.py in this repo has a complete list of the ones currently in use. Example: items
    • LEGACY_IDENTIFIER This should be the legacy identifier comming from the source system. The library will perform some normalization* of the identifier if it is a Sierra/Millennium identifier. Example: i3696836

* The normalization strips away any dots (.), check digits and campus codes from the identifiers

Tests/Examples

  • The namespace is *8405ae4d-b315-42e1-918a-d1919900cf3f*
  • The name, constructed as TENANT_ID:OBJECT_TYPE_NAME:LEGACY_IDENTIFIER would become diku:items:i3696836
  • The resulting UUID then becomes 9647225d-d8e9-530d-b8cc-52a53be14e26

Bash/linux example

uuidgen --sha1 -n 8405ae4d-b315-42e1-918a-d1919900cf3f -N diku:items:i3696836

To install uuidgen on a apt-enabled Linux distribution, use

sudo apt-get install uuid-runtime

Python Example

def test_deterministic_uuid_generation_holdings():
   deterministic_uuid = FolioUUID(
      "diku",
      FOLIONamespaces.holdings,
      "000000167",
   )
assert "3db53ecc-37a9-521e-88fd-6ef72c710468" == str(deterministic_uuid)

What happened to OKAPI_URL?

Previous versions of this library directed users to provide the target FOLIO system's OKAPI URL as the first argument (okapi_url) when instantiating a new FolioUUID class, and allowed specifying an optional tenant_id value that would be included in the overall string used to generate the v5 UUID. However, in most circumstances the FOLIO tenant id value is more static than the API gateway URL (eg. when migrating from an OKAPI-based FOLIO system to a Eureka-based one).

As of v1.0.0 of folio_uuid, the first argument has been renamed to tenant_string, and can be any unique string value for the target tenant. okapi_url and tenant_id are still available as keyword-only arguments, but are deprecated and will be removed in a future release. Code that used FolioUUID with positional-only arguments will not require any code changes. Code that used keyword arguments for okapi_url and tenant_id will continue to work, as well, but will raise deprecation warnings.

References

Wikipedia has an article on UUID version 5

There are many browser-based tools to create singe UUIDs v5. UUIDTools is one of them.

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_uuid-1.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

folio_uuid-1.0.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file folio_uuid-1.0.1.tar.gz.

File metadata

  • Download URL: folio_uuid-1.0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for folio_uuid-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0d4876276068cc47d368f90932e00a857b219890f8d874eec8f703fc9adc26aa
MD5 5b754e910b5608a42590bdb842c59ad0
BLAKE2b-256 a3b2c8e1ad0c2d1135e2fa87570e21ae716d68221349a4064334034f76faaa3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for folio_uuid-1.0.1.tar.gz:

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

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_uuid-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: folio_uuid-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for folio_uuid-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4f23e683821fd4cbe35d5db8c0781cde91cd19936faef69a2d8f847aee10bff
MD5 a1ee09ca099751d0bb3e09601d3f6079
BLAKE2b-256 dcde23002219802aa7fff367f22aa63b59f6385881f7c4e0697ef0087d32ff7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for folio_uuid-1.0.1-py3-none-any.whl:

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

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