cerebralcortex.core.metadata_manager.stream package¶
Submodules¶
cerebralcortex.core.metadata_manager.stream.data_descriptor module¶
-
class
DataDescriptor
[source]¶ Bases:
object
-
from_json
(obj)[source]¶ Cast DataDescriptor class object into json
Parameters: obj (DataDescriptor) – object of a data descriptor class Returns: Return type: self
-
set_attribute
(key, value)[source]¶ Attributes field is option in metadata object. Arbitrary number or attributes could be attached to a DataDescriptor
Parameters: - key (str) – key of an attribute
- value (str) – value of an attribute
Returns: Return type: self
Raises: ValueError
– if key/value are missing
-
cerebralcortex.core.metadata_manager.stream.metadata module¶
-
class
Metadata
[source]¶ Bases:
object
-
add_annotation
(annotation: str)[source]¶ Add annotation stream name
Parameters: annotation (str) – name of annotation or list of strings Returns: self
-
add_dataDescriptor
(dd: cerebralcortex.core.metadata_manager.stream.data_descriptor.DataDescriptor)[source]¶ Add data description of a stream
Parameters: dd (DataDescriptor) – data descriptor Returns: self
-
add_input_stream
(input_stream: str)[source]¶ Add input streams that were used to derive a new stream
Parameters: input_stream (str) – name of input stream OR list of input_stream names Returns: self
-
add_module
(mod: cerebralcortex.core.metadata_manager.stream.module_info.ModuleMetadata)[source]¶ Add module metadata
Parameters: mod (ModuleMetadata) – module metadata Returns: self
-
from_json_file
(metadata: dict) → List[source]¶ Convert dict (json) objects into Metadata class objects
Parameters: dict (json_list) – metadata dict Returns: metadata class object Return type: Metadata
-
from_json_sql
(metadata_json: dict) → List[source]¶ Convert dict (json) objects into Metadata class objects
Parameters: dict (json_list) – metadata dict Returns: metadata class object Return type: Metadata
-
get_dataDescriptor
(name)[source]¶ get data descriptor by name
Parameters: name (str) – Returns: DataDescriptor object
-
get_hash
() → str[source]¶ Get the unique hash of metadata. Hash is generated based on “stream-name + data_descriptor + module-metadata”
Returns: hash id of metadata Return type: str
-
get_hash_by_json
(metadata: dict = None) → str[source]¶ Get the unique hash of metadata. Hash is generated based on “stream-name + data_descriptor + module-metadata”
Parameters: metadata – only pass this if this method is used on a dict object outside of Metadata class Returns: hash id of metadata Return type: str
-
is_valid
() → bool[source]¶ check whether all required fields are set
Returns: True if fields are set or throws an exception in case of missing values Return type: bool - Exception:
- ValueError: if metadata fields are not set
-
set_description
(stream_description: str)[source]¶ Add stream description
Parameters: stream_description (str) – textual description of a stream Returns: self
-
cerebralcortex.core.metadata_manager.stream.module_info module¶
-
class
ModuleMetadata
[source]¶ Bases:
object
-
from_json
(obj)[source]¶ Cast ModuleMetadata class object into json
Parameters: obj (ModuleMetadata) – object of a ModuleMetadata class Returns: Return type: self
-
set_attribute
(key: str, value: str)[source]¶ Attributes field is option in metadata object. Arbitrary number or attributes could be attached to a DataDescriptor
Parameters: - key (str) – key of an attribute
- value (str) – value of an attribute
Returns: Return type: self
Raises: ValueError
– if key/value are missing
set author key/value pair. For example, key=name, value=md2k
Parameters: - key (str) – author metadata key
- value (str) – author metadata value
Returns: Return type: self
set author key/value pair. For example, key=name, value=md2k
Parameters: authors (list[dict]) – List of authors names and emails ids in dict. For example, authors = [{“ali”:”ali@gmail.com”}, {“nasir”:”nasir@gmail.com”}] Returns: Return type: self
-
Module contents¶
-
class
Metadata
[source]¶ Bases:
object
-
add_annotation
(annotation: str)[source]¶ Add annotation stream name
Parameters: annotation (str) – name of annotation or list of strings Returns: self
-
add_dataDescriptor
(dd: cerebralcortex.core.metadata_manager.stream.data_descriptor.DataDescriptor)[source]¶ Add data description of a stream
Parameters: dd (DataDescriptor) – data descriptor Returns: self
-
add_input_stream
(input_stream: str)[source]¶ Add input streams that were used to derive a new stream
Parameters: input_stream (str) – name of input stream OR list of input_stream names Returns: self
-
add_module
(mod: cerebralcortex.core.metadata_manager.stream.module_info.ModuleMetadata)[source]¶ Add module metadata
Parameters: mod (ModuleMetadata) – module metadata Returns: self
-
from_json_file
(metadata: dict) → List[source]¶ Convert dict (json) objects into Metadata class objects
Parameters: dict (json_list) – metadata dict Returns: metadata class object Return type: Metadata
-
from_json_sql
(metadata_json: dict) → List[source]¶ Convert dict (json) objects into Metadata class objects
Parameters: dict (json_list) – metadata dict Returns: metadata class object Return type: Metadata
-
get_dataDescriptor
(name)[source]¶ get data descriptor by name
Parameters: name (str) – Returns: DataDescriptor object
-
get_hash
() → str[source]¶ Get the unique hash of metadata. Hash is generated based on “stream-name + data_descriptor + module-metadata”
Returns: hash id of metadata Return type: str
-
get_hash_by_json
(metadata: dict = None) → str[source]¶ Get the unique hash of metadata. Hash is generated based on “stream-name + data_descriptor + module-metadata”
Parameters: metadata – only pass this if this method is used on a dict object outside of Metadata class Returns: hash id of metadata Return type: str
-
is_valid
() → bool[source]¶ check whether all required fields are set
Returns: True if fields are set or throws an exception in case of missing values Return type: bool - Exception:
- ValueError: if metadata fields are not set
-
set_description
(stream_description: str)[source]¶ Add stream description
Parameters: stream_description (str) – textual description of a stream Returns: self
-
-
class
DataDescriptor
[source]¶ Bases:
object
-
from_json
(obj)[source]¶ Cast DataDescriptor class object into json
Parameters: obj (DataDescriptor) – object of a data descriptor class Returns: Return type: self
-
set_attribute
(key, value)[source]¶ Attributes field is option in metadata object. Arbitrary number or attributes could be attached to a DataDescriptor
Parameters: - key (str) – key of an attribute
- value (str) – value of an attribute
Returns: Return type: self
Raises: ValueError
– if key/value are missing
-
-
class
ModuleMetadata
[source]¶ Bases:
object
-
from_json
(obj)[source]¶ Cast ModuleMetadata class object into json
Parameters: obj (ModuleMetadata) – object of a ModuleMetadata class Returns: Return type: self
-
set_attribute
(key: str, value: str)[source]¶ Attributes field is option in metadata object. Arbitrary number or attributes could be attached to a DataDescriptor
Parameters: - key (str) – key of an attribute
- value (str) – value of an attribute
Returns: Return type: self
Raises: ValueError
– if key/value are missing
set author key/value pair. For example, key=name, value=md2k
Parameters: - key (str) – author metadata key
- value (str) – author metadata value
Returns: Return type: self
set author key/value pair. For example, key=name, value=md2k
Parameters: authors (list[dict]) – List of authors names and emails ids in dict. For example, authors = [{“ali”:”ali@gmail.com”}, {“nasir”:”nasir@gmail.com”}] Returns: Return type: self
-