class AnswerChoice(db.Model): __tablename__ = "answer_choice" id = db.Column(db.Integer, primary_key=True, autoincrement=True) question_id = db.Column(db.String(), db.ForeignKey('question.id')) answer = db.Column(db.String()) def __repr__(self): return '<answer: {}>'.format(self.answer)
class QuestionGenRequest(db.Model): __tablename__ = 'question_generation_request' id = db.Column(db.Integer, primary_key=True) url = db.Column(db.String()) questions = db.Column(JSON) question_type = db.Column(db.String()) def __repr__(self): return '<id {}'.format(self.id)
class NewsArticle(db.Model): __tablename__ = 'news_article' id = db.Column(db.String(), primary_key=True) url = db.Column(db.String()) article_text = db.Column(db.Text()) domain = db.Column(db.String()) questions = db.relationship('Question', backref='news_article', lazy='dynamic')
class Score(db.Model): __tablename__ = 'score' id = db.Column('id', db.Integer, primary_key=True, autoincrement=True) name = db.Column('name', db.String(32)) subject = db.Column('subject', db.String(32)) score = db.Column('score', db.Integer) def __init__(self, name, subject, score): self.name = name self.subject = subject self.score = score
class US_Civilian_Unemployment_Rate(db.Model): __tablename__ = app.config.get( 'DATABASE_SCHEMA') + ".US_Civilian_Unemployment_Rate" __table_args__ = {'quote': False} observation_date = db.Column(db.Date, primary_key=True) unemployment_rate = db.Column(db.Float) def __init__(self, observation_date, unemployment_rate): self.observation_date = observation_date self.unemployment_rate = unemployment_rate def __repr__(self): return "<observation_date {}, unemployment_rate {}>".format( self.observation_date, self.unemployment_rate)
class Real_Gross_Domestic_Product(db.Model): __tablename__ = app.config.get( 'DATABASE_SCHEMA') + ".Real_Gross_Domestic_Product" __table_args__ = {'quote': False} observation_date = db.Column(db.Date, primary_key=True) rgdp_value = db.Column(db.Float) def __init__(self, observation_date, rgdp_value): self.observation_date = observation_date self.rgdp_value = rgdp_value def __repr__(self): return "<observation_date {}, rgdp_value {}>".format( self.observation_date, self.rgdp_value)
class University_of_Michigan_Customer_Sentiment_Index(db.Model): __tablename__ = app.config.get( 'DATABASE_SCHEMA') + ".University_of_Michigan_Customer_Sentiment_Index" __table_args__ = {'quote': False} observation_date = db.Column(db.Date, primary_key=True) sentiment_index = db.Column(db.Float) def __init__(self, observation_date, sentiment_index): self.observation_date = observation_date self.sentiment_index = sentiment_index def __repr__(self): return "<observation_date {}, sentiment_index {}>".format( self.observation_date, self.sentiment_index)
class Question(db.Model): __tablename__ = 'question' id = db.Column(db.String(), primary_key=True) question_text = db.Column(db.Text()) source_sentence = db.Column(db.Text()) answer_choices = db.relationship('AnswerChoice', backref='question', lazy='dynamic') correct_answer = db.Column(db.String()) # reactions = db.Column(ARRAY()) good_question_votes = db.Column(db.Integer) bad_question_votes = db.Column(db.Integer) news_article_id = db.Column(db.String(), db.ForeignKey('news_article.id'))
class Shop(db.Model): __tablename__ = 'shop' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(80), unique=True)