mrap
100% AI-free: we did not use any AI technologies in developing this package.
The goal of mrap is to provide wrapper functions to reduce the user's effort
in writing machine-readable data with the dtreg library.
All-in-one wrappers (such as scipy_f_oneway) will cover functions from scipy and other widely used libraries.
The mrap.analytic_instances module contains wrappers for analytical schemata used by TIB Knowledge Loom.
To write the results of your data analysis as JSON-LD:
- Select a wrapper from mrap, check the types of arguments it requires, and create an instance.
- Modify the instance by setting or correcting its fields manually.
- Write the finalised instance as a machine-readable JSON-LD file.
Installation
## activate a virtual environment (optional)
python3 -m venv .venv
source .venv/bin/activate
## install from PyPi:
pip install mrap
Example
Let us assume you intend to report the classification performance of your_fancy_algorithm.
From the help page you know that the wrapper of choice is
algorithm_evaluation(). The required arguments are:
code_list: a string "N/A" if not given or a list of two strings - the library and the line of code used for implementing the analysis.input_data: a pd.DataFrame, a dictionary of pd.Series with names, or a string which is either the data URL or the file name.dictionary_results: a dictionary with metrics names as keys.
The wrapper writes information about the data, your results, your Python version, the library version, etc. You can add or correct any information in relevant fields.
from mrap.analytic_instances import algorithm_evaluation
## run your analysis and write the results as a dictionary
results_dict = {"F1": 0.46, "recall": 0.51}
## create your instance with the wrapper
eval_instance = algorithm_evaluation(["the_library", "the_line_of_code"],
"my_URL",
results_dict)
## add information about the algorithm and the task
eval_instance.evaluates = "my_fancy_algorithm"
eval_instance.evaluates_for = "Classification"
It is also possible to write the results of a few algorithms evaluated on the same data for the same task.
from mrap.list_algorithm_evaluations import list_algorithm_evaluations
## run your analysis and write a nested dictionary
results_nested = {"ABC": {"F1": 0.46, "recall": 0.64},
"KLM": {"F1": 0.55, "recall": 0.38},
"XYZ": {"F1": 0.87, "recall": 0.78}}
## create the list of instances
eval_instance = list_algorithm_evaluations("N/A", "my URL", "Classification", my_results)
## when manually modifying the instance, select an element of the list
eval_instance[2].label = "XYZ evaluation"
You can include the evaluation instance in data analysis instance, convert it into a machine-readable JSON-LD string, and write as a file.
from mrap.analytic_instances import data_analysis
from mrap.to_jsonld import to_jsonld
da_instance = data_analysis(eval_instance)
da_instance.is_implemented_by = "code_URL"
my_json = to_jsonld(da_instance)
with open('data_analysis.json', 'w') as f:
f.write(my_json)
For more information, please see the help page.
Metadata
Release files for mrap 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mrap-1.0.1.tar.gz | 15.6 kB | With provenance | Details for mrap-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mrap-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for mrap-1.0.1-py3-none-any.whl |
Total release size: 27.1 kB
Release files / mrap-1.0.1.tar.gz
| Download URL | mrap-1.0.1.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f37f73525b255d06a0213315b315a78aca177d74ac004e26f79de14ccf523309
|
|
BLAKE2b-256 checksum How to use checksums |
4f945ae02bd2b938bf8302094eccae5a83f0329e605e9923b972543f8d20310c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 8, 2025.
Transparency logRelease files / mrap-1.0.1-py3-none-any.whl
| Download URL | mrap-1.0.1-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f37b14a8c47ff55ae129b816f4fdfbd2886b90980e529bf1abc3000955e9a8e
|
|
BLAKE2b-256 checksum How to use checksums |
f3e4a4fbc222ab1c90630f832bc72998fb89a574ed3a6b425414f52b3c9a4937
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 8, 2025.
Transparency logSecurity for mrap 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mrap-1.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 8, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.