mtbp3.health.emt
Classes
A class representing MedDRA terms. |
Module Contents
- class mtbp3.health.emt.Emt(folder_name='')[source]
A class representing MedDRA terms.
This class provides methods to interact with the Emt object, including listing files associated with the Emt.
- folder_name
The folder name associated with the Emt.
- Type:
str
- month
The month of the version published.
- Type:
str
- year
The year of the version published.
- Type:
str
- version_number = '00.0'
- version_number_us = '00_0'
- readme_file = None
- year = ''
- month = ''
- language = ''
- mdhier = None
- llt = None
- smq_list = None
- smq_content = None
- fmq_list = None
- fmq_list_unique = None
- fmq_list_default = None
- expected_file_lists()[source]
Get the three lists of files associated with the Emt.
- Returns:
A tuple containing three lists of file names.
- Return type:
tuple
- find_files()[source]
Find all expected files associated with the Emt.
- Returns:
A list of missing file names.
- Return type:
list
- list_files()[source]
List all files associated with the Emt.
- Returns:
A list of file names.
- Return type:
list
- find_soc(terms=[], ignore_case=False)[source]
Find all unique SOC (System Organ Class) terms.
- Parameters:
terms (list, optional) – The specific SOC name(s) to filter the results. Defaults to an empty list.
ignore_case (bool, optional) – Flag to indicate whether to ignore case sensitivity when filtering terms. Defaults to False.
- Returns:
A list of unique SOC terms. If terms is provided, it returns the corresponding ids.
- Return type:
list
- Raises:
AssertionError – If terms is not a list.
- find_hlgt(terms=[], ignore_case=False)[source]
Find all unique HLGT terms.
- Parameters:
terms (list, optional) – The specific HLGT name(s) to filter the results. Defaults to an empty list.
ignore_case (bool, optional) – Flag to indicate whether to ignore case sensitivity when filtering terms. Defaults to False.
- Returns:
A list of unique HLGT terms. If terms is provided, it returns the corresponding ids.
- Return type:
list
- Raises:
AssertionError – If terms is not a list.
- find_hlt(terms=[], ignore_case=False)[source]
Find all unique HLT terms.
- Parameters:
terms (list, optional) – The specific HLT name(s) to filter the results. Defaults to an empty list.
ignore_case (bool, optional) – Flag to indicate whether to ignore case sensitivity when filtering terms. Defaults to False.
- Returns:
A list of unique HLT terms. If terms is provided, it returns the corresponding ids.
- Return type:
list
- Raises:
AssertionError – If terms is not a list.
- find_pt(terms=[], ignore_case=False)[source]
Find all unique PT terms.
- Parameters:
terms (list, optional) – The specific PT name(s) to filter the results. Defaults to an empty list.
ignore_case (bool, optional) – Flag to indicate whether to ignore case sensitivity when filtering terms. Defaults to False.
- Returns:
A list of unique PT terms. If terms is provided, it returns the corresponding ids.
- Return type:
list
- Raises:
AssertionError – If terms is not a list.
- find_llt(terms=[], ignore_case=False, llt_current_only=True)[source]
Find all unique LLT terms.
- Parameters:
terms (list, optional) – The specific LLT name(s) to filter the results. Defaults to an empty list.
ignore_case (bool, optional) – Flag to indicate whether to ignore case sensitivity when filtering terms. Defaults to False.
- Returns:
A list of unique LLT terms. If terms is provided, it returns the corresponding ids.
- Return type:
list
- Raises:
AssertionError – If terms is not a list.
- all_str_digit(lst=[])[source]
Check if all elements in a given list are strings containing only digits.
- Parameters:
fin (list) – The list to check.
- Returns:
True if all elements in the list are strings containing only digits, False otherwise.
- Return type:
bool
- assert_terms(input, remove_none=False)[source]
Assert that the input is either a string or a list. If the input is a string, it is converted to a length one list. All elements in the list are converted to strings and empty elements are removed.
- Parameters:
input (str or list) – The input to be validated.
- Returns:
The validated list.
- Return type:
list
- Raises:
AssertionError – If the input is neither a string nor a list.
- find_term_wi_level(terms=[], ignore_case=False, level=1, llt_current_only=True)[source]
Find all unique terms.
- Parameters:
terms (list, optional) – The specific SOC name(s) to filter the results. Defaults to an empty list.
ignore_case (bool, optional) – Flag to indicate whether to ignore case sensitivity when filtering terms. Defaults to False.
level (int, optional) – The level of the SOC hierarchy to consider. Defaults to 1.
- Returns:
A list of unique terms. If terms is provided, it returns the corresponding ids.
- Return type:
list
- Raises:
AssertionError – If terms is not a list.
- find_pt_given_soc(soc=[], primary_soc_only=False, ignore_case=False)[source]
Find all PTs (Preferred Terms) given a SOC (System Organ Class) name.
- Parameters:
soc (str or list) – The name of the SOC or a list of SOC names.
primary_soc_only (bool, optional) – If True, only return PTs associated with the primary SOC. Defaults to False.
- Returns:
- A DataFrame containing the PTs associated with the given SOC.
Each row represents a PT and contains the PT code and PT name.
- Return type:
pandas.DataFrame
- find_llt_given_pt(pt=[], ignore_case=False, llt_current_only=True)[source]
Find all LLTs (Lowest Level Terms) given a PT (Preferred Term) name or a list of PT names.
- Parameters:
pt (str or list) – The name of the PT or a list of PT names.
- Returns:
- A DataFrame containing the LLTs associated with the given PT(s).
Each row represents an LLT and contains the LLT code and LLT name.
- Return type:
pandas.DataFrame
- find_llt_given_soc(soc=[], primary_soc_only=False, ignore_case=False, llt_current_only=True)[source]
Find all LLTs (Lowest Level Terms) given a SOC (System Organ Class) name.
- Parameters:
soc_name (str) – The name of the SOC.
primary_soc_only (bool, optional) – If True, only return LLTs associated with the primary SOC. Defaults to False.
- Returns:
- A DataFrame containing the LLTs associated with the given SOC.
Each row represents an LLT and contains the LLT code and LLT name.
- Return type:
pandas.DataFrame
- find_soc_given_pt(pt=[], primary_only=True, ignore_case=False)[source]
Find the SOC (System Organ Class) given a list of PT (Preferred Term) names.
- Parameters:
pt (list) – A list of PT names.
- Returns:
The name of the primary SOC.
- Return type:
str
- Raises:
AssertionError – If pt is not a list.
- find_smq(terms=[], with_detail=False, ignore_case=False)[source]
Find all unique SMQ (Standard MedDRA Queries) terms.
- Parameters:
terms (list, optional) – The specific SMQ name(s) to filter the results. Defaults to an empty list.
ignore_case (bool, optional) – Flag to indicate whether to ignore case sensitivity when filtering terms. Defaults to False.
- Returns:
A list of unique SMQ terms. If terms is provided, it returns the corresponding ids.
- Return type:
list
- Raises:
AssertionError – If terms is not a list.
- find_terms_given_smq(smq=[], ignore_case=False, active_only=True, narrow_only=True, llt_only=False, llt_current_only=True)[source]
Find all terms related an SMQ (Standard MedDRA Query) name or a list of SMQ names.
- Parameters:
smq (str or list) – The name of the SMQ or a list of SMQ names.
ignore_case (bool, optional) – Flag to indicate whether to ignore case sensitivity when filtering terms. Defaults to False.
- Returns:
A DataFrame containing the terms associated with the given SMQ(s).
- Return type:
pandas.DataFrame
- save_fmq_consolidated_list_csv(folder_path='')[source]
Save the CSV file in the specified folder.
- Parameters:
folder_path (str) – The path of the folder where the CSV file should be saved.
- find_fmq(fmq=[], narrow_only=True)[source]
Find all unique FMQ (FDA Medical Queries) terms.
- Parameters:
fmq (list, optional) – The specific FMQ name(s) to filter the results. Defaults to an empty list.
- Returns:
A list of unique FMQ terms. If fmq is provided, it returns the corresponding ids.
- Return type:
list
- Raises:
AssertionError – If fmq is not a list.
- find_terms_given_fmq(fmq=[], ignore_case=False, narrow_only=True)[source]
Find all terms related to an FMQ (FDA Medical Query) name or a list of FMQ names.
- Parameters:
fmq (str or list) – The name of the FMQ or a list of FMQ names.
ignore_case (bool, optional) – Flag to indicate whether to ignore case sensitivity when filtering terms. Defaults to False.
- Returns:
A DataFrame containing the terms associated with the given FMQ(s).
- Return type:
pandas.DataFrame