sapiopycommons 2025.2.17a438__py3-none-any.whl → 2025.2.20a441__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 sapiopycommons might be problematic. Click here for more details.
- sapiopycommons/ai/tool_of_tools.py +34 -0
- {sapiopycommons-2025.2.17a438.dist-info → sapiopycommons-2025.2.20a441.dist-info}/METADATA +1 -1
- {sapiopycommons-2025.2.17a438.dist-info → sapiopycommons-2025.2.20a441.dist-info}/RECORD +5 -5
- {sapiopycommons-2025.2.17a438.dist-info → sapiopycommons-2025.2.20a441.dist-info}/WHEEL +0 -0
- {sapiopycommons-2025.2.17a438.dist-info → sapiopycommons-2025.2.20a441.dist-info}/licenses/LICENSE +0 -0
|
@@ -4,7 +4,9 @@ import math
|
|
|
4
4
|
import re
|
|
5
5
|
from typing import Final, Mapping, Any
|
|
6
6
|
|
|
7
|
+
import requests
|
|
7
8
|
from pandas import DataFrame
|
|
9
|
+
from requests import Response
|
|
8
10
|
from sapiopylib.rest.DataRecordManagerService import DataRecordManager
|
|
9
11
|
from sapiopylib.rest.DataTypeService import DataTypeManager
|
|
10
12
|
from sapiopylib.rest.ELNService import ElnManager
|
|
@@ -205,6 +207,20 @@ class AiHelper:
|
|
|
205
207
|
self.eln_man = ElnManager(self.user)
|
|
206
208
|
self.dt_man = DataTypeManager(self.user)
|
|
207
209
|
|
|
210
|
+
def call_endpoint(self, url: str, payload: Any, tab_prefix: str = "") -> Response:
|
|
211
|
+
"""
|
|
212
|
+
Call a tool endpoint. Constructs the tool headers and checks the response for errors for the caller.
|
|
213
|
+
|
|
214
|
+
:param url: The URL of the endpoint to call.
|
|
215
|
+
:param payload: The payload to send to the endpoint.
|
|
216
|
+
:param tab_prefix: The prefix to use for the tab name that will be created by the tool.
|
|
217
|
+
:return: The Response object returned by the endpoint.
|
|
218
|
+
"""
|
|
219
|
+
headers = create_tot_headers(self.user.url, self.user.username, self.user.password, self.exp_id, tab_prefix)
|
|
220
|
+
response = requests.post(url, json=payload, headers=headers)
|
|
221
|
+
response.raise_for_status()
|
|
222
|
+
return response
|
|
223
|
+
|
|
208
224
|
@property
|
|
209
225
|
def protocol(self) -> ElnExperimentProtocol:
|
|
210
226
|
"""
|
|
@@ -481,6 +497,24 @@ class AiHelper:
|
|
|
481
497
|
with io.BytesIO(image) as bytes_io:
|
|
482
498
|
self.dr_man.set_record_image(record, bytes_io)
|
|
483
499
|
|
|
500
|
+
def create_bar_chart(self, entry_name: str, source_entry: ExperimentEntry, tab: ElnExperimentTab,
|
|
501
|
+
x_axis: str, y_axis: str) -> ExperimentEntry:
|
|
502
|
+
"""
|
|
503
|
+
Create a bar chart in the experiment based on the contents of the given source entry.
|
|
504
|
+
|
|
505
|
+
:param entry_name: The name of the bar chart.
|
|
506
|
+
:param source_entry: The source entry to base the bar chart on.
|
|
507
|
+
:param tab: The tab to create the bar chart in.
|
|
508
|
+
:param x_axis: The field to use for the x-axis.
|
|
509
|
+
:param y_axis: The field to use for the y-axis.
|
|
510
|
+
:return: The newly created bar chart entry.
|
|
511
|
+
"""
|
|
512
|
+
protocol = self.protocol
|
|
513
|
+
source_step = ElnEntryStep(protocol, source_entry)
|
|
514
|
+
position = ElnEntryPosition(tab.tab_id, self.tab_next_entry_order(tab))
|
|
515
|
+
return ELNStepFactory.create_bar_chart_step(protocol, source_step, entry_name,
|
|
516
|
+
x_axis, y_axis, position=position)[0].eln_entry
|
|
517
|
+
|
|
484
518
|
|
|
485
519
|
class ToolOfToolsHelper:
|
|
486
520
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sapiopycommons
|
|
3
|
-
Version: 2025.2.
|
|
3
|
+
Version: 2025.2.20a441
|
|
4
4
|
Summary: Official Sapio Python API Utilities Package
|
|
5
5
|
Project-URL: Homepage, https://github.com/sapiosciences
|
|
6
6
|
Author-email: Jonathan Steck <jsteck@sapiosciences.com>, Yechen Qiao <yqiao@sapiosciences.com>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
sapiopycommons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
sapiopycommons/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
sapiopycommons/ai/tool_of_tools.py,sha256=
|
|
3
|
+
sapiopycommons/ai/tool_of_tools.py,sha256=QnhdznM3I1dqD5QDwMhM6c2xH914_MgugL4G0D2svZI,39407
|
|
4
4
|
sapiopycommons/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
sapiopycommons/callbacks/callback_util.py,sha256=68lPK8GtE6zd8C0fQaMLxT57PtU-6HnO37Zk-u56Mrs,129933
|
|
6
6
|
sapiopycommons/callbacks/field_builder.py,sha256=p2XacN99MuKk3ite8GAqstUMpixqugul2CsC4gB83-o,38620
|
|
@@ -58,7 +58,7 @@ sapiopycommons/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
58
58
|
sapiopycommons/webhook/webhook_context.py,sha256=D793uLsb1691SalaPnBUk3rOSxn_hYLhdvkaIxjNXss,1909
|
|
59
59
|
sapiopycommons/webhook/webhook_handlers.py,sha256=L0HetSm43NvA5KyW3xbLpGFh2DbAaeZJVtXIEl2fvV8,39689
|
|
60
60
|
sapiopycommons/webhook/webservice_handlers.py,sha256=Y5dHx_UFWFuSqaoPL6Re-fsKYRuxvCWZ8bj6KSZ3jfM,14285
|
|
61
|
-
sapiopycommons-2025.2.
|
|
62
|
-
sapiopycommons-2025.2.
|
|
63
|
-
sapiopycommons-2025.2.
|
|
64
|
-
sapiopycommons-2025.2.
|
|
61
|
+
sapiopycommons-2025.2.20a441.dist-info/METADATA,sha256=CJZwHk1HWCyBq4eNjrszU3wFMgNAaTfZu80aKepw9JU,3143
|
|
62
|
+
sapiopycommons-2025.2.20a441.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
63
|
+
sapiopycommons-2025.2.20a441.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
|
64
|
+
sapiopycommons-2025.2.20a441.dist-info/RECORD,,
|
|
File without changes
|
{sapiopycommons-2025.2.17a438.dist-info → sapiopycommons-2025.2.20a441.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|