cs-models 0.0.627__py3-none-any.whl → 0.0.847__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.
Files changed (392) hide show
  1. cs_models/database/operations.py +17 -5
  2. cs_models/resources/ArtifactVectorIndex/__init__.py +0 -0
  3. cs_models/resources/ArtifactVectorIndex/models.py +32 -0
  4. cs_models/resources/ArtifactVectorIndex/schemas.py +16 -0
  5. cs_models/resources/ArtifactVectorIndexQueue/__init__.py +0 -0
  6. cs_models/resources/ArtifactVectorIndexQueue/models.py +34 -0
  7. cs_models/resources/ArtifactVectorIndexQueue/schemas.py +17 -0
  8. cs_models/resources/AssistantCommand/models.py +14 -1
  9. cs_models/resources/AssistantCommand/schemas.py +2 -0
  10. cs_models/resources/AssistantCommandArtifact/models.py +2 -1
  11. cs_models/resources/AssistantCommandArtifact/schemas.py +1 -0
  12. cs_models/resources/AssistantCommandChart/__init__.py +0 -0
  13. cs_models/resources/AssistantCommandChart/models.py +37 -0
  14. cs_models/resources/AssistantCommandChart/schemas.py +16 -0
  15. cs_models/resources/AssistantSession/models.py +8 -1
  16. cs_models/resources/AssistantSession/schemas.py +3 -0
  17. cs_models/resources/AssistantUserQuery/models.py +5 -1
  18. cs_models/resources/AssistantUserQuery/schemas.py +40 -1
  19. cs_models/resources/B3CRSS/__init__.py +0 -0
  20. cs_models/resources/B3CRSS/models.py +25 -0
  21. cs_models/resources/B3CRSS/schemas.py +14 -0
  22. cs_models/resources/CampaignTracker/__init__.py +0 -0
  23. cs_models/resources/CampaignTracker/models.py +29 -0
  24. cs_models/resources/CampaignTracker/schemas.py +17 -0
  25. cs_models/resources/CompanyDrugCount/__init__.py +0 -0
  26. cs_models/resources/CompanyDrugCount/models.py +28 -0
  27. cs_models/resources/CompanyDrugCount/schemas.py +11 -0
  28. cs_models/resources/CompanyMarketCap/__init__.py +0 -0
  29. cs_models/resources/CompanyMarketCap/models.py +29 -0
  30. cs_models/resources/CompanyMarketCap/schemas.py +11 -0
  31. cs_models/resources/CompanyOUS/models.py +4 -0
  32. cs_models/resources/CompanyOUS/schemas.py +6 -0
  33. cs_models/resources/CompanyOutbox/models.py +1 -0
  34. cs_models/resources/CompanyOutbox/schemas.py +1 -0
  35. cs_models/resources/CompanyReview/models.py +4 -1
  36. cs_models/resources/CompanyReview/schemas.py +3 -0
  37. cs_models/resources/CompanySEC/models.py +4 -0
  38. cs_models/resources/CompanySEC/schemas.py +6 -0
  39. cs_models/resources/Config/models.py +2 -0
  40. cs_models/resources/Config/schemas.py +3 -0
  41. cs_models/resources/CoverPage13F/__init__.py +0 -0
  42. cs_models/resources/CoverPage13F/models.py +29 -0
  43. cs_models/resources/CoverPage13F/schemas.py +27 -0
  44. cs_models/resources/Cusip13FSubsidiary/__init__.py +0 -0
  45. cs_models/resources/Cusip13FSubsidiary/models.py +28 -0
  46. cs_models/resources/Cusip13FSubsidiary/schemas.py +14 -0
  47. cs_models/resources/Deal/models.py +2 -0
  48. cs_models/resources/Deal/schemas.py +2 -0
  49. cs_models/resources/DealAdvisor/__init__.py +0 -0
  50. cs_models/resources/DealAdvisor/models.py +35 -0
  51. cs_models/resources/DealAdvisor/schemas.py +15 -0
  52. cs_models/resources/DealInvestor/models.py +1 -0
  53. cs_models/resources/DealInvestor/schemas.py +1 -0
  54. cs_models/resources/DealType/__init__.py +0 -0
  55. cs_models/resources/DealType/models.py +33 -0
  56. cs_models/resources/DealType/schemas.py +14 -0
  57. cs_models/resources/DealUnderwriter/__init__.py +0 -0
  58. cs_models/resources/DealUnderwriter/models.py +35 -0
  59. cs_models/resources/DealUnderwriter/schemas.py +15 -0
  60. cs_models/resources/DeepResearchAgenticUnit/__init__.py +14 -0
  61. cs_models/resources/DeepResearchAgenticUnit/models.py +123 -0
  62. cs_models/resources/DeepResearchAgenticUnit/schemas.py +50 -0
  63. cs_models/resources/DeepResearchSession/__init__.py +20 -0
  64. cs_models/resources/DeepResearchSession/models.py +170 -0
  65. cs_models/resources/DeepResearchSession/schemas.py +94 -0
  66. cs_models/resources/DeepResearchSubTask/__init__.py +20 -0
  67. cs_models/resources/DeepResearchSubTask/models.py +177 -0
  68. cs_models/resources/DeepResearchSubTask/schemas.py +105 -0
  69. cs_models/resources/Designation/models.py +7 -0
  70. cs_models/resources/Designation/schemas.py +2 -0
  71. cs_models/resources/DesignationOutbox/models.py +2 -0
  72. cs_models/resources/DesignationOutbox/schemas.py +1 -0
  73. cs_models/resources/Digest/models.py +1 -0
  74. cs_models/resources/Digest/schemas.py +1 -0
  75. cs_models/resources/DocChunk/__init__.py +0 -0
  76. cs_models/resources/DocChunk/models.py +33 -0
  77. cs_models/resources/DocChunk/schemas.py +20 -0
  78. cs_models/resources/DocMarkdownTable/__init__.py +0 -0
  79. cs_models/resources/DocMarkdownTable/models.py +29 -0
  80. cs_models/resources/DocMarkdownTable/schemas.py +16 -0
  81. cs_models/resources/EventLLM/__init__.py +0 -0
  82. cs_models/resources/EventLLM/models.py +41 -0
  83. cs_models/resources/EventLLM/schemas.py +39 -0
  84. cs_models/resources/EventsQueue/__init__.py +0 -0
  85. cs_models/resources/EventsQueue/models.py +33 -0
  86. cs_models/resources/EventsQueue/schemas.py +18 -0
  87. cs_models/resources/ExplorerColumn/__init__.py +0 -0
  88. cs_models/resources/ExplorerColumn/models.py +33 -0
  89. cs_models/resources/ExplorerColumn/schemas.py +16 -0
  90. cs_models/resources/ExternalDrive/__init__.py +0 -0
  91. cs_models/resources/ExternalDrive/models.py +29 -0
  92. cs_models/resources/ExternalDrive/schemas.py +14 -0
  93. cs_models/resources/FDADrugReview/__init__.py +0 -0
  94. cs_models/resources/FDADrugReview/models.py +29 -0
  95. cs_models/resources/FDADrugReview/schemas.py +19 -0
  96. cs_models/resources/FDADrugReviewFile/__init__.py +0 -0
  97. cs_models/resources/FDADrugReviewFile/models.py +43 -0
  98. cs_models/resources/FDADrugReviewFile/schemas.py +22 -0
  99. cs_models/resources/FDADrugReviewFileCondition/__init__.py +0 -0
  100. cs_models/resources/FDADrugReviewFileCondition/models.py +42 -0
  101. cs_models/resources/FDADrugReviewFileCondition/schemas.py +18 -0
  102. cs_models/resources/FDADrugReviewFileIntervention/__init__.py +0 -0
  103. cs_models/resources/FDADrugReviewFileIntervention/models.py +42 -0
  104. cs_models/resources/FDADrugReviewFileIntervention/schemas.py +18 -0
  105. cs_models/resources/FDADrugReviewFileTarget/__init__.py +0 -0
  106. cs_models/resources/FDADrugReviewFileTarget/models.py +42 -0
  107. cs_models/resources/FDADrugReviewFileTarget/schemas.py +18 -0
  108. cs_models/resources/FDALabel/models.py +3 -0
  109. cs_models/resources/FDALabel/schemas.py +2 -0
  110. cs_models/resources/FDAMeetingFiling/models.py +1 -0
  111. cs_models/resources/FDAMeetingFiling/schemas.py +1 -0
  112. cs_models/resources/FinancingDealType/__init__.py +0 -0
  113. cs_models/resources/FinancingDealType/models.py +28 -0
  114. cs_models/resources/FinancingDealType/schemas.py +13 -0
  115. cs_models/resources/InfoTable13F/__init__.py +0 -0
  116. cs_models/resources/InfoTable13F/models.py +26 -0
  117. cs_models/resources/InfoTable13F/schemas.py +20 -0
  118. cs_models/resources/Meeting/models.py +8 -0
  119. cs_models/resources/Meeting/schemas.py +84 -0
  120. cs_models/resources/MeetingDataOutbox/models.py +8 -1
  121. cs_models/resources/MeetingDataOutbox/schemas.py +4 -1
  122. cs_models/resources/MeetingUserDocument/__init__.py +0 -0
  123. cs_models/resources/MeetingUserDocument/models.py +39 -0
  124. cs_models/resources/MeetingUserDocument/schemas.py +17 -0
  125. cs_models/resources/MindgramOAuth/__init__.py +0 -0
  126. cs_models/resources/MindgramOAuth/models.py +35 -0
  127. cs_models/resources/MindgramOAuth/schemas.py +33 -0
  128. cs_models/resources/NCTFDADrugReviewFile/__init__.py +0 -0
  129. cs_models/resources/NCTFDADrugReviewFile/models.py +37 -0
  130. cs_models/resources/NCTFDADrugReviewFile/schemas.py +16 -0
  131. cs_models/resources/NCTFacilities/models.py +1 -0
  132. cs_models/resources/NCTFacilities/schemas.py +1 -0
  133. cs_models/resources/NCTParticipationCriteria/__init__.py +0 -0
  134. cs_models/resources/NCTParticipationCriteria/models.py +28 -0
  135. cs_models/resources/NCTParticipationCriteria/schemas.py +14 -0
  136. cs_models/resources/NCTStudy/models.py +2 -0
  137. cs_models/resources/NCTStudy/schemas.py +2 -0
  138. cs_models/resources/NotificationReadStatus/__init__.py +0 -0
  139. cs_models/resources/NotificationReadStatus/models.py +30 -0
  140. cs_models/resources/NotificationReadStatus/schemas.py +15 -0
  141. cs_models/resources/OtherManager13F/__init__.py +0 -0
  142. cs_models/resources/OtherManager13F/models.py +18 -0
  143. cs_models/resources/OtherManager13F/schemas.py +12 -0
  144. cs_models/resources/OtherManager213F/__init__.py +0 -0
  145. cs_models/resources/OtherManager213F/models.py +15 -0
  146. cs_models/resources/OtherManager213F/schemas.py +13 -0
  147. cs_models/resources/PipelineCrawlSession/__init__.py +0 -0
  148. cs_models/resources/PipelineCrawlSession/models.py +67 -0
  149. cs_models/resources/PipelineCrawlSession/schemas.py +22 -0
  150. cs_models/resources/PipelineCrawledPage/__init__.py +0 -0
  151. cs_models/resources/PipelineCrawledPage/models.py +80 -0
  152. cs_models/resources/PipelineCrawledPage/schemas.py +34 -0
  153. cs_models/resources/PipelineDrugPortfolio/__init__.py +0 -0
  154. cs_models/resources/PipelineDrugPortfolio/models.py +92 -0
  155. cs_models/resources/PipelineDrugPortfolio/schemas.py +31 -0
  156. cs_models/resources/PipelineExtractionLog/__init__.py +0 -0
  157. cs_models/resources/PipelineExtractionLog/models.py +55 -0
  158. cs_models/resources/PipelineExtractionLog/schemas.py +23 -0
  159. cs_models/resources/PromptIndices/__init__.py +0 -0
  160. cs_models/resources/PromptIndices/models.py +27 -0
  161. cs_models/resources/PromptIndices/schemas.py +17 -0
  162. cs_models/resources/PubmedMeetingSellSideSignal/__init__.py +0 -0
  163. cs_models/resources/PubmedMeetingSellSideSignal/models.py +64 -0
  164. cs_models/resources/PubmedMeetingSellSideSignal/schemas.py +21 -0
  165. cs_models/resources/PubmedMeetingUserDocument/__init__.py +0 -0
  166. cs_models/resources/PubmedMeetingUserDocument/models.py +40 -0
  167. cs_models/resources/PubmedMeetingUserDocument/schemas.py +16 -0
  168. cs_models/resources/PubmedUserDocument/__init__.py +0 -0
  169. cs_models/resources/PubmedUserDocument/models.py +35 -0
  170. cs_models/resources/PubmedUserDocument/schemas.py +15 -0
  171. cs_models/resources/PubmedVectorIndex/__init__.py +0 -0
  172. cs_models/resources/PubmedVectorIndex/models.py +33 -0
  173. cs_models/resources/PubmedVectorIndex/schemas.py +16 -0
  174. cs_models/resources/SalesEstimate/__init__.py +0 -0
  175. cs_models/resources/SalesEstimate/models.py +39 -0
  176. cs_models/resources/SalesEstimate/schemas.py +26 -0
  177. cs_models/resources/SalesEstimateCompany/__init__.py +0 -0
  178. cs_models/resources/SalesEstimateCompany/models.py +38 -0
  179. cs_models/resources/SalesEstimateCompany/schemas.py +35 -0
  180. cs_models/resources/SalesEstimateCondition/__init__.py +0 -0
  181. cs_models/resources/SalesEstimateCondition/models.py +41 -0
  182. cs_models/resources/SalesEstimateCondition/schemas.py +17 -0
  183. cs_models/resources/SalesEstimateIntervention/__init__.py +0 -0
  184. cs_models/resources/SalesEstimateIntervention/models.py +41 -0
  185. cs_models/resources/SalesEstimateIntervention/schemas.py +17 -0
  186. cs_models/resources/SalesEstimateTarget/__init__.py +0 -0
  187. cs_models/resources/SalesEstimateTarget/models.py +41 -0
  188. cs_models/resources/SalesEstimateTarget/schemas.py +17 -0
  189. cs_models/resources/SalesTable/__init__.py +0 -0
  190. cs_models/resources/SalesTable/models.py +34 -0
  191. cs_models/resources/SalesTable/schemas.py +20 -0
  192. cs_models/resources/SearchLink/__init__.py +0 -0
  193. cs_models/resources/SearchLink/models.py +29 -0
  194. cs_models/resources/SearchLink/schemas.py +16 -0
  195. cs_models/resources/SellSideAbstractMention/__init__.py +0 -0
  196. cs_models/resources/SellSideAbstractMention/models.py +57 -0
  197. cs_models/resources/SellSideAbstractMention/schemas.py +28 -0
  198. cs_models/resources/SellSideAbstractMentionLink/__init__.py +0 -0
  199. cs_models/resources/SellSideAbstractMentionLink/models.py +60 -0
  200. cs_models/resources/SellSideAbstractMentionLink/schemas.py +24 -0
  201. cs_models/resources/SellSideSource/__init__.py +0 -0
  202. cs_models/resources/SellSideSource/models.py +25 -0
  203. cs_models/resources/SellSideSource/schemas.py +13 -0
  204. cs_models/resources/Signature13F/__init__.py +0 -0
  205. cs_models/resources/Signature13F/models.py +15 -0
  206. cs_models/resources/Signature13F/schemas.py +13 -0
  207. cs_models/resources/SmartDefGrid/__init__.py +0 -0
  208. cs_models/resources/SmartDefGrid/models.py +30 -0
  209. cs_models/resources/SmartDefGrid/schemas.py +52 -0
  210. cs_models/resources/SmartDefGridCell/__init__.py +0 -0
  211. cs_models/resources/SmartDefGridCell/models.py +51 -0
  212. cs_models/resources/SmartDefGridCell/schemas.py +39 -0
  213. cs_models/resources/SmartDefGridCellAnswer/__init__.py +0 -0
  214. cs_models/resources/SmartDefGridCellAnswer/models.py +45 -0
  215. cs_models/resources/SmartDefGridCellAnswer/schemas.py +23 -0
  216. cs_models/resources/SmartDefGridCellAnswerCitation/__init__.py +0 -0
  217. cs_models/resources/SmartDefGridCellAnswerCitation/models.py +21 -0
  218. cs_models/resources/SmartDefGridCellAnswerCitation/schemas.py +14 -0
  219. cs_models/resources/SmartDefGridCellQuestion/__init__.py +0 -0
  220. cs_models/resources/SmartDefGridCellQuestion/models.py +76 -0
  221. cs_models/resources/SmartDefGridCellQuestion/schemas.py +41 -0
  222. cs_models/resources/SmartDefGridCellValue/__init__.py +0 -0
  223. cs_models/resources/SmartDefGridCellValue/models.py +54 -0
  224. cs_models/resources/SmartDefGridCellValue/schemas.py +19 -0
  225. cs_models/resources/SmartDefGridRun/__init__.py +0 -0
  226. cs_models/resources/SmartDefGridRun/models.py +60 -0
  227. cs_models/resources/SmartDefGridRun/schemas.py +31 -0
  228. cs_models/resources/SmartGrid/__init__.py +0 -0
  229. cs_models/resources/SmartGrid/models.py +34 -0
  230. cs_models/resources/SmartGrid/schemas.py +18 -0
  231. cs_models/resources/SmartGridCell/__init__.py +0 -0
  232. cs_models/resources/SmartGridCell/models.py +44 -0
  233. cs_models/resources/SmartGridCell/schemas.py +22 -0
  234. cs_models/resources/Submission13F/__init__.py +0 -0
  235. cs_models/resources/Submission13F/models.py +12 -0
  236. cs_models/resources/Submission13F/schemas.py +10 -0
  237. cs_models/resources/SummaryPage13F/__init__.py +0 -0
  238. cs_models/resources/SummaryPage13F/models.py +12 -0
  239. cs_models/resources/SummaryPage13F/schemas.py +9 -0
  240. cs_models/resources/TableFigure/__init__.py +0 -0
  241. cs_models/resources/TableFigure/models.py +40 -0
  242. cs_models/resources/TableFigure/schemas.py +61 -0
  243. cs_models/resources/TargetSyn/models.py +4 -0
  244. cs_models/resources/TargetSyn/schemas.py +3 -0
  245. cs_models/resources/Transcript/__init__.py +0 -0
  246. cs_models/resources/Transcript/models.py +31 -0
  247. cs_models/resources/Transcript/schemas.py +20 -0
  248. cs_models/resources/TranscriptCondition/__init__.py +0 -0
  249. cs_models/resources/TranscriptCondition/models.py +41 -0
  250. cs_models/resources/TranscriptCondition/schemas.py +17 -0
  251. cs_models/resources/TranscriptEquity/__init__.py +0 -0
  252. cs_models/resources/TranscriptEquity/models.py +28 -0
  253. cs_models/resources/TranscriptEquity/schemas.py +15 -0
  254. cs_models/resources/TranscriptEquityCompany/__init__.py +0 -0
  255. cs_models/resources/TranscriptEquityCompany/models.py +34 -0
  256. cs_models/resources/TranscriptEquityCompany/schemas.py +16 -0
  257. cs_models/resources/TranscriptGrouping/__init__.py +0 -0
  258. cs_models/resources/TranscriptGrouping/models.py +23 -0
  259. cs_models/resources/TranscriptGrouping/schemas.py +14 -0
  260. cs_models/resources/TranscriptGroupingMap/__init__.py +0 -0
  261. cs_models/resources/TranscriptGroupingMap/models.py +31 -0
  262. cs_models/resources/TranscriptGroupingMap/schemas.py +14 -0
  263. cs_models/resources/TranscriptIntervention/__init__.py +0 -0
  264. cs_models/resources/TranscriptIntervention/models.py +41 -0
  265. cs_models/resources/TranscriptIntervention/schemas.py +17 -0
  266. cs_models/resources/TranscriptItem/__init__.py +0 -0
  267. cs_models/resources/TranscriptItem/models.py +35 -0
  268. cs_models/resources/TranscriptItem/schemas.py +20 -0
  269. cs_models/resources/TranscriptTarget/__init__.py +0 -0
  270. cs_models/resources/TranscriptTarget/models.py +41 -0
  271. cs_models/resources/TranscriptTarget/schemas.py +17 -0
  272. cs_models/resources/UserAutomatedDigest/__init__.py +0 -0
  273. cs_models/resources/UserAutomatedDigest/models.py +35 -0
  274. cs_models/resources/UserAutomatedDigest/schemas.py +19 -0
  275. cs_models/resources/UserDocument/models.py +9 -0
  276. cs_models/resources/UserDocument/schemas.py +3 -0
  277. cs_models/resources/UserDocumentAccess/__init__.py +0 -0
  278. cs_models/resources/UserDocumentAccess/models.py +35 -0
  279. cs_models/resources/UserDocumentAccess/schemas.py +19 -0
  280. cs_models/resources/UserDocumentChunk/__init__.py +0 -0
  281. cs_models/resources/UserDocumentChunk/models.py +35 -0
  282. cs_models/resources/UserDocumentChunk/schemas.py +18 -0
  283. cs_models/resources/UserDocumentHierarchy/__init__.py +0 -0
  284. cs_models/resources/UserDocumentHierarchy/models.py +51 -0
  285. cs_models/resources/UserDocumentHierarchy/schemas.py +24 -0
  286. cs_models/resources/UserDocumentMeeting/__init__.py +0 -0
  287. cs_models/resources/UserDocumentMeeting/models.py +33 -0
  288. cs_models/resources/UserDocumentMeeting/schemas.py +14 -0
  289. cs_models/resources/UserDocumentTag/__init__.py +0 -0
  290. cs_models/resources/UserDocumentTag/models.py +31 -0
  291. cs_models/resources/UserDocumentTag/schemas.py +15 -0
  292. cs_models/resources/UserExplorerColumn/__init__.py +0 -0
  293. cs_models/resources/UserExplorerColumn/models.py +30 -0
  294. cs_models/resources/UserExplorerColumn/schemas.py +14 -0
  295. cs_models/resources/UserInternalDocWorkflow/__init__.py +0 -0
  296. cs_models/resources/UserInternalDocWorkflow/models.py +28 -0
  297. cs_models/resources/UserInternalDocWorkflow/schemas.py +11 -0
  298. cs_models/resources/UserMeeting/__init__.py +0 -0
  299. cs_models/resources/UserMeeting/models.py +31 -0
  300. cs_models/resources/UserMeeting/schemas.py +12 -0
  301. cs_models/resources/UserMeetingFavorite/__init__.py +0 -0
  302. cs_models/resources/UserMeetingFavorite/models.py +36 -0
  303. cs_models/resources/UserMeetingFavorite/schemas.py +13 -0
  304. cs_models/resources/UserSavedSearch/models.py +1 -0
  305. cs_models/resources/UserSavedSearch/schemas.py +1 -0
  306. cs_models/resources/UserSavedSearchAccess/__init__.py +0 -0
  307. cs_models/resources/UserSavedSearchAccess/models.py +34 -0
  308. cs_models/resources/UserSavedSearchAccess/schemas.py +18 -0
  309. cs_models/resources/UserSavedSearchCollectionMap/__init__.py +0 -0
  310. cs_models/resources/UserSavedSearchCollectionMap/models.py +33 -0
  311. cs_models/resources/UserSavedSearchCollectionMap/schemas.py +14 -0
  312. cs_models/resources/UserSavedSearchDigest/__init__.py +0 -0
  313. cs_models/resources/UserSavedSearchDigest/models.py +36 -0
  314. cs_models/resources/UserSavedSearchDigest/schemas.py +16 -0
  315. cs_models/resources/UserVAParameterView/__init__.py +0 -0
  316. cs_models/resources/UserVAParameterView/models.py +27 -0
  317. cs_models/resources/UserVAParameterView/schemas.py +13 -0
  318. cs_models/resources/UserWatchlistAccess/__init__.py +0 -0
  319. cs_models/resources/UserWatchlistAccess/models.py +31 -0
  320. cs_models/resources/UserWatchlistAccess/schemas.py +15 -0
  321. cs_models/resources/UserWorkbook/__init__.py +0 -0
  322. cs_models/resources/UserWorkbook/models.py +31 -0
  323. cs_models/resources/UserWorkbook/schemas.py +15 -0
  324. cs_models/resources/UserWorkbookWorkflows/__init__.py +0 -0
  325. cs_models/resources/UserWorkbookWorkflows/models.py +27 -0
  326. cs_models/resources/UserWorkbookWorkflows/schemas.py +15 -0
  327. cs_models/resources/UserWorkbookWorkflowsShared/__init__.py +0 -0
  328. cs_models/resources/UserWorkbookWorkflowsShared/models.py +31 -0
  329. cs_models/resources/UserWorkbookWorkflowsShared/schemas.py +15 -0
  330. cs_models/resources/VACompanyMap/__init__.py +0 -0
  331. cs_models/resources/VACompanyMap/models.py +37 -0
  332. cs_models/resources/VACompanyMap/schemas.py +38 -0
  333. cs_models/resources/VAParameter/__init__.py +0 -0
  334. cs_models/resources/VAParameter/models.py +36 -0
  335. cs_models/resources/VAParameter/schemas.py +25 -0
  336. cs_models/resources/VAParameterCondition/__init__.py +0 -0
  337. cs_models/resources/VAParameterCondition/models.py +41 -0
  338. cs_models/resources/VAParameterCondition/schemas.py +17 -0
  339. cs_models/resources/VAParameterGeography/__init__.py +0 -0
  340. cs_models/resources/VAParameterGeography/models.py +0 -0
  341. cs_models/resources/VAParameterGeography/schemas.py +0 -0
  342. cs_models/resources/VAParameterIntervention/__init__.py +0 -0
  343. cs_models/resources/VAParameterIntervention/models.py +41 -0
  344. cs_models/resources/VAParameterIntervention/schemas.py +17 -0
  345. cs_models/resources/VAParameterValue/__init__.py +0 -0
  346. cs_models/resources/VAParameterValue/models.py +42 -0
  347. cs_models/resources/VAParameterValue/schemas.py +27 -0
  348. cs_models/resources/VAParameterView/__init__.py +0 -0
  349. cs_models/resources/VAParameterView/models.py +35 -0
  350. cs_models/resources/VAParameterView/schemas.py +15 -0
  351. cs_models/resources/ViewPublicAssistantUserQuery/__init__.py +0 -0
  352. cs_models/resources/ViewPublicAssistantUserQuery/models.py +30 -0
  353. cs_models/resources/ViewPublicAssistantUserQuery/schemas.py +14 -0
  354. cs_models/resources/ViewPublicWorkbook/__init__.py +0 -0
  355. cs_models/resources/ViewPublicWorkbook/models.py +30 -0
  356. cs_models/resources/ViewPublicWorkbook/schemas.py +14 -0
  357. cs_models/resources/ViewPublicationCondition/__init__.py +0 -0
  358. cs_models/resources/ViewPublicationCondition/models.py +32 -0
  359. cs_models/resources/ViewPublicationCondition/schemas.py +16 -0
  360. cs_models/resources/WatchlistDigest/__init__.py +0 -0
  361. cs_models/resources/WatchlistDigest/models.py +36 -0
  362. cs_models/resources/WatchlistDigest/schemas.py +16 -0
  363. cs_models/resources/Workbook/__init__.py +0 -0
  364. cs_models/resources/Workbook/models.py +46 -0
  365. cs_models/resources/Workbook/schemas.py +32 -0
  366. cs_models/resources/WorkbookBlock/__init__.py +0 -0
  367. cs_models/resources/WorkbookBlock/models.py +50 -0
  368. cs_models/resources/WorkbookBlock/schemas.py +63 -0
  369. cs_models/resources/WorkbookBlockComment/__init__.py +0 -0
  370. cs_models/resources/WorkbookBlockComment/models.py +36 -0
  371. cs_models/resources/WorkbookBlockComment/schemas.py +15 -0
  372. cs_models/resources/WorkbookCommentThread/__init__.py +0 -0
  373. cs_models/resources/WorkbookCommentThread/models.py +59 -0
  374. cs_models/resources/WorkbookCommentThread/schemas.py +35 -0
  375. cs_models/resources/WorkbookMeta/__init__.py +0 -0
  376. cs_models/resources/WorkbookMeta/models.py +14 -0
  377. cs_models/resources/WorkbookMeta/schemas.py +9 -0
  378. cs_models/resources/WorkbookThreadComment/__init__.py +0 -0
  379. cs_models/resources/WorkbookThreadComment/models.py +38 -0
  380. cs_models/resources/WorkbookThreadComment/schemas.py +14 -0
  381. cs_models/resources/WorkbookWorkflow/__init__.py +0 -0
  382. cs_models/resources/WorkbookWorkflow/models.py +39 -0
  383. cs_models/resources/WorkbookWorkflow/schemas.py +24 -0
  384. cs_models/resources/WorkbookWorkflowBlock/__init__.py +0 -0
  385. cs_models/resources/WorkbookWorkflowBlock/models.py +37 -0
  386. cs_models/resources/WorkbookWorkflowBlock/schemas.py +60 -0
  387. cs_models/utils/utils.py +27 -1
  388. cs_models-0.0.847.dist-info/METADATA +29 -0
  389. {cs_models-0.0.627.dist-info → cs_models-0.0.847.dist-info}/RECORD +391 -52
  390. {cs_models-0.0.627.dist-info → cs_models-0.0.847.dist-info}/WHEEL +1 -1
  391. cs_models-0.0.627.dist-info/METADATA +0 -29
  392. {cs_models-0.0.627.dist-info → cs_models-0.0.847.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,25 @@
1
+ from sqlalchemy import (
2
+ Column,
3
+ Integer,
4
+ String,
5
+ DateTime,
6
+ )
7
+ from datetime import datetime
8
+
9
+ from ...database import Base
10
+
11
+
12
+ class SellSideSourceModel(Base):
13
+ __tablename__ = "sell_side_sources"
14
+
15
+ id = Column(Integer, primary_key=True)
16
+ name = Column(String(255), nullable=False, unique=True) # "Morgan Stanley"
17
+ code = Column(String(64), nullable=False, unique=True) # "MS", "JPM"
18
+
19
+ created_at = Column(DateTime, default=lambda: datetime.utcnow(), nullable=False)
20
+ updated_at = Column(
21
+ DateTime,
22
+ default=lambda: datetime.utcnow(),
23
+ onupdate=lambda: datetime.utcnow(),
24
+ nullable=False,
25
+ )
@@ -0,0 +1,13 @@
1
+ from marshmallow import Schema, fields, validate
2
+
3
+
4
+ class SellSideSourceResourceSchema(Schema):
5
+ id = fields.Integer(dump_only=True)
6
+
7
+ # e.g. "Morgan Stanley"
8
+ name = fields.String(required=True, validate=validate.Length(min=1))
9
+ # e.g. "MS", "JPM"
10
+ code = fields.String(allow_none=True)
11
+
12
+ created_at = fields.DateTime(dump_only=True)
13
+ updated_at = fields.DateTime(dump_only=True)
File without changes
@@ -0,0 +1,15 @@
1
+ from sqlalchemy import Column, Integer, String, Date
2
+ from ...database import Base
3
+
4
+
5
+ class Signature13FModel(Base):
6
+ __tablename__ = '13fsignature'
7
+
8
+ ACCESSION_NUMBER = Column(String(25), primary_key=True)
9
+ NAME = Column(String(150), nullable=False)
10
+ TITLE = Column(String(60), nullable=False)
11
+ PHONE = Column(String(20))
12
+ SIGNATURE = Column(String(150), nullable=False)
13
+ CITY = Column(String(30), nullable=False)
14
+ STATEORCOUNTRY = Column(String(2), nullable=False)
15
+ SIGNATUREDATE = Column(Date, nullable=False)
@@ -0,0 +1,13 @@
1
+ from marshmallow import Schema, fields
2
+ from ...utils.utils import Safe13FDate
3
+
4
+
5
+ class Signature13FSchema(Schema):
6
+ ACCESSION_NUMBER = fields.String(required=True)
7
+ NAME = fields.String(required=True)
8
+ TITLE = fields.String(required=True)
9
+ PHONE = fields.String()
10
+ SIGNATURE = fields.String(required=True)
11
+ CITY = fields.String(required=True)
12
+ STATEORCOUNTRY = fields.String(required=True)
13
+ SIGNATUREDATE = Safe13FDate(required=True)
File without changes
@@ -0,0 +1,30 @@
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(Integer, primary_key=True, autoincrement=True) # table_id (uuid string)
15
+ workbook_id = Column(
16
+ Integer,
17
+ ForeignKey('workbooks.id'),
18
+ nullable=True,
19
+ primary_key=True,
20
+ )
21
+ source_block_id = Column(String(64), nullable=True) # BlockNote block id (if any)
22
+
23
+ outline_version = Column(Integer, nullable=False, default=1) # your normalize() version
24
+ outline_json = Column(JSON, nullable=False) # semantic outline payload
25
+ original_table_json = Column(JSON, nullable=False) # raw BlockNote table node (for rebuilds)
26
+
27
+ created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
28
+ updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
29
+
30
+ 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,51 @@
1
+ from datetime import datetime
2
+ from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, JSON, Boolean, Index, UniqueConstraint
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(Integer, ForeignKey("smart_def_grid_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(
42
+ "SmartDefGridCellValueModel",
43
+ back_populates="cell",
44
+ uselist=False,
45
+ cascade="all, delete-orphan",
46
+ )
47
+
48
+ __table_args__ = (
49
+ UniqueConstraint("smart_def_grid_id", "row", "col", name="uq_sdg_cell_pos"),
50
+ Index("ix_smart_def_grid_cells_header", "smart_def_grid_id", "is_header"),
51
+ )
@@ -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,45 @@
1
+ from datetime import datetime
2
+ from sqlalchemy import Column, DateTime, ForeignKey, Float, String, JSON, Integer, Index, Text, BigInteger, ForeignKeyConstraint
3
+ from sqlalchemy.orm import relationship
4
+ from ...database import Base
5
+
6
+
7
+ class SmartDefGridCellAnswerModel(Base):
8
+ """
9
+ Answers emitted by workers. Keep multiple rows per question (retries, models).
10
+ """
11
+ __tablename__ = "smart_def_grid_cell_answers"
12
+
13
+ id = Column(BigInteger, primary_key=True, autoincrement=True)
14
+ question_id = Column(Integer, ForeignKey("smart_def_grid_cell_questions.id", ondelete="CASCADE"), nullable=False)
15
+
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)
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
+ ForeignKeyConstraint(
36
+ ["smart_def_grid_id", "cell_id"],
37
+ ["smart_def_grid_cells.smart_def_grid_id", "smart_def_grid_cells.cell_id"],
38
+ ondelete="CASCADE",
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"),
42
+ )
43
+
44
+ question = relationship("SmartDefGridCellQuestionModel", back_populates="answers")
45
+ run = relationship("SmartDefGridRunModel")
@@ -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)
@@ -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
@@ -0,0 +1,76 @@
1
+ import enum
2
+ from datetime import datetime
3
+ from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, JSON, Boolean, Index, Text, Enum, ForeignKeyConstraint
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
+ cancelled = "cancelled" # cancelled
15
+
16
+
17
+ class ExpectedType(str, enum.Enum):
18
+ number = "number"
19
+ text = "text"
20
+
21
+
22
+ class SmartDefGridCellQuestionModel(Base):
23
+ """
24
+ One question per cell (you may create new ones on re-ask/revision).
25
+ """
26
+ __tablename__ = "smart_def_grid_cell_questions"
27
+
28
+ id = Column(Integer, primary_key=True, autoincrement=True) # question_id (uuid)
29
+ smart_def_grid_id = Column(Integer, ForeignKey("smart_def_grids.id", ondelete="CASCADE"), nullable=False)
30
+ run_id = Column(Integer, ForeignKey("smart_def_grid_runs.id", ondelete="SET NULL"), nullable=True)
31
+ cell_id = Column(String(36), nullable=False)
32
+
33
+ question_text = Column(Text, nullable=False)
34
+ expected_type = Column(Enum(ExpectedType), nullable=False)
35
+ must_cite = Column(Boolean, nullable=False, default=True)
36
+
37
+ topic_key = Column(JSON, nullable=True)
38
+ retrieval_hints = Column(JSON, nullable=True)
39
+
40
+ # Answer
41
+ answer_text = Column(Text, nullable=True)
42
+ answer_info = Column(JSON, nullable=True)
43
+
44
+ # Queue & lifecycle
45
+ status = Column(Enum(QuestionStatus), nullable=False, default=QuestionStatus.pending)
46
+ priority = Column(Integer, nullable=False, default=5) # lower = higher priority
47
+ attempts = Column(Integer, nullable=False, default=0)
48
+ last_error = Column(Text, nullable=True)
49
+
50
+ idempotency_key = Column(String(64), nullable=True) # to avoid dup work
51
+ dedupe_hash = Column(String(64), nullable=True) # e.g., hash(table_id, cell_id, question_text)
52
+
53
+ created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
54
+ updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
55
+ started_at = Column(DateTime, nullable=True)
56
+ finished_at = Column(DateTime, nullable=True)
57
+
58
+ # relationships
59
+ answers = relationship("SmartDefGridCellAnswerModel", back_populates="question", cascade="all, delete-orphan")
60
+ run = relationship("SmartDefGridRunModel")
61
+
62
+ __table_args__ = (
63
+ # Useful to grab next jobs: status+priority+created
64
+ Index("ix_smart_def_grid_cell_questions_queue", "status", "priority", "created_at"),
65
+ # Quick lookup for this cell's active question(s)
66
+ Index("ix_smart_def_grid_cell_questions_cell", "smart_def_grid_id", "cell_id"),
67
+ Index("ix_sdgcq_run_status", "run_id", "status", "priority", "created_at"),
68
+ Index("ix_sdgcq_run_cell", "run_id", "smart_def_grid_id", "cell_id"),
69
+ ForeignKeyConstraint(
70
+ ["smart_def_grid_id", "cell_id"],
71
+ ["smart_def_grid_cells.smart_def_grid_id", "smart_def_grid_cells.cell_id"],
72
+ ondelete="CASCADE",
73
+ ),
74
+ # strong uniqueness if you want only one ACTIVE per cell; or enforce app-side
75
+ # UniqueConstraint("table_id", "cell_id", "status", name="uq_cell_question_cell_status"),
76
+ )
@@ -0,0 +1,41 @@
1
+ from marshmallow import Schema, fields, validate
2
+ from ..SmartDefGridCellAnswer.schemas import SmartDefGridCellAnswerResourceSchema
3
+
4
+
5
+ QUESTION_STATUS = ["pending", "queued", "running", "succeeded", "failed", "cancelled"]
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
+ run_id = fields.Integer(allow_none=True)
15
+ cell_id = fields.String(required=True)
16
+
17
+ question_text = fields.String(required=True, validate=not_blank)
18
+ expected_type = fields.String(required=True, validate=validate.OneOf(EXPECTED_TYPE))
19
+ must_cite = fields.Boolean(required=True)
20
+
21
+ topic_key = fields.Raw(allow_none=True) # e.g., {"row":[...], "col":[...]}
22
+ retrieval_hints = fields.Raw(allow_none=True)
23
+
24
+ answer_text = fields.String(allow_none=True)
25
+ answer_info = fields.Raw(allow_none=True)
26
+
27
+ status = fields.String(required=True, validate=validate.OneOf(QUESTION_STATUS))
28
+ priority = fields.Integer(required=True)
29
+ attempts = fields.Integer(required=True)
30
+ last_error = fields.String(allow_none=True)
31
+
32
+ idempotency_key = fields.String(allow_none=True)
33
+ dedupe_hash = fields.String(allow_none=True)
34
+
35
+ created_at = fields.DateTime(dump_only=True)
36
+ updated_at = fields.DateTime(dump_only=True)
37
+ started_at = fields.DateTime(dump_only=True)
38
+ finished_at = fields.DateTime(dump_only=True)
39
+
40
+ # light nesting of answers on read
41
+ answers = fields.Nested(SmartDefGridCellAnswerResourceSchema(), many=True, dump_only=True)
File without changes
@@ -0,0 +1,54 @@
1
+ from datetime import datetime
2
+ from sqlalchemy import Column, DateTime, ForeignKey, Float, String, JSON, Boolean, Integer, Text, ForeignKeyConstraint, and_
3
+ from sqlalchemy.orm import relationship
4
+ from ...database import Base
5
+ from ..SmartDefGridCell.models import SmartDefGridCellModel
6
+
7
+
8
+ class SmartDefGridCellValueModel(Base):
9
+ """
10
+ The canonical, last-applied value for a cell in the user table (what's rendered back).
11
+ This is what your UI reads to show the latest state (without opening BlockNote).
12
+ """
13
+ __tablename__ = "smart_def_grid_cell_values"
14
+
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)
17
+ cell_id = Column(String(36), primary_key=True)
18
+
19
+ # applied value derived from a specific answer_id (or manual override)
20
+ answer_id = Column(Integer, ForeignKey("smart_def_grid_cell_answers.id", ondelete="SET NULL"), nullable=True)
21
+ raw_value = Column(Float, nullable=True)
22
+ display_text = Column(Text, nullable=True)
23
+ citations = Column(JSON, nullable=True)
24
+ formatting_used = Column(JSON, nullable=True) # snapshot of FormattingSpec used to render
25
+
26
+ # flags
27
+ manual_override = Column(Boolean, nullable=False, default=False)
28
+ note = Column(Text, nullable=True)
29
+
30
+ applied_at = Column(DateTime, default=datetime.utcnow, nullable=False)
31
+ updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
32
+
33
+ __table_args__ = (
34
+ ForeignKeyConstraint(
35
+ ["smart_def_grid_id", "cell_id"],
36
+ ["smart_def_grid_cells.smart_def_grid_id", "smart_def_grid_cells.cell_id"],
37
+ ondelete="CASCADE",
38
+ ),
39
+ )
40
+
41
+ # relationships
42
+ cell = relationship(
43
+ "SmartDefGridCellModel",
44
+ back_populates="applied_value",
45
+ uselist=False,
46
+ primaryjoin=lambda: and_(
47
+ SmartDefGridCellValueModel.smart_def_grid_id == SmartDefGridCellModel.smart_def_grid_id,
48
+ SmartDefGridCellValueModel.cell_id == SmartDefGridCellModel.cell_id,
49
+ ),
50
+ foreign_keys=lambda: [SmartDefGridCellValueModel.smart_def_grid_id, SmartDefGridCellValueModel.cell_id],
51
+ )
52
+
53
+ answer = relationship("SmartDefGridCellAnswerModel", foreign_keys=[answer_id])
54
+ applied_run = relationship("SmartDefGridRunModel")
@@ -0,0 +1,19 @@
1
+ from marshmallow import Schema, fields
2
+
3
+
4
+ class SmartDefGridCellValueResourceSchema(Schema):
5
+ smart_def_grid_id = fields.Integer(required=True)
6
+ applied_run_id = fields.Integer(allow_none=True)
7
+ cell_id = fields.String(required=True)
8
+
9
+ answer_id = fields.Integer(allow_none=True)
10
+ raw_value = fields.Float(allow_none=True)
11
+ display_text = fields.String(allow_none=True)
12
+ citations = fields.Raw(allow_none=True)
13
+ formatting_used = fields.Raw(allow_none=True)
14
+
15
+ manual_override = fields.Boolean(required=True, default=False)
16
+ note = fields.String(allow_none=True)
17
+
18
+ applied_at = fields.DateTime(dump_only=True)
19
+ updated_at = fields.DateTime(dump_only=True)
File without changes
@@ -0,0 +1,60 @@
1
+ from enum import Enum
2
+ from datetime import datetime
3
+ from sqlalchemy import Enum as SAEnum
4
+ from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, JSON, Text, Index
5
+ from sqlalchemy.orm import relationship
6
+ from ...database import Base
7
+
8
+
9
+ class SmartDefGridRunStatus(str, Enum):
10
+ created = "created"
11
+ dispatched = "dispatched"
12
+ running = "running"
13
+ succeeded = "succeeded"
14
+ failed = "failed"
15
+ cancelled = "cancelled"
16
+ partial = "partial" # finished with some failed cells
17
+
18
+
19
+ class SmartDefGridRunScope(str, Enum):
20
+ all = "all"
21
+ empty_only = "empty_only"
22
+
23
+
24
+ class SmartDefGridRunModel(Base):
25
+ __tablename__ = "smart_def_grid_runs"
26
+
27
+ id = Column(Integer, primary_key=True, autoincrement=True) # run_id
28
+ smart_def_grid_id = Column(Integer, ForeignKey("smart_def_grids.id", ondelete="CASCADE"), nullable=False)
29
+
30
+ scope_mode = Column(SAEnum(SmartDefGridRunScope), nullable=False, default=SmartDefGridRunScope.all)
31
+
32
+ # optional snapshotting to make runs reproducible/debuggable
33
+ outline_json = Column(JSON, nullable=False) # new outline created for this run
34
+ original_table_json = Column(JSON, nullable=False) # stamped block at run start
35
+ targets_json = Column(JSON, nullable=True)
36
+
37
+ # execution metadata
38
+ status = Column(
39
+ SAEnum(
40
+ SmartDefGridRunStatus,
41
+ validate_strings=True, # allow assigning "created" etc. as strings too
42
+ ),
43
+ nullable=False,
44
+ default=SmartDefGridRunStatus.created,
45
+ )
46
+
47
+ started_by_user_id = Column(String(64), nullable=False)
48
+ notes = Column(Text, nullable=True)
49
+ # optional idempotency token if you want “re-run latest”
50
+ client_token = Column(String(128), nullable=True, index=True)
51
+
52
+ created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
53
+ started_at = Column(DateTime, nullable=True)
54
+ finished_at = Column(DateTime, nullable=True)
55
+ updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
56
+
57
+ grid = relationship("SmartDefGridModel", backref="runs")
58
+ __table_args__ = (
59
+ Index("ix_sdgr_runs_grid_created", "smart_def_grid_id", "created_at"),
60
+ )
@@ -0,0 +1,31 @@
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
+ scope_mode = fields.String(required=True)
16
+
17
+ # prefer dicts; switch to fields.String if you store JSON-serialized strings
18
+ outline_json = fields.Raw(required=True)
19
+ original_table_json = fields.Raw(required=True)
20
+ targets_json = fields.Raw(allow_none=True)
21
+
22
+ status = fields.String(required=True)
23
+ started_by_user_id = fields.String(required=True)
24
+
25
+ notes = fields.String(allow_none=True)
26
+ client_token = fields.String(allow_none=True)
27
+
28
+ created_at = fields.DateTime(dump_only=True)
29
+ started_at = fields.DateTime(allow_none=True)
30
+ finished_at = fields.DateTime(allow_none=True)
31
+ updated_at = fields.DateTime(dump_only=True)
File without changes