Skip to main content

Linked records for the core project

Project description

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 keys at the end of the file.

ID_PROVIDER_SYSTEMS = {
    "local": {
        "class": "core_linked_records_app.utils.providers.local.LocalIdProvider",
        "args": [],
    },
    "handle.net": {  # Optional: if a Handle.net server is available.
        "class": "core_linked_records_app.utils.providers.handle_net.HandleNetSystem",
        "args": [
            "https://handle-net.domain/api/handles",
            "300%3ACDCS/ADMIN",
            "admin",
        ],
    },
}
""" dict: all the provider systems available for registering PIDs
"""

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

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

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:

Settings.py:

SERVER_URI = "http://localhost:8000"
ID_PROVIDER_SYSTEMS = {
    "local": {
        "class": "core_linked_records_app.utils.providers.local.LocalIdProvider",
        "args": [],
    },
}
ID_PROVIDER_PREFIXES = ["cdcs"]
PID_XPATH = "root.pid"

XML file:

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

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 found in ID_PROVIDER_SYSTEMS: 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

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

core_linked_records_app-1.2.0.tar.gz (40.3 kB view details)

Uploaded Source

File details

Details for the file core_linked_records_app-1.2.0.tar.gz.

File metadata

  • Download URL: core_linked_records_app-1.2.0.tar.gz
  • Upload date:
  • Size: 40.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

File hashes

Hashes for core_linked_records_app-1.2.0.tar.gz
Algorithm Hash digest
SHA256 b21496a007584da119326ab6752c66716d12c4a9ee18fd7cb753a561881cdf9a
MD5 decab2faf3904039bf673affe4e262e5
BLAKE2b-256 4c3e743c4d990fce591c8300f91777c2f10e088a27141632355cfac9d83f3089

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