Interact with Data Type Registries and Create Machine Actionable Data
Project description
dtreg
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. For instance, the schema “data item” requires the ePIC datatype with the DOI https://doi.org/21.T11969/aff130c76e68ead3862e. For the ORKG, please use the ORKG template URL, such as https://orkg.org/template/R758316.
## 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dtreg-1.1.0.tar.gz.
File metadata
- Download URL: dtreg-1.1.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a96533b369e0940a51920ad12e0c9b57c04889161ca228935c3477a8bba73855
|
|
| MD5 |
14fcd5e50021fad055fb3506d8e080d3
|
|
| BLAKE2b-256 |
88e62e7127100b94ae16efc477dbc411afcb69106550d72ec0eb82b0519c3cbb
|
Provenance
The following attestation bundles were made for dtreg-1.1.0.tar.gz:
Publisher:
publish.yml on OlgaLezhnina/dtreg_py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dtreg-1.1.0.tar.gz -
Subject digest:
a96533b369e0940a51920ad12e0c9b57c04889161ca228935c3477a8bba73855 - Sigstore transparency entry: 153954925
- Sigstore integration time:
-
Permalink:
OlgaLezhnina/dtreg_py@55f7ffc1b361f6c4e8f6eccff4a14ec3cdf3728a -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/OlgaLezhnina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@55f7ffc1b361f6c4e8f6eccff4a14ec3cdf3728a -
Trigger Event:
release
-
Statement type:
File details
Details for the file dtreg-1.1.0-py3-none-any.whl.
File metadata
- Download URL: dtreg-1.1.0-py3-none-any.whl
- Upload date:
- Size: 32.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baede0d1aec26afcc0ccc695cc024303c0410239b0a4759e9592e75caae8e42c
|
|
| MD5 |
0ab68c280fd90932032123d4916fc791
|
|
| BLAKE2b-256 |
382afab1f5abfabea18d6b5fd92cfa1e685a4c11e39dbfd24164852cc52112aa
|
Provenance
The following attestation bundles were made for dtreg-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on OlgaLezhnina/dtreg_py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dtreg-1.1.0-py3-none-any.whl -
Subject digest:
baede0d1aec26afcc0ccc695cc024303c0410239b0a4759e9592e75caae8e42c - Sigstore transparency entry: 153954926
- Sigstore integration time:
-
Permalink:
OlgaLezhnina/dtreg_py@55f7ffc1b361f6c4e8f6eccff4a14ec3cdf3728a -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/OlgaLezhnina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@55f7ffc1b361f6c4e8f6eccff4a14ec3cdf3728a -
Trigger Event:
release
-
Statement type: