seer-pas-sdk 0.3.0__py3-none-any.whl → 0.3.1__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.
- seer_pas_sdk/core/sdk.py +56 -21
- {seer_pas_sdk-0.3.0.dist-info → seer_pas_sdk-0.3.1.dist-info}/METADATA +1 -1
- {seer_pas_sdk-0.3.0.dist-info → seer_pas_sdk-0.3.1.dist-info}/RECORD +6 -6
- {seer_pas_sdk-0.3.0.dist-info → seer_pas_sdk-0.3.1.dist-info}/WHEEL +0 -0
- {seer_pas_sdk-0.3.0.dist-info → seer_pas_sdk-0.3.1.dist-info}/licenses/LICENSE.txt +0 -0
- {seer_pas_sdk-0.3.0.dist-info → seer_pas_sdk-0.3.1.dist-info}/top_level.txt +0 -0
seer_pas_sdk/core/sdk.py
CHANGED
|
@@ -114,11 +114,11 @@ class SeerSDK:
|
|
|
114
114
|
tenants : dict[str, str]
|
|
115
115
|
A dictionary containing the institution names and tenant ids for the authenticated user.
|
|
116
116
|
"""
|
|
117
|
-
tenants = self.get_user_tenant()
|
|
117
|
+
tenants = self.get_user_tenant(index=False)
|
|
118
118
|
if reverse:
|
|
119
|
-
return {x["tenantId"]: x["institution"] for x in tenants
|
|
119
|
+
return {x["tenantId"]: x["institution"] for x in tenants}
|
|
120
120
|
else:
|
|
121
|
-
return {x["institution"]: x["tenantId"] for x in tenants
|
|
121
|
+
return {x["institution"]: x["tenantId"] for x in tenants}
|
|
122
122
|
|
|
123
123
|
def switch_tenant(self, identifier: str):
|
|
124
124
|
"""
|
|
@@ -251,7 +251,9 @@ class SeerSDK:
|
|
|
251
251
|
)
|
|
252
252
|
return spaces.json()
|
|
253
253
|
|
|
254
|
-
def get_plates(
|
|
254
|
+
def get_plates(
|
|
255
|
+
self, plate_id: str = None, plate_name: str = None, as_df: bool = False
|
|
256
|
+
):
|
|
255
257
|
"""
|
|
256
258
|
Fetches a list of plates for the authenticated user. If no `plate_id` is provided, returns all plates for the authenticated user. If `plate_id` is provided, returns the plate with the given `plate_id`, provided it exists.
|
|
257
259
|
|
|
@@ -298,11 +300,18 @@ class SeerSDK:
|
|
|
298
300
|
URL = f"{self._auth.url}api/v1/plates"
|
|
299
301
|
res = []
|
|
300
302
|
|
|
303
|
+
if not plate_id and not plate_name:
|
|
304
|
+
params = {"all": "true"}
|
|
305
|
+
elif plate_name:
|
|
306
|
+
params = {"searchFields": "plate_name", "searchItem": plate_name}
|
|
307
|
+
else:
|
|
308
|
+
params = dict()
|
|
309
|
+
|
|
301
310
|
with self._get_auth_session() as s:
|
|
302
311
|
|
|
303
312
|
plates = s.get(
|
|
304
313
|
f"{URL}/{plate_id}" if plate_id else URL,
|
|
305
|
-
params=
|
|
314
|
+
params=params,
|
|
306
315
|
)
|
|
307
316
|
if plates.status_code != 200:
|
|
308
317
|
raise ValueError(
|
|
@@ -318,7 +327,12 @@ class SeerSDK:
|
|
|
318
327
|
|
|
319
328
|
return res if not as_df else dict_to_df(res)
|
|
320
329
|
|
|
321
|
-
def get_projects(
|
|
330
|
+
def get_projects(
|
|
331
|
+
self,
|
|
332
|
+
project_id: str = None,
|
|
333
|
+
project_name: str = None,
|
|
334
|
+
as_df: bool = False,
|
|
335
|
+
):
|
|
322
336
|
"""
|
|
323
337
|
Fetches a list of projects for the authenticated user. If no `project_id` is provided, returns all projects for the authenticated user. If `project_id` is provided, returns the project with the given `project_id`, provided it exists.
|
|
324
338
|
|
|
@@ -369,10 +383,19 @@ class SeerSDK:
|
|
|
369
383
|
else f"{self._auth.url}api/v1/projects/{project_id}"
|
|
370
384
|
)
|
|
371
385
|
res = []
|
|
386
|
+
if not project_id and not project_name:
|
|
387
|
+
params = {"all": "true"}
|
|
388
|
+
elif project_name:
|
|
389
|
+
params = {
|
|
390
|
+
"searchFields": "project_name",
|
|
391
|
+
"searchItem": project_name,
|
|
392
|
+
}
|
|
393
|
+
else:
|
|
394
|
+
params = dict()
|
|
372
395
|
|
|
373
396
|
with self._get_auth_session() as s:
|
|
374
397
|
|
|
375
|
-
projects = s.get(URL, params=
|
|
398
|
+
projects = s.get(URL, params=params)
|
|
376
399
|
if projects.status_code != 200:
|
|
377
400
|
raise ValueError(
|
|
378
401
|
"Invalid request. Please check your parameters."
|
|
@@ -679,6 +702,7 @@ class SeerSDK:
|
|
|
679
702
|
self,
|
|
680
703
|
analysis_protocol_name: str = None,
|
|
681
704
|
analysis_protocol_id: str = None,
|
|
705
|
+
as_df: bool = False,
|
|
682
706
|
):
|
|
683
707
|
"""
|
|
684
708
|
Fetches a list of analysis protocols for the authenticated user. If no `analysis_protocol_id` is provided, returns all analysis protocols for the authenticated user. If `analysis_protocol_name` (and no `analysis_protocol_id`) is provided, returns the analysis protocol with the given name, provided it exists.
|
|
@@ -691,6 +715,8 @@ class SeerSDK:
|
|
|
691
715
|
analysis_protocol_name : str, optional
|
|
692
716
|
Name of the analysis protocol to be fetched, defaulted to None.
|
|
693
717
|
|
|
718
|
+
as_df : bool, optional
|
|
719
|
+
whether the result should be converted to a DataFrame, defaulted to False.
|
|
694
720
|
Returns
|
|
695
721
|
-------
|
|
696
722
|
protocols: list[dict]
|
|
@@ -724,32 +750,41 @@ class SeerSDK:
|
|
|
724
750
|
else f"{self._auth.url}api/v1/analysisProtocols/{analysis_protocol_id}"
|
|
725
751
|
)
|
|
726
752
|
res = []
|
|
753
|
+
params = {"all": "true"}
|
|
754
|
+
|
|
755
|
+
if analysis_protocol_name:
|
|
756
|
+
params.update(
|
|
757
|
+
{
|
|
758
|
+
"searchFields": "analysis_protocol_name,offering_name",
|
|
759
|
+
"searchItem": analysis_protocol_name,
|
|
760
|
+
}
|
|
761
|
+
)
|
|
727
762
|
|
|
728
763
|
with self._get_auth_session() as s:
|
|
729
764
|
|
|
730
|
-
protocols = s.get(URL, params=
|
|
765
|
+
protocols = s.get(URL, params=params)
|
|
731
766
|
if protocols.status_code != 200:
|
|
732
767
|
raise ValueError(
|
|
733
768
|
"Invalid request. Please check your parameters."
|
|
734
769
|
)
|
|
735
|
-
if
|
|
736
|
-
res = protocols.json()["data"]
|
|
737
|
-
|
|
738
|
-
if analysis_protocol_id and not analysis_protocol_name:
|
|
770
|
+
if analysis_protocol_id:
|
|
739
771
|
res = [protocols.json()]
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
res = [
|
|
743
|
-
protocol
|
|
744
|
-
for protocol in protocols.json()["data"]
|
|
745
|
-
if protocol["analysis_protocol_name"]
|
|
746
|
-
== analysis_protocol_name
|
|
747
|
-
]
|
|
772
|
+
else:
|
|
773
|
+
res = protocols.json()["data"]
|
|
748
774
|
|
|
749
775
|
for entry in range(len(res)):
|
|
750
776
|
if "tenant_id" in res[entry]:
|
|
751
777
|
del res[entry]["tenant_id"]
|
|
752
778
|
|
|
779
|
+
if "can_edit" in res[entry]:
|
|
780
|
+
del res[entry]["can_edit"]
|
|
781
|
+
|
|
782
|
+
if "can_delete" in res[entry]:
|
|
783
|
+
del res[entry]["can_delete"]
|
|
784
|
+
|
|
785
|
+
if "scope" in res[entry]:
|
|
786
|
+
del res[entry]["scope"]
|
|
787
|
+
|
|
753
788
|
if "parameter_file_path" in res[entry]:
|
|
754
789
|
# Simple lambda function to find the third occurrence of '/' in the raw file path
|
|
755
790
|
location = lambda s: len(s) - len(s.split("/", 3)[-1])
|
|
@@ -758,7 +793,7 @@ class SeerSDK:
|
|
|
758
793
|
"parameter_file_path"
|
|
759
794
|
][location(res[entry]["parameter_file_path"]) :]
|
|
760
795
|
|
|
761
|
-
return res
|
|
796
|
+
return res if not as_df else dict_to_df(res)
|
|
762
797
|
|
|
763
798
|
def get_analyses(
|
|
764
799
|
self,
|
|
@@ -5,14 +5,14 @@ seer_pas_sdk/common/__init__.py,sha256=jA5qm-t9x3qXMp5Q6v7vV2kZdLw32-lnbtf0fPY4l
|
|
|
5
5
|
seer_pas_sdk/common/errors.py,sha256=4HFORWnaQQCMXRE8kwdsJWvQRB_3KFEZ7yMb391e4gA,142
|
|
6
6
|
seer_pas_sdk/common/groupanalysis.py,sha256=DxB-gbQfYzl7p9MTYWDIqghcH-IeakzdYdrRZrlIHek,1730
|
|
7
7
|
seer_pas_sdk/core/__init__.py,sha256=rxbKgg-Qe24OaxX2zyHHYPYgDCTEKE_-41bB2wvpvL4,25
|
|
8
|
-
seer_pas_sdk/core/sdk.py,sha256=
|
|
8
|
+
seer_pas_sdk/core/sdk.py,sha256=MXBFuatXU2rqjm99FZ23Hmnm0L_4d-4OORf7Avflbx4,102212
|
|
9
9
|
seer_pas_sdk/core/unsupported.py,sha256=XAPZ3tidqjnsgftf3NUdTGIzvnsjHy0e_eGRCAo6GPo,59890
|
|
10
10
|
seer_pas_sdk/objects/__init__.py,sha256=HJLS6sOr7DfzdI14fv5dWcITEj5QQsKcdfED3YNvUrY,107
|
|
11
11
|
seer_pas_sdk/objects/groupanalysis.py,sha256=x3D_5NmYBoPDilNCQqUoCFARIfIeUq4FBY3_N6u8tfM,994
|
|
12
12
|
seer_pas_sdk/objects/platemap.py,sha256=8IvJPAecs_e_FyqibzhCw-O4zjCFnf-zMUp_5krTEsg,5864
|
|
13
13
|
seer_pas_sdk/objects/volcanoplot.py,sha256=tKuCWDIdoO8FLJlhpXhuwHn0aMYnvudTugxAslDXyGs,9357
|
|
14
|
-
seer_pas_sdk-0.3.
|
|
15
|
-
seer_pas_sdk-0.3.
|
|
16
|
-
seer_pas_sdk-0.3.
|
|
17
|
-
seer_pas_sdk-0.3.
|
|
18
|
-
seer_pas_sdk-0.3.
|
|
14
|
+
seer_pas_sdk-0.3.1.dist-info/licenses/LICENSE.txt,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
|
|
15
|
+
seer_pas_sdk-0.3.1.dist-info/METADATA,sha256=bW46nTpxACeDXYlqw3inU9EHDyQ-OlmnkJPxqaQKS-0,13448
|
|
16
|
+
seer_pas_sdk-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
17
|
+
seer_pas_sdk-0.3.1.dist-info/top_level.txt,sha256=-2kZ-KFMGtXwr8H1O5llMKlcJ8gRKohEmrIvazXB61s,13
|
|
18
|
+
seer_pas_sdk-0.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|