Skip to main content

Interact with Data Type Registries and Create Machine Actionable Data

Project description

dtreg

PyPI version Python coverage

100% AI-free: we did not use any AI technologies in developing this package.

The goal of dtreg is to help users interact with various data type registries (DTRs) and create machine-readable data. Currently, we support the ePIC and ORKG DTRs.

  • First, load a DTR schema (an ePIC datatype or an ORKG template) as a Python object.
  • Then, create a new instance of the schema by filling in the relevant fields.
  • Finally, write the instance as a machine-readable JSON-LD file.

Installation

## install from PyPi:
pip install dtreg

Example

This example shows you how to work with a DTR schema. You need to know the schema identifier; see the help page.

## import functions from the dtreg
from dtreg.load_datatype import load_datatype
from dtreg.to_jsonld import to_jsonld
## import pandas for a dataframe
import pandas as pd
## load the schema with the known identifier
dt = load_datatype("https://doi.org/21.T11969/aff130c76e68ead3862e")
## look at the schemata you might need to use
dt.__dict__.keys() 
## check available fields for your schema
dt.data_item.prop_list 
## create your instance by filling the fields of your choice
## see the help page to know more about the fields
my_label = "my results"
my_df = pd.DataFrame({'A': [1], 'B': [2]})
my_df.name = "dataframe_name"
url_1 = dt.url(label = "URL_1")
url_2 = dt.url(label = "URL_2")
my_inst = dt.data_item(label=my_label,
                       has_expression=[url_1, url_2],
                       source_table=my_df)
## write the instance in JSON-LD format as a string
my_json = to_jsonld(my_inst) 

## the result can be saved as a JSON file
with open('my_file.json', 'w') as f:
    f.write(my_json)

For more information, please see the help page.

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

dtreg-1.1.2.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

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

dtreg-1.1.2-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file dtreg-1.1.2.tar.gz.

File metadata

  • Download URL: dtreg-1.1.2.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dtreg-1.1.2.tar.gz
Algorithm Hash digest
SHA256 9b9b75e9bd56c4c023cf14e4f9aed1b639a373ec90757b40a05e32e9e0d558b2
MD5 fdc7151264008dac979c1fd7cd506dda
BLAKE2b-256 90a7c4a2cf5b0b9388254d7e4ba0ab28c8166ec293e56b3d433af4233ef9ce88

See more details on using hashes here.

Provenance

The following attestation bundles were made for dtreg-1.1.2.tar.gz:

Publisher: publish.yml on OlgaLezhnina/dtreg_py

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

File details

Details for the file dtreg-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: dtreg-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dtreg-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 43590d849f4a15ebd685085f41035dba3e79cdff6e8e613e0e4a8522da3ee8b6
MD5 a3a80eadac9276a7937fb084b285a50f
BLAKE2b-256 8f295883b11cf6482f148d77188e0ce8cb1307eaee92460a2cd00930302bad9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for dtreg-1.1.2-py3-none-any.whl:

Publisher: publish.yml on OlgaLezhnina/dtreg_py

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