qmenta-client 1.1.dev1311__py3-none-any.whl → 1.1.dev1326__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.
- qmenta/client/Project.py +71 -73
- {qmenta_client-1.1.dev1311.dist-info → qmenta_client-1.1.dev1326.dist-info}/METADATA +1 -1
- {qmenta_client-1.1.dev1311.dist-info → qmenta_client-1.1.dev1326.dist-info}/RECORD +4 -4
- {qmenta_client-1.1.dev1311.dist-info → qmenta_client-1.1.dev1326.dist-info}/WHEEL +0 -0
qmenta/client/Project.py
CHANGED
|
@@ -154,8 +154,8 @@ def wrap_search_criteria(search_criteria={}):
|
|
|
154
154
|
'from pars_tags'
|
|
155
155
|
|
|
156
156
|
file_metadata : Dict
|
|
157
|
-
Dictionary containing the file metadata of
|
|
158
|
-
|
|
157
|
+
Dictionary containing the file metadata of the search criteria
|
|
158
|
+
extracted from 'pars_[dicom]_KEY'
|
|
159
159
|
"""
|
|
160
160
|
|
|
161
161
|
# The keys not included bellow apply to the whole session.
|
|
@@ -829,10 +829,12 @@ class Project:
|
|
|
829
829
|
analysis = self.list_analysis(limit)
|
|
830
830
|
return [{"name": a["name"], "id": a["out_container_id"]} for a in analysis]
|
|
831
831
|
|
|
832
|
-
def list_container_files(
|
|
832
|
+
def list_container_files(
|
|
833
|
+
self,
|
|
834
|
+
container_id,
|
|
835
|
+
):
|
|
833
836
|
"""
|
|
834
837
|
List the name of the files available inside a given container.
|
|
835
|
-
|
|
836
838
|
Parameters
|
|
837
839
|
----------
|
|
838
840
|
container_id : str or int
|
|
@@ -852,12 +854,73 @@ class Project:
|
|
|
852
854
|
except errors.PlatformError as e:
|
|
853
855
|
logging.getLogger(logger_name).error(e)
|
|
854
856
|
return False
|
|
855
|
-
|
|
856
|
-
try:
|
|
857
|
-
return content["files"]
|
|
858
|
-
except KeyError:
|
|
857
|
+
if "files" not in content.keys():
|
|
859
858
|
logging.getLogger(logger_name).error("Could not get files")
|
|
860
859
|
return False
|
|
860
|
+
return content["files"]
|
|
861
|
+
|
|
862
|
+
def list_container_filter_files(
|
|
863
|
+
self,
|
|
864
|
+
container_id,
|
|
865
|
+
modality="",
|
|
866
|
+
metadata_info={},
|
|
867
|
+
tags=[]
|
|
868
|
+
):
|
|
869
|
+
"""
|
|
870
|
+
List the name of the files available inside a given container.
|
|
871
|
+
search condition example:
|
|
872
|
+
"metadata": {"SliceThickness":1},
|
|
873
|
+
}
|
|
874
|
+
Parameters
|
|
875
|
+
----------
|
|
876
|
+
container_id : str or int
|
|
877
|
+
Container identifier.
|
|
878
|
+
|
|
879
|
+
modality: str
|
|
880
|
+
String containing the modality of the files being filtered
|
|
881
|
+
|
|
882
|
+
metadata_info: dict
|
|
883
|
+
Dictionary containing the file metadata of the files being filtered
|
|
884
|
+
|
|
885
|
+
tags: list[str]
|
|
886
|
+
List of strings containing the tags of the files being filtered
|
|
887
|
+
|
|
888
|
+
Returns
|
|
889
|
+
-------
|
|
890
|
+
selected_files: list[str]
|
|
891
|
+
List of file names (strings)
|
|
892
|
+
"""
|
|
893
|
+
content_files = self.list_container_files(container_id)
|
|
894
|
+
content_meta = self.list_container_files_metadata(container_id)
|
|
895
|
+
selected_files = []
|
|
896
|
+
for index, file in enumerate(content_files):
|
|
897
|
+
metadata_file = content_meta[index]
|
|
898
|
+
tags_file = metadata_file.get("tags")
|
|
899
|
+
tags_bool = [tag in tags_file for tag in tags]
|
|
900
|
+
info_bool = []
|
|
901
|
+
if modality == "":
|
|
902
|
+
modality_bool = True
|
|
903
|
+
else:
|
|
904
|
+
modality_bool = modality == metadata_file["metadata"].get(
|
|
905
|
+
"modality"
|
|
906
|
+
)
|
|
907
|
+
for key in metadata_info.keys():
|
|
908
|
+
meta_key = (
|
|
909
|
+
(
|
|
910
|
+
metadata_file.get("metadata") or {}
|
|
911
|
+
).get("info") or {}).get(
|
|
912
|
+
key
|
|
913
|
+
)
|
|
914
|
+
if meta_key is None:
|
|
915
|
+
logging.getLogger(logger_name).warning(
|
|
916
|
+
f"{key} is not in file_info from file {file}"
|
|
917
|
+
)
|
|
918
|
+
info_bool.append(
|
|
919
|
+
metadata_info[key] == meta_key
|
|
920
|
+
)
|
|
921
|
+
if all(tags_bool) and all(info_bool) and modality_bool:
|
|
922
|
+
selected_files.append(file)
|
|
923
|
+
return selected_files
|
|
861
924
|
|
|
862
925
|
def list_container_files_metadata(self, container_id):
|
|
863
926
|
"""
|
|
@@ -1835,71 +1898,6 @@ class Project:
|
|
|
1835
1898
|
raise Exception(f"Must specify {patient_secret_name} and {ssid} or {analysis_id}.")
|
|
1836
1899
|
return to_return
|
|
1837
1900
|
|
|
1838
|
-
def start_multiple_analyses(
|
|
1839
|
-
self,
|
|
1840
|
-
script_name,
|
|
1841
|
-
version,
|
|
1842
|
-
n_times,
|
|
1843
|
-
in_container_id=None,
|
|
1844
|
-
analysis_name=None,
|
|
1845
|
-
analysis_description=None,
|
|
1846
|
-
ignore_warnings=False,
|
|
1847
|
-
settings=None,
|
|
1848
|
-
tags=None,
|
|
1849
|
-
preferred_destination=None,
|
|
1850
|
-
):
|
|
1851
|
-
"""
|
|
1852
|
-
Starts multiple times the same analysis on a subject with the same
|
|
1853
|
-
settings.
|
|
1854
|
-
|
|
1855
|
-
Parameters
|
|
1856
|
-
----------
|
|
1857
|
-
script_name : str
|
|
1858
|
-
ID of the script to be run.
|
|
1859
|
-
version: str
|
|
1860
|
-
Version of the script to be run, examples: 1.0, 5.3.4
|
|
1861
|
-
n_times: int
|
|
1862
|
-
Number of analyses to be scheduled
|
|
1863
|
-
in_container_id : int or dict
|
|
1864
|
-
The ID of the container to get the data from, or a dictionary with
|
|
1865
|
-
one or more container names as keys, and IDs as values.
|
|
1866
|
-
Input container names are generally prefixed with "input\\_".
|
|
1867
|
-
If not, the prefix will be automatically added.
|
|
1868
|
-
analysis_name : str
|
|
1869
|
-
Name of the analysis (optional)
|
|
1870
|
-
analysis_description : str
|
|
1871
|
-
Description of the analysis (optional)
|
|
1872
|
-
ignore_warnings : bool
|
|
1873
|
-
If False, warnings by server cause failure.
|
|
1874
|
-
settings : dict
|
|
1875
|
-
The input settings used to run the analysis.
|
|
1876
|
-
Use either settings or in_container_id. Input specification
|
|
1877
|
-
in the settings dict can be done by using the key "input".
|
|
1878
|
-
tags : list[str]
|
|
1879
|
-
The tags of the analysis.
|
|
1880
|
-
preferred_destination : str
|
|
1881
|
-
The machine on which to run the analysis
|
|
1882
|
-
|
|
1883
|
-
Yields
|
|
1884
|
-
-------
|
|
1885
|
-
int
|
|
1886
|
-
The analysis ID if correctly started, None otherwise.
|
|
1887
|
-
"""
|
|
1888
|
-
logger = logging.getLogger(logger_name)
|
|
1889
|
-
for n in range(n_times):
|
|
1890
|
-
logger.info(f"Running tool {script_name}:{version} {n + 1}/{n_times}")
|
|
1891
|
-
yield self.start_analysis(
|
|
1892
|
-
script_name,
|
|
1893
|
-
version,
|
|
1894
|
-
in_container_id=in_container_id,
|
|
1895
|
-
analysis_name=analysis_name,
|
|
1896
|
-
analysis_description=analysis_description,
|
|
1897
|
-
ignore_warnings=ignore_warnings,
|
|
1898
|
-
settings=settings,
|
|
1899
|
-
tags=tags,
|
|
1900
|
-
preferred_destination=preferred_destination,
|
|
1901
|
-
)
|
|
1902
|
-
|
|
1903
1901
|
def set_project_qa_rules(self, rules_file_path, guidance_text=""):
|
|
1904
1902
|
"""
|
|
1905
1903
|
Logs in to the Qmenta platform, retrieves the project ID based on the project name,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
qmenta/__init__.py,sha256=jv2YF__bseklT3OWEzlqJ5qE24c4aWd5F4r0TTjOrWQ,65
|
|
2
2
|
qmenta/client/Account.py,sha256=MEljEy9cmg2uP2FG1d3TZAgfj66EE2_3PQAZ9rvpCXY,9647
|
|
3
3
|
qmenta/client/File.py,sha256=ZgvSqejIosUt4uoX7opUnPnp5XGEaJNMRwFC0mQVB8k,5344
|
|
4
|
-
qmenta/client/Project.py,sha256=
|
|
4
|
+
qmenta/client/Project.py,sha256=T_IoH_CpyFg0IaaXeQW_x1xH76n8FsX_2v0qWJo7Yuk,68063
|
|
5
5
|
qmenta/client/Subject.py,sha256=lhxxVdQ6d-GNoQC8mrJwa4L1f44nJc4PcJtDspmKN7I,8756
|
|
6
6
|
qmenta/client/__init__.py,sha256=AjTojBhZeW5nl0i605KS8S1Gl5tPNc1hdzD47BGNfoI,147
|
|
7
7
|
qmenta/client/utils.py,sha256=5DK2T_HQprrCwLS0Ycm2CjseaYmAUKaJkJvYoW-Rqzc,2479
|
|
8
|
-
qmenta_client-1.1.
|
|
9
|
-
qmenta_client-1.1.
|
|
10
|
-
qmenta_client-1.1.
|
|
8
|
+
qmenta_client-1.1.dev1326.dist-info/METADATA,sha256=h6qd-k47PLto2IDPKURSwiuRhRyfFA3bZ8a0-IRbGrE,672
|
|
9
|
+
qmenta_client-1.1.dev1326.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
|
10
|
+
qmenta_client-1.1.dev1326.dist-info/RECORD,,
|
|
File without changes
|