From 9cd1fd5dc9e3116351d8f37dcdfe90aa980895e9 Mon Sep 17 00:00:00 2001 From: mart-r Date: Thu, 29 Feb 2024 16:31:25 +0000 Subject: [PATCH] CU-8693wtx4b: Remove debug output --- medcat/compare_models/model_comparison.ipynb | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/medcat/compare_models/model_comparison.ipynb b/medcat/compare_models/model_comparison.ipynb index 03e9ebf..3e041f2 100644 --- a/medcat/compare_models/model_comparison.ipynb +++ b/medcat/compare_models/model_comparison.ipynb @@ -352,7 +352,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -362,7 +362,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.FIRST_HAS) \n", "====================\n", - "ONE {'pretty_name': 'Genus Quercus', 'cui': '53347009', 'type_ids': ['81102976'], 'types': [''], 'source_value': 'Oak', 'detected_name': 'oak', 'acc': 0.6368384509248382, 'context_similarity': 0.6368384509248382, 'start': 43, 'end': 46, 'icd10': [], 'ontologies': ['20220803_SNOMED_UK_CLINICAL_EXT'], 'snomed': [], 'id': 3, 'meta_anns': {'Presence': {'value': 'True', 'confidence': 0.999996542930603, 'name': 'Presence'}, 'Subject': {'value': 'Patient', 'confidence': 0.9396798014640808, 'name': 'Subject'}, 'Time': {'value': 'Recent', 'confidence': 0.9999940395355225, 'name': 'Time'}}}\n", "pretty_name \tGenus Quercus \t \n", "cui \t53347009 \t \n", "type_ids \t['81102976'] \t \n", @@ -381,7 +380,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.FIRST_HAS) \n", "====================\n", - "ONE {'pretty_name': 'Milliliter', 'cui': '258773002', 'type_ids': ['7882689'], 'types': [''], 'source_value': 'CC', 'detected_name': 'cc', 'acc': 0.5504460208011586, 'context_similarity': 0.5504460208011586, 'start': 68, 'end': 70, 'icd10': [], 'ontologies': ['20220803_SNOMED_UK_CLINICAL_EXT'], 'snomed': [], 'id': 5, 'meta_anns': {'Presence': {'value': 'True', 'confidence': 0.9999929666519165, 'name': 'Presence'}, 'Subject': {'value': 'Other', 'confidence': 0.878454864025116, 'name': 'Subject'}, 'Time': {'value': 'Recent', 'confidence': 0.9999245405197144, 'name': 'Time'}}}\n", "pretty_name \tMilliliter \t \n", "cui \t258773002 \t \n", "type_ids \t['7882689'] \t \n", @@ -400,7 +398,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.SECOND_HAS) \n", "====================\n", - "ONE None\n", "pretty_name \t \tAcute bronchitis \n", "cui \t \t10509002 \n", "type_ids \t \t['9090192'] \n", @@ -419,7 +416,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.FIRST_HAS) \n", "====================\n", - "ONE {'pretty_name': 'History of (contextual qualifier)', 'cui': '392521001', 'type_ids': ['7882689'], 'types': [''], 'source_value': 'HX', 'detected_name': 'hx', 'acc': 1.0, 'context_similarity': 1.0, 'start': 90, 'end': 92, 'icd10': [], 'ontologies': ['20220803_SNOMED_UK_CLINICAL_EXT'], 'snomed': [], 'id': 9, 'meta_anns': {'Presence': {'value': 'True', 'confidence': 1.0, 'name': 'Presence'}, 'Subject': {'value': 'Patient', 'confidence': 0.999907374382019, 'name': 'Subject'}, 'Time': {'value': 'Recent', 'confidence': 0.9977806210517883, 'name': 'Time'}}}\n", "pretty_name \tHistory of (contextual qualifier) \t \n", "cui \t392521001 \t \n", "type_ids \t['7882689'] \t \n", @@ -438,7 +434,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.SECOND_HAS) \n", "====================\n", - "ONE None\n", "pretty_name \t \tyear \n", "cui \t \t258707000 \n", "type_ids \t \t['7882689'] \n", @@ -457,7 +452,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.SECOND_HAS) \n", "====================\n", - "ONE None\n", "pretty_name \t \tMale \n", "cui \t \t248153007 \n", "type_ids \t \t['67667581'] \n", @@ -476,7 +470,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.SAME_SPAN_DIFF_CONCEPT) \n", "====================\n", - "ONE {'pretty_name': 'Presentation', 'cui': '246105001', 'type_ids': ['43039974'], 'types': [''], 'source_value': 'presents', 'detected_name': 'present', 'acc': 0.4530222896013254, 'context_similarity': 0.4530222896013254, 'start': 132, 'end': 140, 'icd10': [], 'ontologies': ['20220803_SNOMED_UK_CLINICAL_EXT'], 'snomed': [], 'id': 15, 'meta_anns': {'Presence': {'value': 'True', 'confidence': 1.0, 'name': 'Presence'}, 'Subject': {'value': 'Patient', 'confidence': 0.9999861717224121, 'name': 'Subject'}, 'Time': {'value': 'Recent', 'confidence': 0.9999932050704956, 'name': 'Time'}}}\n", "pretty_name \tPresentation \tPresent \n", "cui \t246105001 \t52101004 \n", "type_ids \t['43039974'] \t['7882689'] \n", @@ -495,7 +488,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.SECOND_HAS) \n", "====================\n", - "ONE None\n", "pretty_name \t \tReport \n", "cui \t \t229059009 \n", "type_ids \t \t['90170645'] \n", @@ -514,7 +506,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.OVERLAPP_1ST_LARGER_DIFF_CONCEPT) \n", "====================\n", - "ONE {'pretty_name': 'Productive cough', 'cui': '28743005', 'type_ids': ['67667581'], 'types': [''], 'source_value': 'cough productive', 'detected_name': 'cough~productive', 'acc': 1.0, 'context_similarity': 1.0, 'start': 189, 'end': 205, 'icd10': ['R05'], 'ontologies': ['20220803_SNOMED_UK_CLINICAL_EXT'], 'snomed': [], 'id': 21, 'meta_anns': {'Presence': {'value': 'True', 'confidence': 1.0, 'name': 'Presence'}, 'Subject': {'value': 'Patient', 'confidence': 0.9999973773956299, 'name': 'Subject'}, 'Time': {'value': 'Recent', 'confidence': 0.9999985694885254, 'name': 'Time'}}}\n", "pretty_name \tProductive cough \tCough \n", "cui \t28743005 \t49727002 \n", "type_ids \t['67667581'] \t['67667581'] \n", @@ -533,7 +524,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.SAME_SPAN_DIFF_CONCEPT) \n", "====================\n", - "ONE {'pretty_name': 'In the past', 'cui': '410513005', 'type_ids': ['7882689'], 'types': [''], 'source_value': 'past', 'detected_name': 'past', 'acc': 0.915658888260423, 'context_similarity': 0.915658888260423, 'start': 278, 'end': 282, 'icd10': [], 'ontologies': ['20220803_SNOMED_UK_CLINICAL_EXT'], 'snomed': [], 'id': 31, 'meta_anns': {'Presence': {'value': 'True', 'confidence': 0.9999996423721313, 'name': 'Presence'}, 'Subject': {'value': 'Patient', 'confidence': 0.9999381303787231, 'name': 'Subject'}, 'Time': {'value': 'Recent', 'confidence': 0.9996059536933899, 'name': 'Time'}}}\n", "pretty_name \tIn the past \tPast \n", "cui \t410513005 \t716861000000108 \n", "type_ids \t['7882689'] \t['90170645'] \n", @@ -552,7 +542,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.FIRST_HAS) \n", "====================\n", - "ONE {'pretty_name': 'Mitral valve regurgitation', 'cui': '48724000', 'type_ids': ['9090192'], 'types': [''], 'source_value': 'Mr', 'detected_name': 'mr', 'acc': 0.3131859075574164, 'context_similarity': 0.3131859075574164, 'start': 341, 'end': 343, 'icd10': ['I34.0'], 'ontologies': ['20220803_SNOMED_UK_CLINICAL_EXT'], 'snomed': [], 'id': 36, 'meta_anns': {'Presence': {'value': 'True', 'confidence': 0.7500871419906616, 'name': 'Presence'}, 'Subject': {'value': 'Patient', 'confidence': 0.999923586845398, 'name': 'Subject'}, 'Time': {'value': 'Recent', 'confidence': 0.9999982118606567, 'name': 'Time'}}}\n", "pretty_name \tMitral valve regurgitation \t \n", "cui \t48724000 \t \n", "type_ids \t['9090192'] \t \n", @@ -571,7 +560,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.SECOND_HAS) \n", "====================\n", - "ONE None\n", "pretty_name \t \tMedical \n", "cui \t \t74188005 \n", "type_ids \t \t['7882689'] \n", @@ -590,7 +578,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.FIRST_HAS) \n", "====================\n", - "ONE {'pretty_name': 'Respiratory rate', 'cui': '86290005', 'type_ids': ['2680757'], 'types': [''], 'source_value': 'respiratory', 'detected_name': 'respiratory', 'acc': 0.370196740030693, 'context_similarity': 0.370196740030693, 'start': 497, 'end': 508, 'icd10': [], 'ontologies': ['20220803_SNOMED_UK_CLINICAL_EXT'], 'snomed': [], 'id': 50, 'meta_anns': {'Presence': {'value': 'True', 'confidence': 0.9773409366607666, 'name': 'Presence'}, 'Subject': {'value': 'Other', 'confidence': 0.9998049139976501, 'name': 'Subject'}, 'Time': {'value': 'Past', 'confidence': 0.9141203165054321, 'name': 'Time'}}}\n", "pretty_name \tRespiratory rate \t \n", "cui \t86290005 \t \n", "type_ids \t['2680757'] \t \n", @@ -609,7 +596,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.SAME_SPAN_DIFF_CONCEPT) \n", "====================\n", - "ONE {'pretty_name': 'Disease', 'cui': '64572001', 'type_ids': ['9090192'], 'types': [''], 'source_value': 'conditions', 'detected_name': 'condition', 'acc': 0.5839914477394028, 'context_similarity': 0.5839914477394028, 'start': 509, 'end': 519, 'icd10': [''], 'ontologies': ['20220803_SNOMED_UK_CLINICAL_EXT'], 'snomed': [], 'id': 51, 'meta_anns': {'Presence': {'value': 'False', 'confidence': 0.5070741176605225, 'name': 'Presence'}, 'Subject': {'value': 'Other', 'confidence': 0.9950954914093018, 'name': 'Subject'}, 'Time': {'value': 'Past', 'confidence': 0.8243628740310669, 'name': 'Time'}}}\n", "pretty_name \tDisease \tCondition \n", "cui \t64572001 \t260905004 \n", "type_ids \t['9090192'] \t['43039974'] \n", @@ -628,7 +614,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.OVERLAPP_1ST_LARGER_DIFF_CONCEPT) \n", "====================\n", - "ONE {'pretty_name': 'Alcoholic beverage intake', 'cui': '897148007', 'type_ids': ['2680757'], 'types': [''], 'source_value': 'alcohol consumption', 'detected_name': 'alcohol~consumption', 'acc': 1.0, 'context_similarity': 1.0, 'start': 596, 'end': 615, 'icd10': [], 'ontologies': ['20220803_SNOMED_UK_CLINICAL_EXT'], 'snomed': [], 'id': 64, 'meta_anns': {'Presence': {'value': 'True', 'confidence': 1.0, 'name': 'Presence'}, 'Subject': {'value': 'Patient', 'confidence': 0.9998786449432373, 'name': 'Subject'}, 'Time': {'value': 'Recent', 'confidence': 0.9999997615814209, 'name': 'Time'}}}\n", "pretty_name \tAlcoholic beverage intake \tSubstance with alcohol structure \n", "cui \t897148007 \t53041004 \n", "type_ids \t['2680757'] \t['91187746'] \n", @@ -647,7 +632,6 @@ "==================== \n", "doc_2 (AnnotationComparisonType.SAME_SPAN_DIFF_CONCEPT) \n", "====================\n", - "ONE {'pretty_name': 'Physical examination procedure', 'cui': '5880005', 'type_ids': ['28321150'], 'types': [''], 'source_value': 'examination', 'detected_name': 'examination', 'acc': 0.99, 'context_similarity': 0.99, 'start': 628, 'end': 639, 'icd10': [], 'ontologies': ['20220803_SNOMED_UK_CLINICAL_EXT'], 'snomed': [], 'id': 66, 'meta_anns': {'Presence': {'value': 'True', 'confidence': 0.9999998807907104, 'name': 'Presence'}, 'Subject': {'value': 'Patient', 'confidence': 0.9999996423721313, 'name': 'Subject'}, 'Time': {'value': 'Recent', 'confidence': 0.9999998807907104, 'name': 'Time'}}}\n", "pretty_name \tPhysical examination procedure \tExamination - action \n", "cui \t5880005 \t302199004 \n", "type_ids \t['28321150'] \t['7882689'] \n", @@ -675,7 +659,6 @@ "# but this can be changed by setting omit_identical=False\n", "for doc_name, pair in ann_diffs.iter_ann_pairs(docs=docs, omit_identical=True):\n", " print('='*20,f'\\n{doc_name} ({pair.comparison_type})', f'\\n{\"=\"*20}')\n", - " print(\"ONE\", pair.one)\n", " # NOTE: if only one of the two has an annotation, the other one will be None\n", " # the following will deal with that automatically, though\n", " compare_dicts(pair.one, pair.two)"