:py:mod:`medcat.utils.regression.results` ========================================= .. py:module:: medcat.utils.regression.results Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: medcat.utils.regression.results.FailReason medcat.utils.regression.results.FailDescriptor medcat.utils.regression.results.SingleResultDescriptor medcat.utils.regression.results.ResultDescriptor medcat.utils.regression.results.MultiDescriptor .. py:class:: FailReason Bases: :py:obj:`str`, :py:obj:`enum.Enum` str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'. .. py:attribute:: CONCEPT_NOT_ANNOTATED :value: 'CONCEPT_NOT_ANNOTATED' The concept was not annotated by the model .. py:attribute:: INCORRECT_CUI_FOUND :value: 'INCORRECT_CUI_FOUND' A different CUI with the same name was found .. py:attribute:: INCORRECT_SPAN_BIG :value: 'INCORRECT_SPAN_BIG' The concept was a part of an annotation made by the model .. py:attribute:: INCORRECT_SPAN_SMALL :value: 'INCORRECT_SPAN_SMALL' Only a part of the concept was annotated .. py:attribute:: CUI_NOT_FOUND :value: 'CUI_NOT_FOUND' The CUI was not found in the context database .. py:attribute:: CUI_PARENT_FOUND :value: 'CUI_PARENT_FOUND' The CUI annotated was the parent of the concept .. py:attribute:: CUI_CHILD_FOUND :value: 'CUI_CHILD_FOUND' The CUI annotated was a child of the concept .. py:attribute:: NAME_NOT_FOUND :value: 'NAME_NOT_FOUND' The name specified was not found in the context database .. py:attribute:: UNKNOWN :value: 'UNKNOWN' Unknown reason for failure .. py:class:: FailDescriptor Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: cui :type: str .. py:attribute:: name :type: str .. py:attribute:: reason :type: FailReason .. py:attribute:: extra :type: str :value: '' .. py:method:: get_reason_for(cui, name, res, translation) :classmethod: Get the fail reason for the failure of finding the specifeid CUI and name where the resulting entities are presented. :param cui: The cui that was expected :type cui: str :param name: The name that was expected :type name: str :param res: The entities that were annotated :type res: dict :param translation: The translation layer :type translation: TranslationLayer :Returns: **FailDescriptor** -- The corresponding fail descriptor .. py:class:: SingleResultDescriptor Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: name :type: str The name of the part that was checked .. py:attribute:: success :type: int :value: 0 Number of successes .. py:attribute:: fail :type: int :value: 0 Number of failures .. py:attribute:: failures :type: List[FailDescriptor] :value: [] The description of failures .. py:method:: report_success(cui, name, success, fail_reason) Report a test case and its successfulness :param cui: The CUI being checked :type cui: str :param name: The name being checked :type name: str :param success: Whether or not the check was successful :type success: bool :param fail_reason: The reason for the failure (if applicable) :type fail_reason: Optional[FailDescriptor] .. py:method:: get_report() Get the report associated with this descriptor :Returns: **str** -- The report string .. py:class:: ResultDescriptor Bases: :py:obj:`SingleResultDescriptor` .. py:attribute:: per_phrase_results :type: Dict[str, SingleResultDescriptor] .. py:method:: report(cui, name, phrase, success, fail_reason) Report a test case and its successfulness :param cui: The CUI being checked :type cui: str :param name: The name being checked :type name: str :param phrase: The phrase being checked :type phrase: str :param success: Whether or not the check was successful :type success: bool :param fail_reason: The reason for the failure (if applicable) :type fail_reason: Optional[FailDescriptor] .. py:method:: get_report(phrases_separately = False) Get the report associated with this descriptor :param phrases_separately: Whether to output descriptor for each phrase separately :type phrases_separately: bool :Returns: **str** -- The report string .. py:class:: MultiDescriptor Bases: :py:obj:`pydantic.BaseModel` .. py:property:: success :type: int The total number of successes. :Returns: **int** -- The total number of sucesses. .. py:property:: fail :type: int The total number of failures. :Returns: **int** -- The total number of failures. .. py:attribute:: name :type: str The name of the collection being checked .. py:attribute:: parts :type: List[ResultDescriptor] :value: [] The parts kept track of .. py:method:: get_report(phrases_separately, hide_empty = False, show_failures = True) Get the report associated with this descriptor :param phrases_separately: Whether to include per-phrase information :type phrases_separately: bool :param hide_empty: Whether to hide empty cases :type hide_empty: bool :param show_failures: Whether to show failures :type show_failures: bool :Returns: **str** -- The report string