cs-models 0.0.804__py3-none-any.whl → 0.0.805__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cs-models might be problematic. Click here for more details.
- cs_models/resources/SmartDefGrid/__init__.py +0 -0
- cs_models/resources/SmartDefGrid/models.py +29 -0
- cs_models/resources/SmartDefGrid/schemas.py +52 -0
- cs_models/resources/SmartDefGridCell/__init__.py +0 -0
- cs_models/resources/SmartDefGridCell/models.py +45 -0
- cs_models/resources/SmartDefGridCell/schemas.py +39 -0
- cs_models/resources/SmartDefGridCellAnswer/__init__.py +0 -0
- cs_models/resources/SmartDefGridCellAnswer/models.py +38 -0
- cs_models/resources/SmartDefGridCellAnswer/schemas.py +23 -0
- cs_models/resources/SmartDefGridCellAnswerCitation/__init__.py +0 -0
- cs_models/resources/SmartDefGridCellAnswerCitation/models.py +21 -0
- cs_models/resources/SmartDefGridCellAnswerCitation/schemas.py +14 -0
- cs_models/resources/SmartDefGridCellQuestion/__init__.py +0 -0
- cs_models/resources/SmartDefGridCellQuestion/models.py +62 -0
- cs_models/resources/SmartDefGridCellQuestion/schemas.py +37 -0
- cs_models/resources/SmartDefGridCellValue/__init__.py +0 -0
- cs_models/resources/SmartDefGridCellValue/models.py +33 -0
- cs_models/resources/SmartDefGridCellValue/schemas.py +18 -0
- {cs_models-0.0.804.dist-info → cs_models-0.0.805.dist-info}/METADATA +1 -1
- {cs_models-0.0.804.dist-info → cs_models-0.0.805.dist-info}/RECORD +22 -4
- {cs_models-0.0.804.dist-info → cs_models-0.0.805.dist-info}/WHEEL +0 -0
- {cs_models-0.0.804.dist-info → cs_models-0.0.805.dist-info}/top_level.txt +0 -0
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, JSON
|
|
3
|
+
from sqlalchemy.orm import relationship
|
|
4
|
+
from ...database import Base
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SmartDefGridModel(Base):
|
|
8
|
+
"""
|
|
9
|
+
One extracted BlockNote table artifact.
|
|
10
|
+
You can link to your workbook/doc via source_* fields.
|
|
11
|
+
"""
|
|
12
|
+
__tablename__ = "smart_def_grids"
|
|
13
|
+
|
|
14
|
+
id = Column(String(36), primary_key=True) # table_id (uuid string)
|
|
15
|
+
workbook_id = Column(
|
|
16
|
+
Integer,
|
|
17
|
+
ForeignKey('workbooks.id'),
|
|
18
|
+
nullable=True,
|
|
19
|
+
)
|
|
20
|
+
source_block_id = Column(String(64), nullable=True) # BlockNote block id (if any)
|
|
21
|
+
|
|
22
|
+
outline_version = Column(Integer, nullable=False, default=1) # your normalize() version
|
|
23
|
+
outline_json = Column(JSON, nullable=False) # semantic outline payload
|
|
24
|
+
original_table_json = Column(JSON, nullable=False) # raw BlockNote table node (for rebuilds)
|
|
25
|
+
|
|
26
|
+
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
27
|
+
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
|
|
28
|
+
|
|
29
|
+
cells = relationship("SmartDefGridCellModel", back_populates="table", cascade="all, delete-orphan")
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from marshmallow import Schema, fields, validate
|
|
2
|
+
from ..SmartDefGridCell.schemas import SmartDefGridCellResourceSchema
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class SmartDefGridResourceSchema(Schema):
|
|
6
|
+
"""
|
|
7
|
+
The user-defined table artifact (aka 'SmartDefGrid' resource).
|
|
8
|
+
- id is your table_id (UUID string or int—your choice).
|
|
9
|
+
- outline_json/original_table_json can be dicts (preferred) or JSON strings if you’d rather store serialized blobs.
|
|
10
|
+
"""
|
|
11
|
+
not_blank = validate.Length(min=1, error="Field cannot be blank")
|
|
12
|
+
|
|
13
|
+
id = fields.String(dump_only=True) # table_id
|
|
14
|
+
workbook_id = fields.Integer(allow_none=True) # if you link to a workbook
|
|
15
|
+
source_block_id = fields.String(allow_none=True)
|
|
16
|
+
|
|
17
|
+
outline_version = fields.Integer(allow_none=True)
|
|
18
|
+
# prefer dicts; switch to fields.String if you store JSON-serialized strings
|
|
19
|
+
outline_json = fields.Raw(required=True)
|
|
20
|
+
original_table_json = fields.Raw(required=True)
|
|
21
|
+
|
|
22
|
+
# read-only expansion of cells
|
|
23
|
+
cells = fields.Nested(
|
|
24
|
+
SmartDefGridCellResourceSchema(exclude="smart_def_grid_id"),
|
|
25
|
+
many=True,
|
|
26
|
+
dump_only=True,
|
|
27
|
+
# if you strictly want to hide 'table_id' inside each cell in this view:
|
|
28
|
+
# exclude=("table_id",),
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
created_at = fields.DateTime(dump_only=True)
|
|
32
|
+
updated_at = fields.DateTime(dump_only=True)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class SmartDefGridDetailResourceSchema(Schema):
|
|
36
|
+
id = fields.String(dump_only=True)
|
|
37
|
+
workbook_id = fields.String(allow_none=True)
|
|
38
|
+
source_block_id = fields.String(allow_none=True)
|
|
39
|
+
outline_version = fields.Integer(allow_none=True)
|
|
40
|
+
outline_json = fields.Raw(required=True)
|
|
41
|
+
original_table_json = fields.Raw(required=True)
|
|
42
|
+
created_at = fields.DateTime(dump_only=True)
|
|
43
|
+
updated_at = fields.DateTime(dump_only=True)
|
|
44
|
+
|
|
45
|
+
cells = fields.Nested(
|
|
46
|
+
SmartDefGridCellResourceSchema(),
|
|
47
|
+
many=True,
|
|
48
|
+
dump_only=True,
|
|
49
|
+
# include answers inlined under latest_question if you like:
|
|
50
|
+
only=("table_id","cell_id","row","col","is_header","formatting_spec",
|
|
51
|
+
"latest_question","applied_value"),
|
|
52
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, JSON, Boolean, Index
|
|
3
|
+
from sqlalchemy.orm import relationship
|
|
4
|
+
from ...database import Base
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SmartDefGridCellModel(Base):
|
|
8
|
+
"""
|
|
9
|
+
One logical 'master' cell from the outline; the cell_id is stable.
|
|
10
|
+
Header cells exist too (is_header), in case you later want header questions.
|
|
11
|
+
"""
|
|
12
|
+
__tablename__ = "smart_def_grid_cells"
|
|
13
|
+
|
|
14
|
+
# Composite natural key (table_id, cell_id)
|
|
15
|
+
smart_def_grid_id = Column(Integer, ForeignKey("smart_def_grids.id", ondelete="CASCADE"), primary_key=True)
|
|
16
|
+
cell_id = Column(String(36), primary_key=True) # stable UUID you generated
|
|
17
|
+
|
|
18
|
+
# Positional metadata + spans help future reflow/debug, not needed at runtime for writeback
|
|
19
|
+
row = Column(Integer, nullable=False)
|
|
20
|
+
col = Column(Integer, nullable=False)
|
|
21
|
+
row_span = Column(Integer, nullable=False, default=1)
|
|
22
|
+
col_span = Column(Integer, nullable=False, default=1)
|
|
23
|
+
is_header = Column(Boolean, nullable=False, default=False)
|
|
24
|
+
|
|
25
|
+
header_path_row = Column(JSON, nullable=False, default=list) # ["Efficacy (vs PBO)", "Clinical Remission"]
|
|
26
|
+
header_path_col = Column(JSON, nullable=False, default=list) # ["Humira"] etc.
|
|
27
|
+
|
|
28
|
+
# Formatting guidance to apply when writing display strings
|
|
29
|
+
formatting_spec = Column(JSON, nullable=True)
|
|
30
|
+
|
|
31
|
+
# Optional: cache of the latest generated question id
|
|
32
|
+
latest_question_id = Column(String(36), ForeignKey("cell_questions.id"), nullable=True)
|
|
33
|
+
|
|
34
|
+
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
35
|
+
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
|
|
36
|
+
|
|
37
|
+
table = relationship("SmartDefGridModel", back_populates="cells")
|
|
38
|
+
latest_question = relationship("SmartDefGridCellQuestionModel", foreign_keys=[latest_question_id], uselist=False)
|
|
39
|
+
|
|
40
|
+
# Canonical applied cell value (write-back)
|
|
41
|
+
applied_value = relationship("SmartDefGridCellValueModel", back_populates="cell", uselist=False, cascade="all, delete-orphan")
|
|
42
|
+
|
|
43
|
+
__table_args__ = (
|
|
44
|
+
Index("ix_smart_def_grid_cells_header", "smart_def_grid_id", "is_header"),
|
|
45
|
+
)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from marshmallow import Schema, fields, validate
|
|
2
|
+
from ..SmartDefGridCellQuestion.schemas import SmartDefGridCellQuestionResourceSchema
|
|
3
|
+
from ..SmartDefGridCellValue.schemas import SmartDefGridCellValueResourceSchema
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SmartDefGridCellResourceSchema(Schema):
|
|
7
|
+
"""
|
|
8
|
+
One logical (master) cell from the user-defined table.
|
|
9
|
+
"""
|
|
10
|
+
not_blank = validate.Length(min=1, error="Field cannot be blank")
|
|
11
|
+
|
|
12
|
+
smart_def_grid_id = fields.Integer(required=True)
|
|
13
|
+
cell_id = fields.String(required=True)
|
|
14
|
+
|
|
15
|
+
row = fields.Integer(required=True)
|
|
16
|
+
col = fields.Integer(required=True)
|
|
17
|
+
row_span = fields.Integer(required=True, data_key="rowSpan")
|
|
18
|
+
col_span = fields.Integer(required=True, data_key="colSpan")
|
|
19
|
+
is_header = fields.Boolean(required=True)
|
|
20
|
+
|
|
21
|
+
header_path_row = fields.List(fields.String(), required=True, data_key="headerPathRow")
|
|
22
|
+
header_path_col = fields.List(fields.String(), required=True, data_key="headerPathCol")
|
|
23
|
+
|
|
24
|
+
formatting_spec = fields.Raw(allow_none=True, data_key="formattingSpec")
|
|
25
|
+
|
|
26
|
+
latest_question_id = fields.String(allow_none=True)
|
|
27
|
+
created_at = fields.DateTime(dump_only=True)
|
|
28
|
+
updated_at = fields.DateTime(dump_only=True)
|
|
29
|
+
|
|
30
|
+
# optional, read-only projections
|
|
31
|
+
latest_question = fields.Nested(
|
|
32
|
+
SmartDefGridCellQuestionResourceSchema(),
|
|
33
|
+
dump_only=True,
|
|
34
|
+
exclude=("answers",),
|
|
35
|
+
)
|
|
36
|
+
applied_value = fields.Nested(
|
|
37
|
+
SmartDefGridCellValueResourceSchema(),
|
|
38
|
+
dump_only=True,
|
|
39
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from sqlalchemy import Column, DateTime, ForeignKey, Float, String, JSON, Integer, Index, Text
|
|
4
|
+
from sqlalchemy.orm import relationship
|
|
5
|
+
from ...database import Base
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SmartDefGridCellAnswerModel(Base):
|
|
9
|
+
"""
|
|
10
|
+
Answers emitted by workers. Keep multiple rows per question (retries, models).
|
|
11
|
+
"""
|
|
12
|
+
__tablename__ = "smart_def_grid_cell_answers"
|
|
13
|
+
|
|
14
|
+
id = Column(String(36), primary_key=True) # answer_id (uuid)
|
|
15
|
+
question_id = Column(Integer, ForeignKey("smart_def_grid_cell_questions.id", ondelete="CASCADE"), nullable=False)
|
|
16
|
+
|
|
17
|
+
smart_def_grid_id = Column(Integer, ForeignKey("smart_def_grids.id", ondelete="CASCADE"), nullable=False)
|
|
18
|
+
cell_id = Column(String(36), nullable=False)
|
|
19
|
+
|
|
20
|
+
# canonical payload
|
|
21
|
+
raw_value = Column(Float, nullable=True) # numeric scalar (if any)
|
|
22
|
+
text_value = Column(Text, nullable=True) # string/summary
|
|
23
|
+
display_text = Column(Text, nullable=True) # preformatted; writeback may still reformat
|
|
24
|
+
citations = Column(JSON, nullable=True) # list of {url|doi|title|snippet|...}
|
|
25
|
+
extra_payload = Column(JSON, nullable=True) # any provider-specific structure
|
|
26
|
+
|
|
27
|
+
# provenance
|
|
28
|
+
provider = Column(String(64), nullable=True) # e.g., "gpt-4.1"
|
|
29
|
+
provider_meta = Column(JSON, nullable=True) # tokens, latency, etc.
|
|
30
|
+
|
|
31
|
+
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
32
|
+
|
|
33
|
+
# convenience index to quickly get latest by created_at
|
|
34
|
+
__table_args__ = (
|
|
35
|
+
Index("ix_smart_def_grid_cell_answers_cell", "smart_def_grid_id", "cell_id", "created_at"),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
question = relationship("SmartDefGridCellQuestionModel", back_populates="answers")
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from marshmallow import Schema, fields
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class SmartDefGridCellAnswerResourceSchema(Schema):
|
|
5
|
+
id = fields.String(dump_only=True)
|
|
6
|
+
question_id = fields.Integer(required=True)
|
|
7
|
+
smart_def_grid_id = fields.Integer(required=True)
|
|
8
|
+
cell_id = fields.String(required=True)
|
|
9
|
+
|
|
10
|
+
raw_value = fields.Float(allow_none=True)
|
|
11
|
+
text_value = fields.String(allow_none=True)
|
|
12
|
+
display_text = fields.String(allow_none=True)
|
|
13
|
+
|
|
14
|
+
citations = fields.Raw(allow_none=True) # list/dict (or keep normalized rows separately)
|
|
15
|
+
extra_payload = fields.Raw(allow_none=True) # provider-specific data
|
|
16
|
+
|
|
17
|
+
provider = fields.String(allow_none=True)
|
|
18
|
+
provider_meta = fields.Raw(allow_none=True)
|
|
19
|
+
|
|
20
|
+
created_at = fields.DateTime(dump_only=True)
|
|
21
|
+
|
|
22
|
+
# if you materialize normalized citations, expose them here:
|
|
23
|
+
# citations_rel = fields.Nested(AnswerCitationResourceSchema, many=True, dump_only=True)
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from sqlalchemy import Column, DateTime, ForeignKey, String, JSON, Integer, Index, Text, BigInteger
|
|
2
|
+
from ...database import Base
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class SmartDefGridCellAnswerCitationModel(Base):
|
|
6
|
+
__tablename__ = "smart_def_grid_cell_answer_citations"
|
|
7
|
+
|
|
8
|
+
id = Column(BigInteger, primary_key=True, autoincrement=True)
|
|
9
|
+
answer_id = Column(Integer, ForeignKey("smart_def_grid_cell_answers.id", ondelete="CASCADE"), nullable=False)
|
|
10
|
+
|
|
11
|
+
source_type = Column(String(16), nullable=True) # 'url','doi','patent','pubmed'
|
|
12
|
+
source_id = Column(String(256), nullable=True) # doi, pubmed id, etc.
|
|
13
|
+
url = Column(Text, nullable=True)
|
|
14
|
+
title = Column(Text, nullable=True)
|
|
15
|
+
snippet = Column(Text, nullable=True)
|
|
16
|
+
published_at = Column(DateTime, nullable=True)
|
|
17
|
+
extra = Column(JSON, nullable=True)
|
|
18
|
+
|
|
19
|
+
__table_args__ = (
|
|
20
|
+
Index("ix_smart_def_grid_cell_answer_citations_source", "source_type", "source_id"),
|
|
21
|
+
)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from marshmallow import Schema, fields, validate
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class SmartDefGridCellAnswerCitationResourceSchema(Schema):
|
|
5
|
+
id = fields.Integer(dump_only=True)
|
|
6
|
+
answer_id = fields.Integer(required=True)
|
|
7
|
+
|
|
8
|
+
source_type = fields.String(allow_none=True)
|
|
9
|
+
source_id = fields.String(allow_none=True)
|
|
10
|
+
url = fields.String(allow_none=True)
|
|
11
|
+
title = fields.String(allow_none=True)
|
|
12
|
+
snippet = fields.String(allow_none=True)
|
|
13
|
+
published_at = fields.DateTime(allow_none=True)
|
|
14
|
+
extra = fields.Raw(allow_none=True) # any additional normalized payload
|
|
File without changes
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, JSON, Boolean, Index, Text, Enum
|
|
4
|
+
from sqlalchemy.orm import relationship
|
|
5
|
+
from ...database import Base
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class QuestionStatus(str, enum.Enum):
|
|
9
|
+
pending = "pending" # created, not enqueued yet
|
|
10
|
+
queued = "queued" # sent to your queue
|
|
11
|
+
running = "running" # worker picked it up
|
|
12
|
+
succeeded = "succeeded" # at least one answer persisted
|
|
13
|
+
failed = "failed" # irrecoverable error (manual retry/override)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ExpectedType(str, enum.Enum):
|
|
17
|
+
number = "number"
|
|
18
|
+
text = "text"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class SmartDefGridCellQuestionModel(Base):
|
|
22
|
+
"""
|
|
23
|
+
One question per cell (you may create new ones on re-ask/revision).
|
|
24
|
+
"""
|
|
25
|
+
__tablename__ = "smart_def_grid_cell_questions"
|
|
26
|
+
|
|
27
|
+
id = Column(Integer, primary_key=True) # question_id (uuid)
|
|
28
|
+
smart_def_grid_id = Column(Integer, ForeignKey("smart_def_grids.id", ondelete="CASCADE"), nullable=False)
|
|
29
|
+
cell_id = Column(String(36), nullable=False)
|
|
30
|
+
|
|
31
|
+
question_text = Column(Text, nullable=False)
|
|
32
|
+
expected_type = Column(Enum(ExpectedType), nullable=False)
|
|
33
|
+
must_cite = Column(Boolean, nullable=False, default=True)
|
|
34
|
+
|
|
35
|
+
topic_key = Column(JSON, nullable=True)
|
|
36
|
+
retrieval_hints = Column(JSON, nullable=True)
|
|
37
|
+
|
|
38
|
+
# Queue & lifecycle
|
|
39
|
+
status = Column(Enum(QuestionStatus), nullable=False, default=QuestionStatus.pending)
|
|
40
|
+
priority = Column(Integer, nullable=False, default=5) # lower = higher priority
|
|
41
|
+
attempts = Column(Integer, nullable=False, default=0)
|
|
42
|
+
last_error = Column(Text, nullable=True)
|
|
43
|
+
|
|
44
|
+
idempotency_key = Column(String(64), nullable=True) # to avoid dup work
|
|
45
|
+
dedupe_hash = Column(String(64), nullable=True) # e.g., hash(table_id, cell_id, question_text)
|
|
46
|
+
|
|
47
|
+
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
48
|
+
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
|
|
49
|
+
started_at = Column(DateTime, nullable=True)
|
|
50
|
+
finished_at = Column(DateTime, nullable=True)
|
|
51
|
+
|
|
52
|
+
# relationships
|
|
53
|
+
answers = relationship("SmartDefGridCellAnswerModel", back_populates="question", cascade="all, delete-orphan")
|
|
54
|
+
|
|
55
|
+
__table_args__ = (
|
|
56
|
+
# Useful to grab next jobs: status+priority+created
|
|
57
|
+
Index("ix_smart_def_grid_cell_questions_queue", "status", "priority", "created_at"),
|
|
58
|
+
# Quick lookup for this cell's active question(s)
|
|
59
|
+
Index("ix_smart_def_grid_cell_questions_cell", "smart_def_grid_id", "cell_id"),
|
|
60
|
+
# strong uniqueness if you want only one ACTIVE per cell; or enforce app-side
|
|
61
|
+
# UniqueConstraint("table_id", "cell_id", "status", name="uq_cell_question_cell_status"),
|
|
62
|
+
)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from marshmallow import Schema, fields, validate
|
|
2
|
+
from ..SmartDefGridCellAnswer.schemas import SmartDefGridCellAnswerResourceSchema
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
QUESTION_STATUS = ["pending", "queued", "running", "succeeded", "failed"]
|
|
6
|
+
EXPECTED_TYPE = ["number", "text", "citationList", "json"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SmartDefGridCellQuestionResourceSchema(Schema):
|
|
10
|
+
not_blank = validate.Length(min=1, error="Field cannot be blank")
|
|
11
|
+
|
|
12
|
+
id = fields.String(dump_only=True)
|
|
13
|
+
smart_def_grid_id = fields.Integer(required=True)
|
|
14
|
+
cell_id = fields.String(required=True)
|
|
15
|
+
|
|
16
|
+
question_text = fields.String(required=True, validate=not_blank)
|
|
17
|
+
expected_type = fields.String(required=True, validate=validate.OneOf(EXPECTED_TYPE))
|
|
18
|
+
must_cite = fields.Boolean(required=True)
|
|
19
|
+
|
|
20
|
+
topic_key = fields.Raw(allow_none=True) # e.g., {"row":[...], "col":[...]}
|
|
21
|
+
retrieval_hints = fields.Raw(allow_none=True)
|
|
22
|
+
|
|
23
|
+
status = fields.String(required=True, validate=validate.OneOf(QUESTION_STATUS))
|
|
24
|
+
priority = fields.Integer(required=True)
|
|
25
|
+
attempts = fields.Integer(required=True)
|
|
26
|
+
last_error = fields.String(allow_none=True)
|
|
27
|
+
|
|
28
|
+
idempotency_key = fields.String(allow_none=True)
|
|
29
|
+
dedupe_hash = fields.String(allow_none=True)
|
|
30
|
+
|
|
31
|
+
created_at = fields.DateTime(dump_only=True)
|
|
32
|
+
updated_at = fields.DateTime(dump_only=True)
|
|
33
|
+
started_at = fields.DateTime(dump_only=True)
|
|
34
|
+
finished_at = fields.DateTime(dump_only=True)
|
|
35
|
+
|
|
36
|
+
# light nesting of answers on read
|
|
37
|
+
answers = fields.Nested(SmartDefGridCellAnswerResourceSchema(), many=True, dump_only=True)
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from sqlalchemy import Column, DateTime, ForeignKey, Float, String, JSON, Boolean, Integer, Text
|
|
3
|
+
from sqlalchemy.orm import relationship
|
|
4
|
+
from ...database import Base
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SmartDefGridCellValueModel(Base):
|
|
8
|
+
"""
|
|
9
|
+
The canonical, last-applied value for a cell in the user table (what's rendered back).
|
|
10
|
+
This is what your UI reads to show the latest state (without opening BlockNote).
|
|
11
|
+
"""
|
|
12
|
+
__tablename__ = "smart_def_grid_cell_values"
|
|
13
|
+
|
|
14
|
+
smart_def_grid_id = Column(Integer, ForeignKey("smart_def_grids.id", ondelete="CASCADE"), primary_key=True)
|
|
15
|
+
cell_id = Column(String(36), primary_key=True)
|
|
16
|
+
|
|
17
|
+
# applied value derived from a specific answer_id (or manual override)
|
|
18
|
+
answer_id = Column(Integer, ForeignKey("smart_def_grid_cell_answers.id"), nullable=True)
|
|
19
|
+
raw_value = Column(Float, nullable=True)
|
|
20
|
+
display_text = Column(Text, nullable=True)
|
|
21
|
+
citations = Column(JSON, nullable=True)
|
|
22
|
+
formatting_used = Column(JSON, nullable=True) # snapshot of FormattingSpec used to render
|
|
23
|
+
|
|
24
|
+
# flags
|
|
25
|
+
manual_override = Column(Boolean, nullable=False, default=False)
|
|
26
|
+
note = Column(Text, nullable=True)
|
|
27
|
+
|
|
28
|
+
applied_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
29
|
+
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
|
|
30
|
+
|
|
31
|
+
# relationships
|
|
32
|
+
cell = relationship("SmartDefGridCellModel", back_populates="applied_value")
|
|
33
|
+
answer = relationship("SmartDefGridCellAnswerModel", foreign_keys=[answer_id])
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from marshmallow import Schema, fields
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class SmartDefGridCellValueResourceSchema(Schema):
|
|
5
|
+
smart_def_grid_id = fields.Integer(required=True)
|
|
6
|
+
cell_id = fields.String(required=True)
|
|
7
|
+
|
|
8
|
+
answer_id = fields.Integer(allow_none=True)
|
|
9
|
+
raw_value = fields.Float(allow_none=True)
|
|
10
|
+
display_text = fields.String(allow_none=True)
|
|
11
|
+
citations = fields.Raw(allow_none=True)
|
|
12
|
+
formatting_used = fields.Raw(allow_none=True)
|
|
13
|
+
|
|
14
|
+
manual_override = fields.Boolean(required=True, default=False)
|
|
15
|
+
note = fields.String(allow_none=True)
|
|
16
|
+
|
|
17
|
+
applied_at = fields.DateTime(dump_only=True)
|
|
18
|
+
updated_at = fields.DateTime(dump_only=True)
|
|
@@ -953,6 +953,24 @@ cs_models/resources/SearchLink/schemas.py,sha256=A8Y6LRgw7MHs9bihf0gZPfqp6KDm0Z8
|
|
|
953
953
|
cs_models/resources/Signature13F/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
954
954
|
cs_models/resources/Signature13F/models.py,sha256=E-n7Fz1Lz7XOeD6H6Ca0TIe6ixxRXao0hWGGZJkr4m8,538
|
|
955
955
|
cs_models/resources/Signature13F/schemas.py,sha256=5I0yQ5amGPQg2yoklmtJJ4HiQe14kNpw7OCUXFmrm1o,457
|
|
956
|
+
cs_models/resources/SmartDefGrid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
957
|
+
cs_models/resources/SmartDefGrid/models.py,sha256=is8GquHPIx4vaIMMOpnyATTf15muo4O8wRQDWUDrYdk,1217
|
|
958
|
+
cs_models/resources/SmartDefGrid/schemas.py,sha256=ju7pZH4a-A9nbqya0yUGjMaN4lYqJ6IkOmtgHwhhM4U,2083
|
|
959
|
+
cs_models/resources/SmartDefGridCell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
960
|
+
cs_models/resources/SmartDefGridCell/models.py,sha256=n9VLx_2fuymJCwQqkS-prfXV9FhNTRQ6ZJcVUfRix-s,2161
|
|
961
|
+
cs_models/resources/SmartDefGridCell/schemas.py,sha256=opd_dD3dj-U618RABBAo8UFAKwt9wPev1WVnPQca26c,1479
|
|
962
|
+
cs_models/resources/SmartDefGridCellAnswer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
963
|
+
cs_models/resources/SmartDefGridCellAnswer/models.py,sha256=S0JoLWAV_hf9KAyStwztoI5zt3HQjuXFpKhOIHdrtLU,1706
|
|
964
|
+
cs_models/resources/SmartDefGridCellAnswer/schemas.py,sha256=Nvt2pRq7SbbFmnp6EWrvao0A9BmmXqHOsTqf3qTo22Y,915
|
|
965
|
+
cs_models/resources/SmartDefGridCellAnswerCitation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
966
|
+
cs_models/resources/SmartDefGridCellAnswerCitation/models.py,sha256=pCNakAl08pSFTbuhJypF43zDfoapZDsvFPH2PP7QQqo,916
|
|
967
|
+
cs_models/resources/SmartDefGridCellAnswerCitation/schemas.py,sha256=1dYybWcoSuhP0OLqwQ3igNeexMcV-Nj0IqtBaPVap-Q,568
|
|
968
|
+
cs_models/resources/SmartDefGridCellQuestion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
969
|
+
cs_models/resources/SmartDefGridCellQuestion/models.py,sha256=69DbO4LvJXyyMIgWlukSX7CGPm3fof3hH-LsBTaYK_s,2724
|
|
970
|
+
cs_models/resources/SmartDefGridCellQuestion/schemas.py,sha256=L6WKwJA5h-s46SlpdJAdC2B4kj0yfNwhPQw5EAU1pm8,1536
|
|
971
|
+
cs_models/resources/SmartDefGridCellValue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
972
|
+
cs_models/resources/SmartDefGridCellValue/models.py,sha256=TJiiqYkwVfqEsVF2VxrDFzvIAheL5r4UvH5Qx0lAAco,1526
|
|
973
|
+
cs_models/resources/SmartDefGridCellValue/schemas.py,sha256=fqp1odR0nPheKjGeLScs9lPR6bDZzWVm2x78NNLuIRc,637
|
|
956
974
|
cs_models/resources/SmartGrid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
957
975
|
cs_models/resources/SmartGrid/models.py,sha256=9weIkYbh-Y-My5vjjUP-N-ziSNV-AWww1UUltK8EIy0,1011
|
|
958
976
|
cs_models/resources/SmartGrid/schemas.py,sha256=v5iG5dsEDnRp8P3UKba7uN39ZD_hqPvfLWyX1ltKKjM,665
|
|
@@ -1300,7 +1318,7 @@ cs_models/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
1300
1318
|
cs_models/utils/alchemy.py,sha256=fhINGFn41owJ2DLXQKXAAtLqeZ1BRzD_qU0wPK_bsGQ,1598
|
|
1301
1319
|
cs_models/utils/utils.py,sha256=BzCDk3u1np7DoJQqCZIJN4f80JNHvJoWO4qEFgolN-8,4474
|
|
1302
1320
|
cs_models/utils/profiling/__init__.py,sha256=N-73vb0M92C975fxgXyBCBjCPELl8Oh21ZY_-tzDnns,569
|
|
1303
|
-
cs_models-0.0.
|
|
1304
|
-
cs_models-0.0.
|
|
1305
|
-
cs_models-0.0.
|
|
1306
|
-
cs_models-0.0.
|
|
1321
|
+
cs_models-0.0.805.dist-info/METADATA,sha256=ma0mDlGR_rAQnekTB5A_abBuxWQYtAMFtcXsYWCTl4U,751
|
|
1322
|
+
cs_models-0.0.805.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
1323
|
+
cs_models-0.0.805.dist-info/top_level.txt,sha256=M7CA8Nh5t0vRManQ9gHfphhO16uhMqIbfaxr1jPDg18,10
|
|
1324
|
+
cs_models-0.0.805.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|