cs-models 0.0.807__py3-none-any.whl → 0.0.809__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/SmartDefGridCellAnswer/models.py +3 -0
- cs_models/resources/SmartDefGridCellQuestion/models.py +7 -0
- cs_models/resources/SmartDefGridCellQuestion/schemas.py +3 -0
- cs_models/resources/SmartDefGridCellValue/models.py +2 -0
- cs_models/resources/SmartDefGridCellValue/schemas.py +1 -0
- cs_models/resources/SmartDefGridRun/__init__.py +0 -0
- cs_models/resources/SmartDefGridRun/models.py +43 -0
- cs_models/resources/SmartDefGridRun/schemas.py +28 -0
- {cs_models-0.0.807.dist-info → cs_models-0.0.809.dist-info}/METADATA +1 -1
- {cs_models-0.0.807.dist-info → cs_models-0.0.809.dist-info}/RECORD +12 -9
- {cs_models-0.0.807.dist-info → cs_models-0.0.809.dist-info}/WHEEL +0 -0
- {cs_models-0.0.807.dist-info → cs_models-0.0.809.dist-info}/top_level.txt +0 -0
|
@@ -14,6 +14,7 @@ class SmartDefGridCellAnswerModel(Base):
|
|
|
14
14
|
question_id = Column(Integer, ForeignKey("smart_def_grid_cell_questions.id", ondelete="CASCADE"), nullable=False)
|
|
15
15
|
|
|
16
16
|
smart_def_grid_id = Column(Integer, ForeignKey("smart_def_grids.id", ondelete="CASCADE"), nullable=False)
|
|
17
|
+
run_id = Column(Integer, ForeignKey("smart_def_grid_runs.id", ondelete="SET NULL"), nullable=True)
|
|
17
18
|
cell_id = Column(String(36), nullable=False)
|
|
18
19
|
|
|
19
20
|
# canonical payload
|
|
@@ -37,6 +38,8 @@ class SmartDefGridCellAnswerModel(Base):
|
|
|
37
38
|
ondelete="CASCADE",
|
|
38
39
|
),
|
|
39
40
|
Index("ix_smart_def_grid_cell_answers_cell", "smart_def_grid_id", "cell_id", "created_at"),
|
|
41
|
+
Index("ix_sdgca_run_cell", "run_id", "smart_def_grid_id", "cell_id", "created_at"),
|
|
40
42
|
)
|
|
41
43
|
|
|
42
44
|
question = relationship("SmartDefGridCellQuestionModel", back_populates="answers")
|
|
45
|
+
run = relationship("SmartDefGridRunModel")
|
|
@@ -26,6 +26,7 @@ class SmartDefGridCellQuestionModel(Base):
|
|
|
26
26
|
|
|
27
27
|
id = Column(Integer, primary_key=True, autoincrement=True) # question_id (uuid)
|
|
28
28
|
smart_def_grid_id = Column(Integer, ForeignKey("smart_def_grids.id", ondelete="CASCADE"), nullable=False)
|
|
29
|
+
run_id = Column(Integer, ForeignKey("smart_def_grid_runs.id", ondelete="SET NULL"), nullable=True)
|
|
29
30
|
cell_id = Column(String(36), nullable=False)
|
|
30
31
|
|
|
31
32
|
question_text = Column(Text, nullable=False)
|
|
@@ -35,6 +36,9 @@ class SmartDefGridCellQuestionModel(Base):
|
|
|
35
36
|
topic_key = Column(JSON, nullable=True)
|
|
36
37
|
retrieval_hints = Column(JSON, nullable=True)
|
|
37
38
|
|
|
39
|
+
# Answer
|
|
40
|
+
answer_text = Column(Text, nullable=True)
|
|
41
|
+
|
|
38
42
|
# Queue & lifecycle
|
|
39
43
|
status = Column(Enum(QuestionStatus), nullable=False, default=QuestionStatus.pending)
|
|
40
44
|
priority = Column(Integer, nullable=False, default=5) # lower = higher priority
|
|
@@ -51,12 +55,15 @@ class SmartDefGridCellQuestionModel(Base):
|
|
|
51
55
|
|
|
52
56
|
# relationships
|
|
53
57
|
answers = relationship("SmartDefGridCellAnswerModel", back_populates="question", cascade="all, delete-orphan")
|
|
58
|
+
run = relationship("SmartDefGridRunModel")
|
|
54
59
|
|
|
55
60
|
__table_args__ = (
|
|
56
61
|
# Useful to grab next jobs: status+priority+created
|
|
57
62
|
Index("ix_smart_def_grid_cell_questions_queue", "status", "priority", "created_at"),
|
|
58
63
|
# Quick lookup for this cell's active question(s)
|
|
59
64
|
Index("ix_smart_def_grid_cell_questions_cell", "smart_def_grid_id", "cell_id"),
|
|
65
|
+
Index("ix_sdgcq_run_status", "run_id", "status", "priority", "created_at"),
|
|
66
|
+
Index("ix_sdgcq_run_cell", "run_id", "smart_def_grid_id", "cell_id"),
|
|
60
67
|
ForeignKeyConstraint(
|
|
61
68
|
["smart_def_grid_id", "cell_id"],
|
|
62
69
|
["smart_def_grid_cells.smart_def_grid_id", "smart_def_grid_cells.cell_id"],
|
|
@@ -11,6 +11,7 @@ class SmartDefGridCellQuestionResourceSchema(Schema):
|
|
|
11
11
|
|
|
12
12
|
id = fields.String(dump_only=True)
|
|
13
13
|
smart_def_grid_id = fields.Integer(required=True)
|
|
14
|
+
run_id = fields.Integer(allow_none=True)
|
|
14
15
|
cell_id = fields.String(required=True)
|
|
15
16
|
|
|
16
17
|
question_text = fields.String(required=True, validate=not_blank)
|
|
@@ -20,6 +21,8 @@ class SmartDefGridCellQuestionResourceSchema(Schema):
|
|
|
20
21
|
topic_key = fields.Raw(allow_none=True) # e.g., {"row":[...], "col":[...]}
|
|
21
22
|
retrieval_hints = fields.Raw(allow_none=True)
|
|
22
23
|
|
|
24
|
+
answer_text = fields.String(allow_none=True)
|
|
25
|
+
|
|
23
26
|
status = fields.String(required=True, validate=validate.OneOf(QUESTION_STATUS))
|
|
24
27
|
priority = fields.Integer(required=True)
|
|
25
28
|
attempts = fields.Integer(required=True)
|
|
@@ -13,6 +13,7 @@ class SmartDefGridCellValueModel(Base):
|
|
|
13
13
|
__tablename__ = "smart_def_grid_cell_values"
|
|
14
14
|
|
|
15
15
|
smart_def_grid_id = Column(Integer, ForeignKey("smart_def_grids.id", ondelete="CASCADE"), primary_key=True)
|
|
16
|
+
applied_run_id = Column(Integer, ForeignKey("smart_def_grid_runs.id", ondelete="SET NULL"), nullable=True)
|
|
16
17
|
cell_id = Column(String(36), primary_key=True)
|
|
17
18
|
|
|
18
19
|
# applied value derived from a specific answer_id (or manual override)
|
|
@@ -50,3 +51,4 @@ class SmartDefGridCellValueModel(Base):
|
|
|
50
51
|
)
|
|
51
52
|
|
|
52
53
|
answer = relationship("SmartDefGridCellAnswerModel", foreign_keys=[answer_id])
|
|
54
|
+
applied_run = relationship("SmartDefGridRunModel")
|
|
@@ -3,6 +3,7 @@ from marshmallow import Schema, fields
|
|
|
3
3
|
|
|
4
4
|
class SmartDefGridCellValueResourceSchema(Schema):
|
|
5
5
|
smart_def_grid_id = fields.Integer(required=True)
|
|
6
|
+
applied_run_id = fields.Integer(allow_none=True)
|
|
6
7
|
cell_id = fields.String(required=True)
|
|
7
8
|
|
|
8
9
|
answer_id = fields.Integer(allow_none=True)
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, JSON, Text, Index
|
|
4
|
+
from sqlalchemy.orm import relationship
|
|
5
|
+
from ...database import Base
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SmartDefGridRunStatus(str, Enum):
|
|
9
|
+
created = "created"
|
|
10
|
+
dispatched = "dispatched"
|
|
11
|
+
running = "running"
|
|
12
|
+
succeeded = "succeeded"
|
|
13
|
+
failed = "failed"
|
|
14
|
+
cancelled = "cancelled"
|
|
15
|
+
partial = "partial" # finished with some failed cells
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class SmartDefGridRunModel(Base):
|
|
19
|
+
__tablename__ = "smart_def_grid_runs"
|
|
20
|
+
|
|
21
|
+
id = Column(Integer, primary_key=True, autoincrement=True) # run_id
|
|
22
|
+
smart_def_grid_id = Column(Integer, ForeignKey("smart_def_grids.id", ondelete="CASCADE"), nullable=False)
|
|
23
|
+
|
|
24
|
+
# optional snapshotting to make runs reproducible/debuggable
|
|
25
|
+
outline_json = Column(JSON, nullable=False) # new outline created for this run
|
|
26
|
+
original_table_json = Column(JSON, nullable=False) # stamped block at run start
|
|
27
|
+
|
|
28
|
+
# execution metadata
|
|
29
|
+
status = Column(Enum(SmartDefGridRunStatus), nullable=False, default=SmartDefGridRunStatus.created)
|
|
30
|
+
started_by_user_id = Column(String(64), nullable=False)
|
|
31
|
+
notes = Column(Text, nullable=True)
|
|
32
|
+
# optional idempotency token if you want “re-run latest”
|
|
33
|
+
client_token = Column(String(128), nullable=True, index=True)
|
|
34
|
+
|
|
35
|
+
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
36
|
+
started_at = Column(DateTime, nullable=True)
|
|
37
|
+
finished_at = Column(DateTime, nullable=True)
|
|
38
|
+
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
|
|
39
|
+
|
|
40
|
+
grid = relationship("SmartDefGridModel", backref="runs")
|
|
41
|
+
__table_args__ = (
|
|
42
|
+
Index("ix_sdgr_runs_grid_created", "smart_def_grid_id", "created_at"),
|
|
43
|
+
)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from marshmallow import Schema, fields, validate
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class SmartDefGridRunResourceSchema(Schema):
|
|
5
|
+
"""
|
|
6
|
+
The user-defined table artifact (aka 'SmartDefGrid' resource).
|
|
7
|
+
- id is your table_id (UUID string or int—your choice).
|
|
8
|
+
- outline_json/original_table_json can be dicts (preferred) or JSON strings if you’d rather store serialized blobs.
|
|
9
|
+
"""
|
|
10
|
+
not_blank = validate.Length(min=1, error="Field cannot be blank")
|
|
11
|
+
|
|
12
|
+
id = fields.String(dump_only=True) # table_id
|
|
13
|
+
smart_def_grid_id = fields.Integer(allow_none=True) # if you link to a workbook
|
|
14
|
+
|
|
15
|
+
# prefer dicts; switch to fields.String if you store JSON-serialized strings
|
|
16
|
+
outline_json = fields.Raw(required=True)
|
|
17
|
+
original_table_json = fields.Raw(required=True)
|
|
18
|
+
|
|
19
|
+
status = fields.String(required=True)
|
|
20
|
+
started_by_user_id = fields.String(required=True)
|
|
21
|
+
|
|
22
|
+
notes = fields.String(allow_none=True)
|
|
23
|
+
client_token = fields.String(allow_none=True)
|
|
24
|
+
|
|
25
|
+
created_at = fields.DateTime(dump_only=True)
|
|
26
|
+
started_at = fields.DateTime(allow_none=True)
|
|
27
|
+
finished_at = fields.DateTime(allow_none=True)
|
|
28
|
+
updated_at = fields.DateTime(dump_only=True)
|
|
@@ -960,17 +960,20 @@ cs_models/resources/SmartDefGridCell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeu
|
|
|
960
960
|
cs_models/resources/SmartDefGridCell/models.py,sha256=rbvJPsKQLhWZjUMza1--kS5oQC_D7Ylde8jAzjRoG_8,2315
|
|
961
961
|
cs_models/resources/SmartDefGridCell/schemas.py,sha256=opd_dD3dj-U618RABBAo8UFAKwt9wPev1WVnPQca26c,1479
|
|
962
962
|
cs_models/resources/SmartDefGridCellAnswer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
963
|
-
cs_models/resources/SmartDefGridCellAnswer/models.py,sha256=
|
|
963
|
+
cs_models/resources/SmartDefGridCellAnswer/models.py,sha256=5lvvhs8d8gV7IGP_fskJPD88r3ZUj6GfYa7qwXRyB1Q,2177
|
|
964
964
|
cs_models/resources/SmartDefGridCellAnswer/schemas.py,sha256=Nvt2pRq7SbbFmnp6EWrvao0A9BmmXqHOsTqf3qTo22Y,915
|
|
965
965
|
cs_models/resources/SmartDefGridCellAnswerCitation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
966
966
|
cs_models/resources/SmartDefGridCellAnswerCitation/models.py,sha256=pCNakAl08pSFTbuhJypF43zDfoapZDsvFPH2PP7QQqo,916
|
|
967
967
|
cs_models/resources/SmartDefGridCellAnswerCitation/schemas.py,sha256=1dYybWcoSuhP0OLqwQ3igNeexMcV-Nj0IqtBaPVap-Q,568
|
|
968
968
|
cs_models/resources/SmartDefGridCellQuestion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
969
|
-
cs_models/resources/SmartDefGridCellQuestion/models.py,sha256=
|
|
970
|
-
cs_models/resources/SmartDefGridCellQuestion/schemas.py,sha256=
|
|
969
|
+
cs_models/resources/SmartDefGridCellQuestion/models.py,sha256=3pOYSZZnY6ufYBkRTqbV7heuclfDIcm8SnUy0kJDNic,3345
|
|
970
|
+
cs_models/resources/SmartDefGridCellQuestion/schemas.py,sha256=P1w8PTxhC7D6zYcs1ijy-ZZxHrYJJnAfDXNV-zbn3UY,1631
|
|
971
971
|
cs_models/resources/SmartDefGridCellValue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
972
|
-
cs_models/resources/SmartDefGridCellValue/models.py,sha256=
|
|
973
|
-
cs_models/resources/SmartDefGridCellValue/schemas.py,sha256=
|
|
972
|
+
cs_models/resources/SmartDefGridCellValue/models.py,sha256=xNonMUcjN09lqS0CrYLoVGRpsGPFvW75FcT5IY7ggUA,2425
|
|
973
|
+
cs_models/resources/SmartDefGridCellValue/schemas.py,sha256=RjxVxBtxd29iReLOfArdHOzmV4ruyfyUnqfL8Wf9BG4,690
|
|
974
|
+
cs_models/resources/SmartDefGridRun/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
975
|
+
cs_models/resources/SmartDefGridRun/models.py,sha256=8ZKow4PVBztg6w5fOHq5Plj3e5u-jEwqDtCnqpPv2uc,1773
|
|
976
|
+
cs_models/resources/SmartDefGridRun/schemas.py,sha256=VQeBvql_e_K9cGKmDR6t8GMkJjkYW_HxaB4lvaHmQpI,1156
|
|
974
977
|
cs_models/resources/SmartGrid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
975
978
|
cs_models/resources/SmartGrid/models.py,sha256=9weIkYbh-Y-My5vjjUP-N-ziSNV-AWww1UUltK8EIy0,1011
|
|
976
979
|
cs_models/resources/SmartGrid/schemas.py,sha256=v5iG5dsEDnRp8P3UKba7uN39ZD_hqPvfLWyX1ltKKjM,665
|
|
@@ -1318,7 +1321,7 @@ cs_models/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
1318
1321
|
cs_models/utils/alchemy.py,sha256=fhINGFn41owJ2DLXQKXAAtLqeZ1BRzD_qU0wPK_bsGQ,1598
|
|
1319
1322
|
cs_models/utils/utils.py,sha256=BzCDk3u1np7DoJQqCZIJN4f80JNHvJoWO4qEFgolN-8,4474
|
|
1320
1323
|
cs_models/utils/profiling/__init__.py,sha256=N-73vb0M92C975fxgXyBCBjCPELl8Oh21ZY_-tzDnns,569
|
|
1321
|
-
cs_models-0.0.
|
|
1322
|
-
cs_models-0.0.
|
|
1323
|
-
cs_models-0.0.
|
|
1324
|
-
cs_models-0.0.
|
|
1324
|
+
cs_models-0.0.809.dist-info/METADATA,sha256=U9I0K62CRB-BgplOLXTLhsJUuoicVhuPKDovNGbHaQA,751
|
|
1325
|
+
cs_models-0.0.809.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
1326
|
+
cs_models-0.0.809.dist-info/top_level.txt,sha256=M7CA8Nh5t0vRManQ9gHfphhO16uhMqIbfaxr1jPDg18,10
|
|
1327
|
+
cs_models-0.0.809.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|