medkit.tools
Contents
medkit.tools#
APIs#
For accessing these APIs, you may use import like this:
from medkit.tools import <api_to_import>
Functions:
|
Convert mtsamples data into a medkit file |
|
Function loading mtsamples data into medkit text documents |
|
Generate a graphviz-compatible .dot file from a |
- save_prov_to_dot(prov_tracer, file, data_item_formatters=None, op_formatter=None, max_sub_prov_depth=None, show_attr_links=True)[source]#
Generate a graphviz-compatible .dot file from a
ProvTracerfor visualization.- Parameters
prov_tracer (
ProvTracer) – Provenance tracer holding the provenance information to save.file (
Union[str,Path]) – Path to the .dot file.data_item_formatters (
Optional[Dict[Type,Callable[[Any],str]]]) – Dict mapping data items types with callback functions returning the text to display for each data item of this type. Some default formatters are available for common data item such as text annotations. Use data_item_formatters to override them or to add support for other types.op_formatter (
Optional[Callable[[OperationDescription],str]]) – Callback function returning the text to display for each operation. If none provided, the operation name is used.max_sub_prov_depth (
Optional[int]) – When there are nested provenance tracers for some operations, how deep should we go when displaying their contents.show_attr_links (
bool) – Whether to show links between attributes and the data items they are attached to (not strictly provenance but can make things easier to understand).
- load_mtsamples(cache_dir='.cache', translated=True, nb_max=None)[source]#
Function loading mtsamples data into medkit text documents
- Parameters
cache_dir (
Union[Path,str]) – Directory where to store mtsamples file. Default: .cachetranslated (
bool) – If True (default), mtsamples_translated.json file is used (FR). If False, mtsamples.csv is used (EN)nb_max (
Optional[int]) – Maximum number of documents to load
- Return type
List[TextDocument]- Returns
List[TextDocument] – The medkit text documents corresponding to mtsamples data
- convert_mtsamples_to_medkit(output_file, encoding='utf-8', cache_dir='.cache', translated=True)[source]#
Convert mtsamples data into a medkit file
- Parameters
output_file (
Union[Path,str]) – Path to the medkit jsonl file to generateencoding (
Optional[str]) – Encoding of the medkit file to generatecache_dir (
Union[Path,str]) – Directory where mtsamples file is cached. Default: .cachetranslated (
bool) – If True (default), mtsamples_translated.json file is used (FR). If False, mtsamples.csv is used (EN)
Subpackages / Submodules#
This module needs extra-dependencies not installed as core dependencies of medkit. |
|
This module aims to provide facilities for accessing some examples of mtsamples files available on this repository: https://github.com/neurazlab/mtsamplesFR |