carputils
Doxygen code documentation for the python framework controlling openCARP
Functions | Variables
carputils.bundle.metadata Namespace Reference

Utilities for generating and managing metadata in bundles. More...

Functions

def load_metadata_file (exp_dir, bundle_dir)
 Creates an object containing metadata provided by the user in the file exp_dir/codemeta.json, or in bundle_dir/codemeta.json (in this order) and merge it with the metadata template. More...
 
def check_critical_fields (metadata_obj)
 Raise warnings if metadata template fields were not filled by the user. More...
 
def autopopulate_template (metadata_obj)
 Automatically fills some fields in metadata object. More...
 
def autopopulate_authors_names (metadata_obj)
 Create full name of the authors from 'given_name' and 'family_name' fields. More...
 
def autopopulate_date (metadata_obj)
 Fills 'date' and 'publication_year' fields in metadata. More...
 
def add_env_metadata (metadata_obj)
 Adds to an existing metadata object the environment metadata included by default in the bundle. More...
 
def add_exp_name (metadata_obj, exp_name)
 Adds the experiment name to the metadata object if not defined in metadata. More...
 
def add_command_line (metadata_obj, exp_filename)
 Adds the command line that should be used to run the same experiment to a metadata object. More...
 
def analyze_metadata (metadata_obj)
 Analyzes the metadata and trigger warnings in case some critical metadata is missing. More...
 
def get_opencarp_git_hash ()
 Get the git hash of the openCARP version. More...
 
def get_latest_opencarp_version ()
 Get the latest version of openCARP. More...
 

Variables

string METADATA_FILE = 'codemeta.json'
 
string METADATA_TPL_FILE = 'codemeta.json.tpl'
 

Detailed Description

Utilities for generating and managing metadata in bundles.

Function Documentation

◆ add_command_line()

def carputils.bundle.metadata.add_command_line (   metadata_obj,
  exp_filename 
)

Adds the command line that should be used to run the same experiment to a metadata object.

    metadata_obj :
        Object containng metadata
Returns
Updated metadata object

◆ add_env_metadata()

def carputils.bundle.metadata.add_env_metadata (   metadata_obj)

Adds to an existing metadata object the environment metadata included by default in the bundle.

    metadata_obj :
        an object containing metadata.
Returns
The updated metadata object.

◆ add_exp_name()

def carputils.bundle.metadata.add_exp_name (   metadata_obj,
  exp_name 
)

Adds the experiment name to the metadata object if not defined in metadata.

    metadata_obj :
        the object containing metadata
Returns
The updated metadata object

◆ analyze_metadata()

def carputils.bundle.metadata.analyze_metadata (   metadata_obj)

Analyzes the metadata and trigger warnings in case some critical metadata is missing.

    metadata_obj :
        Object containing metadata

◆ autopopulate_authors_names()

def carputils.bundle.metadata.autopopulate_authors_names (   metadata_obj)

Create full name of the authors from 'given_name' and 'family_name' fields.

If no name is given for the first author, it is autopopulated with the user data in carputils settings file. It also fills the 'rights_holder' field with the names of the authors.

    metadata_obj :
        object containing metadata
Returns
Modified metadata

◆ autopopulate_date()

def carputils.bundle.metadata.autopopulate_date (   metadata_obj)

Fills 'date' and 'publication_year' fields in metadata.

    metadata_obj :
        object containing metadata
Returns
Modified metadata

◆ autopopulate_template()

def carputils.bundle.metadata.autopopulate_template (   metadata_obj)

Automatically fills some fields in metadata object.

    metadata_obj :
        object containing metadata
Returns
Modified metadata

◆ check_critical_fields()

def carputils.bundle.metadata.check_critical_fields (   metadata_obj)

Raise warnings if metadata template fields were not filled by the user.

◆ get_latest_opencarp_version()

def carputils.bundle.metadata.get_latest_opencarp_version ( )

Get the latest version of openCARP.

Returns
the latest version as a string, an empty string if the version could not be retrieved

◆ get_opencarp_git_hash()

def carputils.bundle.metadata.get_opencarp_git_hash ( )

Get the git hash of the openCARP version.

Returns
the git hash as a string

◆ load_metadata_file()

def carputils.bundle.metadata.load_metadata_file (   exp_dir,
  bundle_dir 
)

Creates an object containing metadata provided by the user in the file exp_dir/codemeta.json, or in bundle_dir/codemeta.json (in this order) and merge it with the metadata template.

If these files don't exist, metadata template is loaded.

Parameters
exp_dirstr directory where to find the metadata file.
Returns
An object containing metadata.

Variable Documentation

◆ METADATA_FILE

string carputils.bundle.metadata.METADATA_FILE = 'codemeta.json'

◆ METADATA_TPL_FILE

string carputils.bundle.metadata.METADATA_TPL_FILE = 'codemeta.json.tpl'