hestia_earth.calculation.representation.DataStore¶
-
class
hestia_earth.calculation.representation.DataStore[source]¶ Bases:
objectMethods
Method that checks if two the node is using the most recent version of the schema.
Method that eliminates the non-used fields of the emissions output nodes dictionaries.
Method that crawls nodes looking for empty fields.
Method that converts all the EngineDict in a cycle to dictionaries.
Method that converts all the dictionaries in a cycle to EngineDict.
Method that converts an EngineDict to a dictionary if it is an EngineDict, or a list (or elist) of EngingeDicts to a list of dictionaries. If it is not a dictionary or a collection of dictionaries returns the object itself. Arguments: object: The object to be converted to dictionary. Returns the object converted to dictionary or the object otherwise.
Method that converts a key of a node (that is a dictionary) into a list defined in Hestia’s Schema.
Method that converts a dictionary to an EngineDict if it is a dictionary, or a list of dictionaries to a list of EngineDicts. If it is not a dictionary or a collection of dictionaries returns the object itself. Arguments: object: The object to be converted to EngineDict. Returns the object converted to EngineDict or the object otherwise.
Method that converts a subkey of a node (that is a dictionary) into a list defined in Hestia’s Schema.
Method that converts a key of the subnodes of a node (that are lists) into a dictionary to easily access data. Arguments: node: A Hestia node key: A key of the subnodes Returns nothing.
Method that converts a subkey of the subnodes of a node (that are lists) into a dictionary to easily access data. Arguments: node: A Hestia node key: A subkey of the subnodes Returns nothing.
Method that converts a subsubkey of the subnodes of a node (that are lists) into a dictionary to easily access data. Arguments: node: A Hestia node subkey: A subkey of the subnodes Returns nothing.
Method that converts a subsubkey of the subnodes of a node (that are lists) into a dictionary to easily access data. Arguments: node: A Hestia node subkey: A subkey of the subnodes subsubkey: A subsubkey of the subnodes Returns nothing.
Method that imports a jsonld file into the representation required to perform the Hestia calculations.
Method that exports the Engine representation into the Hestia Schema.
Method that imports a jsonld file into the representation required to perform the Hestia calculations.
Method that imports a jsonld file into the representation required to perform the Hestia calculations.
Method that inspects if non-used fields are present in a particular node.
Method that checks if two values are equal.
Method that saves the original data in the engine.
Method that saves the original data in the engine.
Method to convert all the nested dictionaries to EngineDict.
Method that updates the indicators with a recalculated impact assessment.
Method that updates the impact assessments of an assessment representation.
Method that updates a emission of the cycle representation :param emision: A node with the emission to update.
-
check_version(emission_versions)[source]¶ Method that checks if two the node is using the most recent version of the schema. :param emission_versions: The version of the the node to be checked.
Returns boolean.
-
clean(clean_fields, key)[source]¶ Method that eliminates the non-used fields of the emissions output nodes dictionaries. :param clean_fields: The dictionary where the field to be cleaned is in. :param key: the key of the field to be cleaned.
Returns nothind.
-
clean_crawler_fields(mobject)[source]¶ Method that crawls nodes looking for empty fields. :param mobject: The output emission node.
Returns a dictionary without the unused fields.
-
converter_crawler_dict(object)[source]¶ Method that converts all the EngineDict in a cycle to dictionaries. :param object: A Hestia cycle.
Returns a cycle where all the EngineDict are dictionaries.
-
converter_crawler_edict(object)[source]¶ Method that converts all the dictionaries in a cycle to EngineDict. :param object: A Hestia cycle.
Returns a cycle where all the dictionaries are EngineDict.
-
converter_dict(object)[source]¶ Method that converts an EngineDict to a dictionary if it is an EngineDict, or a list (or elist) of EngingeDicts to a list of dictionaries. If it is not a dictionary or a collection of dictionaries returns the object itself.
- Arguments:
object: The object to be converted to dictionary.
Returns the object converted to dictionary or the object otherwise.
-
converter_dict_to_list(node, key)[source]¶ Method that converts a key of a node (that is a dictionary) into a list defined in Hestia’s Schema. :param node: A Hestia node :param key: A key of the node
Returns nothing.
-
converter_edict(object)[source]¶ Method that converts a dictionary to an EngineDict if it is a dictionary, or a list of dictionaries to a list of EngineDicts. If it is not a dictionary or a collection of dictionaries returns the object itself.
- Arguments:
object: The object to be converted to EngineDict.
Returns the object converted to EngineDict or the object otherwise.
-
converter_list_to_dict(node, key)[source]¶ Method that converts a subkey of a node (that is a dictionary) into a list defined in Hestia’s Schema. :param node: A Hestia node :param key: A subkey of the node
Returns nothing.
-
converter_subdict_to_list(node, key)[source]¶ Method that converts a key of the subnodes of a node (that are lists) into a dictionary to easily access data.
- Arguments:
node: A Hestia node key: A key of the subnodes
Returns nothing.
-
converter_sublist_to_dict(node, key)[source]¶ Method that converts a subkey of the subnodes of a node (that are lists) into a dictionary to easily access data.
- Arguments:
node: A Hestia node key: A subkey of the subnodes
Returns nothing.
-
converter_subsubdict_to_list(node, subkey, subsubkey)[source]¶ Method that converts a subsubkey of the subnodes of a node (that are lists) into a dictionary to easily access data.
- Arguments:
node: A Hestia node subkey: A subkey of the subnodes
Returns nothing.
-
converter_subsublist_to_dict(node, subkey, subsubkey)[source]¶ Method that converts a subsubkey of the subnodes of a node (that are lists) into a dictionary to easily access data.
- Arguments:
node: A Hestia node subkey: A subkey of the subnodes subsubkey: A subsubkey of the subnodes
Returns nothing.
-
export_assessment()[source]¶ Method that imports a jsonld file into the representation required to perform the Hestia calculations. :param file: A jsonld file
Returns nothing.
-
export_cycle()[source]¶ Method that exports the Engine representation into the Hestia Schema. :param None:
Returns a dict representing the recalculated cycle.
-
import_assessment(assessment)[source]¶ Method that imports a jsonld file into the representation required to perform the Hestia calculations. :param file: A jsonld file
Returns nothing.
-
import_cycle(cycle, site=None)[source]¶ Method that imports a jsonld file into the representation required to perform the Hestia calculations. :param file: A jsonld file
Returns nothing.
-
inspect_field(clean_fields, key)[source]¶ Method that inspects if non-used fields are present in a particular node. :param clean_fields: The dictionary where the field to be cleaned is in. :param key: the key of the field to be cleaned.
Returns a dictionary without the unused fields.
-
is_different(original_list, calculated_list)[source]¶ Method that checks if two values are equal. :param original_list: The original list. :param calculated_list: The recalculated list.
Returns boolean.
-
save_original_assessment(assessment)[source]¶ Method that saves the original data in the engine. :param cycle: the original cycle :param site: the original site
Returns nothing.
-
save_original_cycle(cycle, site)[source]¶ Method that saves the original data in the engine. :param cycle: the original cycle :param site: the original site
Returns nothing.
-
trasnform_engine_dict(representation)[source]¶ Method to convert all the nested dictionaries to EngineDict. :param key: a cycle representation
Returns a cycle representation with all the dictionaries converted to EngineDict.
-
update_indicators(assessment_new, key)[source]¶ Method that updates the indicators with a recalculated impact assessment. :param assessment_new: The new impact assessment with the new indicators.
Returns nothing.
-