Skip to main content

A library for creating and managing globally-unique open-xpd-uuid namespaces for product declarations.

Project description

open-xpd-uuid-lib

A library of common functions used when creating and managing open-xpd-uuid, a common, globally-unique name space (uuid) for Product Declarations, including HPDs and EPDs, to help users find all environmental and health information related to a single product.

Open xPD UUID (short readable GUIDs)

open-xpd-uuid is a string that consists of 8 or 10 (8+2) alpha-numeric characters and any number of dashes. For example: 123ABCED, 123ABCEDAR, ASB21M01, avbDK93S, -AB-11-cc-Ll---. GUIDs that consists of the following characters 1234567890ABCDEFGHJKMNPRQRSTUVWXYZ (L and O are not mentioned) are called "canonical". For example: 12345678, ABCDEFG1, 123ABCEDAR. GUIDs that consists of 10 characters represent 8-character guid with appended 2-character checksum. Checksum allows to detect 1-character entry errors and character swaps, and most other errors.

Character treatment

  • - or dash - is ignored
  • L or l or I or i - is treated as 1
  • O or o - is treated as 0(zero)

Install

pip install open-xpd-uuid-lib

Supported versions

  • The library is tested with the following Python versions:
    • Python 3.9
    • Python 3.10
    • Python 3.11
    • Python 3.12
    • Python 3.13
    • Python 3.14
  • The minimal supported Python version is 3.9.
  • Compatibility with future Python 3.x versions is expected but not guaranteed.

Usage

Generate short readable GUID

>>> from cqd import open_xpd_uuid
>>> open_xpd_uuid.generate()
'JKGEE5PN'

Generate short readable GUID starting with specific characters set (prefix)

>>> from cqd import open_xpd_uuid
>>> open_xpd_uuid.generate('CQD')
'CQD55PG0'

If you wish to issue your own openEPD IDs, you can request any three-symbol prefix that is not already reserved.

  • "EC3" is reserved for BuildingTransparency.org
  • "EST" is reserved for generic estimates
  • "CQD" and "WAP" are reserved for WAP Sustainability
  • "PCR" is reserved for designating product category rules
  • "UL" is reserved for UL Sustainability

To request your own prefix, please email open-epd-forum@c-change-labs.com.

Sanitize short readable GUIDs

Use sanitize to replace ambiguous chars(0,o,O,1,L,l,I,i) with correct ones and remove dashes(-). This function is useful to turn guid received from a user into a canonical one.

For example: as-b2-lm-oL -> ASB21M01

>>> from cqd import open_xpd_uuid
>>> open_xpd_uuid.sanitize('as-b2-lm-oL')
'ASB21M01'

Validate short readable GUID

Use validate to validate short readable GUID and get error description if the GUID is not valid. validate accepts only "canonical" GUIDs: use sanitize function to make them "canonical".

>>> from cqd import open_xpd_uuid
>>> sanitized_guid = open_xpd_uuid.sanitize('as-b2-lm-oL')
>>> sanitized_guid
'ASB21M01'
>>> open_xpd_uuid.validate(sanitized_guid)
# no exception - the `sanitized_guid` is valid

>>> try:
...     open_xpd_uuid.validate('as-b2-lm-oL')
... except open_xpd_uuid.GuidValidationError as e:
...     print(e)
...     
`guid` length must be 8 characters long

Generate and use checksum

>>> from cqd import open_xpd_uuid
>>> guid = open_xpd_uuid.generate()
'JKGEE5PN'
>>> checksum = open_xpd_uuid.checksum(guid)
'ME'
>>> guid_with_checksum = guid + checksum
'JKGEE5PNME'
>>> short_link = 'cqd.io/e/' + guid_with_checksum
'cqd.io/e/JKGEE5PNME'

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

open_xpd_uuid-1.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

open_xpd_uuid-1.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file open_xpd_uuid-1.1.0.tar.gz.

File metadata

  • Download URL: open_xpd_uuid-1.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.9.25 Linux/6.11.0-1018-azure

File hashes

Hashes for open_xpd_uuid-1.1.0.tar.gz
Algorithm Hash digest
SHA256 492c3db17ab171eb49c21326ea317bcc8280682d804b9e3f71002d43564c43ba
MD5 ea8c6c8b662627e172f4f868387d0f49
BLAKE2b-256 8f8e59fbc01206ee7e0e3cb7cde6b9ba42ddfc142011e188a10dd20c2999553b

See more details on using hashes here.

File details

Details for the file open_xpd_uuid-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: open_xpd_uuid-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.9.25 Linux/6.11.0-1018-azure

File hashes

Hashes for open_xpd_uuid-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57782c8ae5ab13d4e6775983f48734fee15ae7427d6edb725f040bbf77eebb89
MD5 8ab6cd98968f7c941298796ed3cdef38
BLAKE2b-256 a35ef0d0fc4d52528ac1d492f099cf5ca8e48ff10da5bb4269cddb82c54271fb

See more details on using hashes here.

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