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