Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: [cog-1089] Define pydantic models for descriptive graph metrics and input metrics #466

Merged
merged 9 commits into from
Jan 28, 2025
27 changes: 27 additions & 0 deletions cognee/modules/data/models/MetricData.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from datetime import datetime, timezone

from sqlalchemy import Column, DateTime, Float, Integer, ARRAY, UUID

from cognee.infrastructure.databases.relational import Base
from uuid import uuid4


class GraphMetricData(Base):
__tablename__ = "graph_metric_table"
alekszievr marked this conversation as resolved.
Show resolved Hide resolved

alekszievr marked this conversation as resolved.
Show resolved Hide resolved
# TODO: Change ID to reflect unique id of graph database
id = Column(UUID, primary_key=True, default=uuid4)
num_tokens = Column(Integer)
num_nodes = Column(Integer)
num_edges = Column(Integer)
mean_degree = Column(Float)
edge_density = Column(Float)
num_connected_components = Column(Integer)
sizes_of_connected_components = Column(ARRAY(Integer))
num_selfloops = Column(Integer, nullable=True)
diameter = Column(Integer, nullable=True)
avg_shortest_path_length = Column(Float, nullable=True)
avg_clustering = Column(Float, nullable=True)
alekszievr marked this conversation as resolved.
Show resolved Hide resolved

created_at = Column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc))
updated_at = Column(DateTime(timezone=True), onupdate=lambda: datetime.now(timezone.utc))
Loading