noctis.data_architecture.datacontainer.DataContainer

pydantic model noctis.data_architecture.datacontainer.DataContainer[source]

A container for managing and transforming chemical equation data.

DataContainer is a collection of GraphRecord objects with methods for managing records and transforming data into various formats.

Attributes:

records (list[GraphRecord]): List of GraphRecord objects. ce_label (str): Label for chemical equations (default: settings.nodes.node_chemequation).

Methods:

add_record(record): Add a GraphRecord to the container. get_record(record_key): Retrieve a specific GraphRecord. get_records(record_keys): Retrieve multiple GraphRecords. get_subcontainer_with_records(record_keys): Create a new DataContainer with specified records. transform_to(format_type, with_record_id, ce_label): Transform data to specified format.

Note:

DataContainer objects can be compared for equality using the == operator.

Show JSON schema
{
   "title": "DataContainer",
   "description": "A container for managing and transforming chemical equation data.\n\nDataContainer is a collection of GraphRecord objects with methods for\nmanaging records and transforming data into various formats.\n\nAttributes:\n    records (list[GraphRecord]): List of GraphRecord objects.\n    ce_label (str): Label for chemical equations (default: settings.nodes.node_chemequation).\n\nMethods:\n    add_record(record): Add a GraphRecord to the container.\n    get_record(record_key): Retrieve a specific GraphRecord.\n    get_records(record_keys): Retrieve multiple GraphRecords.\n    get_subcontainer_with_records(record_keys): Create a new DataContainer with specified records.\n    transform_to(format_type, with_record_id, ce_label): Transform data to specified format.\n\nNote:\n    DataContainer objects can be compared for equality using the == operator.",
   "type": "object",
   "properties": {
      "records": {
         "items": {
            "$ref": "#/$defs/GraphRecord"
         },
         "title": "Records",
         "type": "array"
      },
      "ce_label": {
         "default": "ChemicalEquation",
         "title": "Ce Label",
         "type": "string"
      }
   },
   "$defs": {
      "GraphRecord": {
         "description": "Represents a record of nodes and relationships forming a graph.",
         "properties": {
            "nodes": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/Node"
               },
               "title": "Nodes",
               "type": "array"
            },
            "relationships": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/Relationship"
               },
               "title": "Relationships",
               "type": "array"
            }
         },
         "title": "GraphRecord",
         "type": "object"
      },
      "Node": {
         "description": "Represents a node in a graph with a unique identifier and optional properties.",
         "properties": {
            "node_label": {
               "pattern": "^[A-Z][\\w\\-]*$",
               "title": "Node Label",
               "type": "string"
            },
            "uid": {
               "pattern": "^[A-Z]{0,3}{1,2}\\d+$",
               "title": "Uid",
               "type": "string"
            },
            "properties": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Properties"
            }
         },
         "required": [
            "node_label",
            "uid"
         ],
         "title": "Node",
         "type": "object"
      },
      "Relationship": {
         "description": "Represents a relationship between two nodes in a graph.",
         "properties": {
            "relationship_type": {
               "pattern": "^[A-Z\\d_-]+$",
               "title": "Relationship Type",
               "type": "string"
            },
            "start_node": {
               "$ref": "#/$defs/Node"
            },
            "end_node": {
               "$ref": "#/$defs/Node"
            },
            "properties": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Properties"
            }
         },
         "required": [
            "relationship_type",
            "start_node",
            "end_node"
         ],
         "title": "Relationship",
         "type": "object"
      }
   }
}

Fields:
field ce_label: str = 'ChemicalEquation'
field records: list[GraphRecord] [Optional]
add_record(record: GraphRecord) None[source]

To add a GraphRecord to a DataContainer

get_record(record_key: int) GraphRecord[source]
get_records(record_keys: list[int]) list[GraphRecord][source]
get_subcontainer_with_records(record_keys: list[int]) DataContainer[source]
classmethod info() str[source]

Return detailed information about registered generators, reaction formats, and usage.

set_ce_label(ce_label: str) None[source]
transform_to(format_type: str, with_record_id: bool | None = True, ce_label: str | None = None)[source]