Data Searches¶
Once you have populated a Project in the QMENTA Platform with several sessions, you can perform different types of searches to extract the information you are looking for.
In this section, you will learn how to search for subject data and metadata within a project. Various methods to retrieve such information are explained.
To begin, log in and activate a Project by following the steps in Logging In and Activating a QMENTA Project.
Search for a Specific Subject¶
You can retrieve the information for a specific subject by:
# Define the Subject ID.
subject_name = "0001"
# Retrieve Subject Information
subjects = [subject for subject in project.subjects_metadata if subject["patient_secret_name"] == subject_name]
where subject_name
corresponds to the Subject ID and subjects
is a list of the sessions available for that Subject ID containing certain
information (Patient ID, Container ID, Session Tags,
Session Metadata…). This is equivalent to the information available via the Data
tab in
the QMENTA Platform.
Note
This type of search only provides the sessions available in the Project at the time it was activated.
Advanced Search¶
You can retrieve all the sessions of the active Project that satisfy a certain search criteria. The search criteria is a dictionary with the following structure:
search_criteria = {
"pars_patient_secret_name": "string;VALUE",
"pars_ssid": "integer;OPERATOR|VALUE",
"pars_modalities": "string;VALUE",
"pars_tags": "tags;VALUES",
"pars_age_at_scan": "integer;OPERATOR|VALUE",
"pars_[dicom]_FILEKEY": "TYPE;VALUE",
"pars_PROJECTMETADATAKEY": "TYPE;VALUE",
}
where the dictionary keys correspond as follows:
pars_patient_secret_name
: Applies the search to the Subject ID.
pars_ssid
: Applies the search to the Session ID (SSID).
pars_modalities
: Applies the search to the file modalities available within the session.
pars_tags
: Applies the search to the file tags available within the session.
pars_age_at_scan
: Applies the search to the age of the subject at the time of acquisition.
pars_[dicom]_FILEKEY
: Applies the search to the DICOM metadata extracted.
pars_PROJECTMETADATAKEY
: Applies the search to the Project metadata parameters.
Further:
VALUE
is the comparing value to be applied in the search.
OPERATOR
is the operator to apply when comparing integers. It can be one of:
eq
: Equal.
ne
: Not Equal.
gt
: Greater Than.
gte
: Greater Equal Than.
lt
: Lower Than.
tle
: Lower Equal Than.
FILEKEY
is the name of the DICOM metadata to apply the search to.
PROJECTMETADATAKEY
is the name of the Project metadata field to apply the search to.
TYPE
is the data type of the metadata. It can be one of:
integer
decimal
string
list
An example is shown below:
# Define search criteria
search_criteria = {
"pars_modalities": "string;T1,T2",
"pars_tags": "tags;flair,post_contrast",
"pars_[dicom]_Manufacturer": "string;ge",
"pars_[dicom]_FlipAngle": "integer;gt|5",
"pars_[dicom]_ImageType": "list;PRIMARY;SECONDARY",
}
# Retrieve sessions matching the criteria
sessions = project.get_subjects_metadata(search_criteria=search_criteria)
where sessions
is the list of sessions that satisfy the search. Each session has the same
information as described in the previous section. In this case, the search
returns any session (i.e., Subject ID/Session ID) that has a file classified with
a T1
and/or T2
modality, a file with a flair
and/or
post_contrat
tag, a file whose Manufacturer contains ge
, a
file whose FlipAngle is greater than 5º
, and a file with ImageType
with any of the values: PRIMARY
and/or SECONDARY
.
The equivalent search in the QMENTA Platform is shown next.

Example search and result shown in a Project in the QMENTA Platform.¶
Search of Input Containers¶
This type of search queries the database with the primary goal to retrieve the Container IDs of all sessions uploaded to the active Project that satisfy a defined search criteria.
The search criteria is a dictionary that can have the following keys:
s_n
: Applies the search to the Subject ID.
ssid
: Applies the search to the Session ID (SSID).
from_d
: Starting search date in which the data was acquired.
to_d
: Ending search date in which the data was acquired.
An example search would be as follows:
search_criteria = {"s_n": "01", "ssid":"1"}
sessions = project.list_input_containers(search_criteria)
In this case, the search criteria retrieves a list of sessions (sessions
)
where the strings 01
and 1
are included as Subject ID
and Session ID, respectively. Each session is represented by a dictionary containing the following information:
Subject ID in key:
patient_secret_name
Session ID (SSID) in key:
ssid
Container ID in key:
container_id
Container Name in key:
container_name
Next Steps¶
Explore the following sections in detail:
Metadata Handling – Modify metadata.
Analyses Execution – Execute analyses.
Results Handling – Retrieve and store analysis outputs.