transient Package

Entities not persisted are to be defined here.

context_overlay

Entities to be used with an overlay on Operation or DataType, are defined here.

class tvb.core.entities.transient.context_overlay.CommonDetails[source]

Bases: EnhancedDictionary

Enhanced dictionary holding details about an entity. It also contains metadata on how this details will be displayed in UI (disabled/readonly/hidden input field).

CODE_GID = 'gid'
CODE_OPERATION_GROUP_ID = 'operation_group_id'
CODE_OPERATION_GROUP_NAME = 'operation_group_name'
CODE_OPERATION_TAG = 'operation_label'
add_scientific_fields(extra_fields_dict)[source]

:param extra_fields_dict a dictionary of fields to be added in a distinct category.

static compute_operation_name(category_name, algorithm_name)[source]

Compute Operation display name, based on Operation Category and Algorithm.

get_ui_fields()[source]
Returns:

list of dictionaries to be used for UI display. Each entry in the list will be displayed as a UI group of fields.

property meta_attributes_list

A list with all attributes for a DataType which are expected to be submitted from UI.

class tvb.core.entities.transient.context_overlay.DataTypeOverlayDetails[source]

Bases: CommonDetails

Entity used for displaying in an overlay details about a DataType.

DATA_STATE = 'data_state'
DATA_SUBJECT = 'subject'
DATA_TAG_1 = 'datatype_tag_1'
DATA_TAG_2 = 'datatype_tag_2'
DATA_TAG_3 = 'datatype_tag_3'
DATA_TAG_4 = 'datatype_tag_4'
DATA_TAG_5 = 'datatype_tag_5'
DATA_TITLE = 'datatype_title'
fill_from_datatype(datatype_result, parent_burst)[source]

Fill current dictionary with information from a loaded DB DataType. :param datatype_result DB loaded DataType :param parent_burst Burst entity in which current dataType was generated

class tvb.core.entities.transient.context_overlay.OperationOverlayDetails(operation, user_display_name, count_inputs, count_results, burst, no_of_op_in_group, op_pid)[source]

Bases: CommonDetails

Entity used for displaying in an overlay details about an operation.

range_parameter

class tvb.core.entities.transient.range_parameter.RangeParameter(name, type, range_definition=None, is_array=False, range_values=None)[source]

Bases: object

KEY_FLOAT_HI = 'hi'
KEY_FLOAT_LO = 'lo'
KEY_FLOAT_STEP = 'step'
fill_from_default(range_param: RangeParameter) None[source]
static from_json(range_json)[source]
get_range_values()[source]
to_json()[source]

structure_entities

class tvb.core.entities.transient.structure_entities.DataTypeMetaData(data=None, invalid=False)[source]

Bases: dict

This object will be populated from meta-data stored on a particular DataType/Operation. It should contain enough information, to restore a DataType entity, without DB previous data required.

DEFAULT_SUBJECT = 'John Doe'
KEY_AUTHOR = 'Source_Author'
KEY_BURST = 'Burst_Reference'
KEY_CLASS_NAME = 'Type'
KEY_COUNT = 'count'
KEY_CREATE_DATA_DAY = 'createDataDay'
KEY_CREATE_DATA_MONTH = 'createDataMonth'
KEY_DATATYPE_ID = 'Datatypeid'
KEY_DATE = 'create_date'
KEY_FK_OPERATION_GROUP = 'fk_operation_group'
KEY_GID = 'Gid'
KEY_INVALID = 'datatype_invalid'
KEY_MODULE = 'Module'
KEY_NODE_TYPE = 'DataType'
KEY_OPERATION_ALGORITHM = 'Operation_Algorithm'
KEY_OPERATION_GROUP_NAME = 'op_group_name'
KEY_OPERATION_TAG = 'user_group'
KEY_OPERATION_TYPE = 'Source_Operation_Category'
KEY_OP_GROUP_ID = 'groupId'
KEY_RELEVANCY = 'Relevant'
KEY_STATE = 'Data_State'
KEY_SUBJECT = 'Data_Subject'
KEY_TAG_1 = 'User_Tag_1_Perpetuated'
KEY_TAG_2 = 'User_Tag_2'
KEY_TAG_3 = 'User_Tag_3'
KEY_TAG_4 = 'User_Tag_4'
KEY_TAG_5 = 'User_Tag_5'
KEY_TITLE = 'title'
STATES = {'FINAL': 'Final', 'INTERMEDIATE': 'Intermediate', 'RAW_DATA': 'Raw Data'}
property create_date

Return the create date of this entity, if stored, or None otherwise.

classmethod get_filterable_meta()[source]

Contains all the attributes by which the user can structure the tree of DataTypes.

All the returned attributes should exists into the ‘data’ field of its corresponding DataTypeMetaData object.

property gid
Returns:

current Global Identifier or None.

property group

Return the group tag in which the operation was launched

mark_invalid()[source]

Mark current meta-data as invalid. e.g. Because of a missing associated file.

merge_data(new_data)[source]

Update current state, from an external dictionary.

property subject

Return the name of the Subject if defined, or Default “John Doe”.

class tvb.core.entities.transient.structure_entities.StructureNode(nid, node_name, ntype='Folder', meta=None, children=None)[source]

Bases: object

This entity represents a node in the Tree of a Project related Structure.

PREFIX_ID_LEAF = 'leaf_'
PREFIX_ID_NODE = 'node_'
PREFIX_ID_PROJECT = 'projectID'
SEP = '__'
TYPE_FILE = 'File'
TYPE_FOLDER = 'Folder'
TYPE_INVALID = 'Invalid'
property has_children

Return TRUE when current node is with Child nodes. Return FALSE when current node is a leaf in Tree.

property is_group

Check if meta_data has the transient is_link attribute set.

property is_irelevant

Check that current node is marked as not-relevant.

Check if meta_data has the transient is_link attribute set.

static metadata2tree(metadatas, first_level, second_level, project_id, project_name)[source]

Take a list of DataTypeMetaData entities as input. Create a tree of StructureNode entities, then convert it in JSON to display in UI.

first_level and second_level represents the fields by which should be structured the tree. Those fields should exists into the data dict of each DataTypeMetaData object.

property type

Type of a node it can be FOLDER, FILE or INVALID.