2020-04-14 02:01:44 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
from .db import db
|
|
|
|
from sqlalchemy.sql import func
|
2020-04-14 13:48:11 +02:00
|
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
|
|
import uuid
|
2020-07-28 20:19:52 +02:00
|
|
|
import enum
|
2020-04-14 02:01:44 +02:00
|
|
|
|
2020-10-01 19:38:34 +02:00
|
|
|
|
2020-07-28 20:19:52 +02:00
|
|
|
class AIModelType(enum.Enum):
|
2020-10-02 03:28:40 +02:00
|
|
|
# Optimally this would be upper case (as a convention for enums) But we want this to be the same as in the url schema
|
|
|
|
svm = 1
|
|
|
|
cnn = 2
|
2020-04-14 02:01:44 +02:00
|
|
|
|
2020-10-01 19:38:34 +02:00
|
|
|
|
2020-04-14 13:48:11 +02:00
|
|
|
class AIModel(db.Model):
|
|
|
|
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4, unique=True, nullable=False)
|
2020-04-14 02:01:44 +02:00
|
|
|
timestamp = db.Column(db.TIMESTAMP, nullable=False, server_default=func.now())
|
|
|
|
|
2020-07-28 20:19:52 +02:00
|
|
|
type = db.Column(db.Enum(AIModelType), nullable=False)
|
2020-10-01 19:38:34 +02:00
|
|
|
|
|
|
|
target_class_name = db.Column(db.String(50), nullable=False)
|