Skip to main content

core_linked_records_app

This Django reusable app contains the PID functionalities for a CDCS project.

Pre-requisites

For automated and manual install, the following software are needed:

  • python

  • pip

  • virtual env (conda or venv)

In addition, for manual setup, git is needed.

Installation

Automated installation

$ pip install core_linked_records_app

Manual installation

$ git clone https://github.com/usnistgov/core_linked_records_app.git
$ cd core_linked_records_app
$ python setup.py
$ pip install sdist/*.tar.gz

Configuration

Edit the setting.py file

Add the "core_linked_records_app" under INSTALLED_APPS as such:

INSTALLED_APPS = [
  ...
  "core_linked_records_app",
]

Add the necessary setting keys at the end of the file.

ID_PROVIDER_SYSTEM_NAME = "local",
""" str: internal name of the provider system.
"""

ID_PROVIDER_SYSTEM_CONFIG = {
    "class": "core_linked_records_app.utils.providers.local.LocalIdProvider",
    "args": [],
}
""" dict: provider system configuration for resolving PIDs.
"""

ID_PROVIDER_PREFIXES = ["cdcs"]
""" list<str>: accepted prefixes if manually specifying PIDs (first item is the
default prefix).
"""

ID_PROVIDER_PREFIX_DEFAULT = ID_PROVIDER_PREFIXES[0]
""" str: default prefix for records (optional).
"""

ID_PROVIDER_PREFIX_BLOB = ID_PROVIDER_PREFIXES[0]
""" str: default prefix for blobs (optional).
"""

PID_XPATH = "root.pid"
""" string: location of the PID in the document, specified as dot notation.
"""

When using handle.net, the ID_PROVIDER_SYSTEM_CONFIG key has to be changed and additional optional settings keys are available.

ID_PROVIDER_SYSTEM_NAME = "handle.net"
""" str: internal name of the provider system.
"""

ID_PROVIDER_SYSTEM_CONFIG = {
    "class": "core_linked_records_app.utils.providers.handle_net.HandleNetSystem",
    "args": [
        "https://hdl.handle.net",  # Lookup domain, displayed on the records.
        "https://handle-net.domain",  # Regsitration domain, for CRUD operations.
        "300%3ACDCS/ADMIN",
        "admin",
    ],
}
""" dict: provider system configuration for resolving PIDs.
"""

HANDLE_NET_RECORD_INDEX = 1
""" int: index of record when using handle.net.
"""

HANDLE_NET_ADMIN_DATA = {
    "index": 100,
    "type": "HS_ADMIN",
    "data": {
        "format": "admin",
        "value": {
            "handle": f"0.NA/{ID_PROVIDER_PREFIX_DEFAULT}",
            "index": 200,
            "permissions": "011111110011",
        },
    },
}
""" dict: datastructure to insert with the record in order to give the
handle.net user creation, edition and deletion rights.
"""

Edit the urls.py file

Add the core_linked_records_app urls to the Django project as such.

re_path(r'^pid/', include("core_linked_records_app.urls")),

Example configuration and XML file:

The example below shows a configuration of a CDCS instance using the core_linked_records_app settings and what an XML document with a PID would look like in this case:

  1. Edit settings.py:

SERVER_URI = "http://localhost:8000"
ID_PROVIDER_SYSTEM_NAME = "local"
ID_PROVIDER_SYSTEM_CONFIG = {
    "class": "core_linked_records_app.utils.providers.local.LocalIdProvider",
    "args": [],
}
ID_PROVIDER_PREFIXES = ["cdcs"]
PID_XPATH = "root.pid"
  1. Upload the XML file:

<root><pid>http://localhost:8000/pid/rest/local/cdcs/0123ABCD</pid></root>
  1. Explanation:

The pid is stored in the “pid” element under the “root” element like indicated in PID_XPATH (root.pid). The generated PID (http://localhost:8000/pid/rest/local/cdcs/0123ABCD) is composed of:

  • the SERVER_URI: http://localhost:8000

  • the route to core_linked_records_app as defined in urls.py: pid

  • the route to the rest endpoints of this app: rest

  • the name of the PID provider specified by ID_PROVIDER_SYSTEM_NAME: local

  • a prefix found in the ID_PROVIDER_PREFIXES list: cdcs

  • a unique random identifier generated by the local PID provider: 0123ABCD

Tests

To play the test suite created for this package, download the git repository and run:

$ python runtests.py

Metadata

Release files for core-linked-records-app 2.23.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for core-linked-records-app 2.23.0
File Size Uploaded
core_linked_records_app-2.23.0.tar.gz 94.9 kB Details

Release files / core_linked_records_app-2.23.0.tar.gz

Download URL core_linked_records_app-2.23.0.tar.gz
Size 94.9 kB
Tags Source
SHA-256 checksum
How to use checksums
330d86f758fef22447180ccf48040c76807b654d211e4440dac58550d5492f7a
BLAKE2b-256 checksum
How to use checksums
6af65c9c0cf613c0637900b8e6d7a9a3ecf7761aa555627e71a5919a368c1516
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

This release

2.23.0 This release

1 release file

2.22.0

1 release file

2.21.0

1 release file

2.20.0

1 release file

2.19.0

1 release file

2.18.0

1 release file

2.17.0

1 release file

2.16.0

1 release file

2.15.0

1 release file

2.14.0

1 release file

2.13.0

1 release file

2.12.0

1 release file

2.11.0

1 release file

2.10.0

1 release file

2.9.0

1 release file

2.8.0

1 release file

2.7.0

1 release file

2.6.0

1 release file

2.5.0

1 release file

2.4.0

1 release file

2.3.0

1 release file

2.2.0

1 release file

2.1.0

1 release file

2.0.0

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page