app.model.kpi_metrics module

class app.model.kpi_metrics.KpiMetrics(*, id=<factory>, created_at=<factory>, updated_at=<factory>, apiKey_used=None, oauth_user_id=None, day, totalRequests, successRate, avgLatencyMS, errorRate, activeUsers, retentionRate, avgInteractionsPerUser)[source]

Bases: BaseModel

Represents a KPI metrics entity.

Parameters:
  • id (Annotated[str, FieldInfoMetadata(primary_key=PydanticUndefined, nullable=PydanticUndefined, foreign_key=PydanticUndefined, ondelete=PydanticUndefined, unique=PydanticUndefined, index=PydanticUndefined, sa_type=UUID(), sa_column=PydanticUndefined, sa_column_args=PydanticUndefined, sa_column_kwargs={'primary_key': True, 'index': True})])

  • created_at (Annotated[datetime, FieldInfoMetadata(primary_key=PydanticUndefined, nullable=PydanticUndefined, foreign_key=PydanticUndefined, ondelete=PydanticUndefined, unique=PydanticUndefined, index=PydanticUndefined, sa_type=DateTime(timezone=True), sa_column=PydanticUndefined, sa_column_args=PydanticUndefined, sa_column_kwargs={'server_default': <sqlalchemy.sql.functions.now at 0x7fa8900484a0; now>})])

  • updated_at (Annotated[datetime, FieldInfoMetadata(primary_key=PydanticUndefined, nullable=PydanticUndefined, foreign_key=PydanticUndefined, ondelete=PydanticUndefined, unique=PydanticUndefined, index=PydanticUndefined, sa_type=DateTime(timezone=True), sa_column=PydanticUndefined, sa_column_args=PydanticUndefined, sa_column_kwargs={'server_default': <sqlalchemy.sql.functions.now at 0x7fa88fa2a840; now>, 'onupdate': <sqlalchemy.sql.functions.now at 0x7fa88fa2ad20; now>})])

  • apiKey_used (Annotated[str | None, FieldInfoMetadata(primary_key=PydanticUndefined, nullable=True, foreign_key=apikey.apiKey, ondelete=PydanticUndefined, unique=PydanticUndefined, index=PydanticUndefined, sa_type=PydanticUndefined, sa_column=PydanticUndefined, sa_column_args=PydanticUndefined, sa_column_kwargs=PydanticUndefined)])

  • oauth_user_id (Annotated[str | None, FieldInfoMetadata(primary_key=PydanticUndefined, nullable=True, foreign_key=oauthusers.provider_user_id, ondelete=PydanticUndefined, unique=PydanticUndefined, index=PydanticUndefined, sa_type=PydanticUndefined, sa_column=PydanticUndefined, sa_column_args=PydanticUndefined, sa_column_kwargs=PydanticUndefined)])

day

Day of the metrics period (e.g., 2021-01-01).

Type:

str

totalRequests

Total requests in the period.

Type:

int

successRate

Success rate of the requests.

Type:

float

avgLatencyMS

Average latency in ms.

Type:

float

errorRate

Error rate in percentage.

Type:

float

activeUsers

Number of active users in the period.

Type:

int

retentionRate

User retention rate.

Type:

float

avgInteractionsPerUser

Average number of interactions per user.

Type:

float

model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].