-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathgaia.py
More file actions
62 lines (47 loc) · 2.53 KB
/
gaia.py
File metadata and controls
62 lines (47 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from typing import List
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from api import db
class Genes(db.Model):
__bind_key__ = "gaia"
__tablename__ = "genes"
id: db.Mapped[int] = db.mapped_column(db.Integer, nullable=False, primary_key=True)
species: db.Mapped[str] = db.mapped_column(db.String(64), nullable=False)
locus: db.Mapped[str] = db.mapped_column(db.String(64), nullable=True)
geneid: db.Mapped[str] = db.mapped_column(db.String(32), nullable=True)
children: db.Mapped[List["Aliases"]] = relationship()
class Aliases(db.Model):
__bind_key__ = "gaia"
__tablename__ = "aliases"
id: db.Mapped[int] = db.mapped_column(db.Integer, nullable=False, primary_key=True)
genes_id: db.Mapped[int] = db.mapped_column(ForeignKey("genes.id", ondelete="CASCADE"), nullable=False)
alias: db.Mapped[str] = db.mapped_column(db.String(256), nullable=False)
class PublicationFigures(db.Model):
__bind_key__ = "gaia"
__tablename__ = "publication_figures"
id: db.Mapped[int] = db.mapped_column(db.Integer, nullable=False, primary_key=True)
title: db.Mapped[str] = db.mapped_column(db.String(512), nullable=True)
abstract: db.Mapped[str] = db.mapped_column(db.Text, nullable=True)
children: db.Mapped[List["PubIds"]] = relationship()
children: db.Mapped[List["Figures"]] = relationship()
class PubIds(db.Model):
__bind_key__ = "gaia"
__tablename__ = "pub_ids"
id: db.Mapped[int] = db.mapped_column(db.Integer, nullable=False, primary_key=True)
publication_figures_id: db.Mapped[int] = db.mapped_column(db.Integer, nullable=False)
publication_figures_id: db.Mapped[int] = db.mapped_column(
ForeignKey("publication_figures.id", ondelete="CASCADE"), nullable=False
)
pubmed: db.Mapped[str] = db.mapped_column(db.String(16), nullable=True)
pmc: db.Mapped[str] = db.mapped_column(db.String(16), nullable=True)
class Figures(db.Model):
__bind_key__ = "gaia"
__tablename__ = "figures"
id: db.Mapped[int] = db.mapped_column(db.Integer, nullable=False, primary_key=True)
publication_figures_id: db.Mapped[int] = db.mapped_column(db.Integer, nullable=False)
publication_figures_id: db.Mapped[int] = db.mapped_column(
ForeignKey("publication_figures.id", ondelete="CASCADE"), nullable=False
)
img_name: db.Mapped[str] = db.mapped_column(db.String(64), nullable=False)
caption: db.Mapped[str] = db.mapped_column(db.Text, nullable=True)
img_url: db.Mapped[str] = db.mapped_column(db.String(256), nullable=True)