<commit_before>""" These classes define the ORM models to be used by sqlalchemy for the job tracker database """

import sqlalchemy
from sqlalchemy import Column, Integer, Text, ForeignKey, Boolean
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
from dataactcore.models.jobTrackerInterface import JobTrackerInterface


Base = declarative_base()


class FileType(Base):
    __tablename__ = "file_type"

    file_id = Column(Integer, primary_key=True)
    name = Column(Text)
    description = Column(Text)

class FieldType(Base):
    __tablename__ = "field_type"

    field_type_id = Column(Integer, primary_key=True)
    name = Column(Text)
    description = Column(Text)

class RuleType(Base):
    __tablename__ = "rule_type"

    rule_id = Column(Integer, primary_key=True)
    name = Column(Text)
    description = Column(Text)



class FileColumn(Base):
    __tablename__ = "file_columns"

    file_column_id = Column(Integer, primary_key=True)
    file_id = Column(Integer, ForeignKey("file_type.file_id"))
    file = relationship("FileType", uselist=False)
    field_types_id = Column(Integer, ForeignKey("field_type.field_type_id"))
    field_type = relationship("FieldType", uselist=False)
    name = Column(Text)
    description = Column(Text)
    required = Column(Boolean)


class Rule(Base):
    __tablename__ = "rule"
    rule_id = Column(Integer, primary_key=True)
    file_column_id = Column(Integer, ForeignKey("file_columns.file_column_id"))
    rule_type_id  = Column(Integer, ForeignKey("rule_type.rule_id"))
    rule_text_1 = Column(Text)
    rule_text_2 = Column(Text)
    description = Column(Text)
    rule_type = relationship("RuleType", uselist=False)
    file_column = relationship("FileColumn", uselist=False)<commit_msg>Fixed a bug with validation ORM<commit_after>""" These classes define the ORM models to be used by sqlalchemy for the job tracker database """

import sqlalchemy
from sqlalchemy import Column, Integer, Text, ForeignKey, Boolean
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
from dataactcore.models.jobTrackerInterface import JobTrackerInterface


Base = declarative_base()


class FileType(Base):
    __tablename__ = "file_type"

    file_id = Column(Integer, primary_key=True)
    name = Column(Text)
    description = Column(Text)

class FieldType(Base):
    __tablename__ = "field_type"

    field_type_id = Column(Integer, primary_key=True)
    name = Column(Text)
    description = Column(Text)

class RuleType(Base):
    __tablename__ = "rule_type"

    rule_type_id = Column(Integer, primary_key=True)
    name = Column(Text)
    description = Column(Text)



class FileColumn(Base):
    __tablename__ = "file_columns"

    file_column_id = Column(Integer, primary_key=True)
    file_id = Column(Integer, ForeignKey("file_type.file_id"))
    file = relationship("FileType", uselist=False)
    field_types_id = Column(Integer, ForeignKey("field_type.field_type_id"))
    field_type = relationship("FieldType", uselist=False)
    name = Column(Text)
    description = Column(Text)
    required = Column(Boolean)


class Rule(Base):
    __tablename__ = "rule"
    rule_id = Column(Integer, primary_key=True)
    file_column_id = Column(Integer, ForeignKey("file_columns.file_column_id"))
    rule_type_id  = Column(Integer, ForeignKey("rule_type.rule_type_id"))
    rule_text_1 = Column(Text)
    rule_text_2 = Column(Text)
    description = Column(Text)
    rule_type = relationship("RuleType", uselist=False)
    file_column = relationship("FileColumn", uselist=False)
{'fraction_non_alphanumeric': 0.09723756906077348, 'fraction_numerical': 0.0011049723756906078, 'mean_word_length': 4.9555921052631575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4109079', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1101, 'n_words': 252}