From b809d1e7ac86d6d1b914da19e409e3a845aafde2 Mon Sep 17 00:00:00 2001 From: James Brandreth Date: Thu, 19 Sep 2024 11:38:12 +0100 Subject: [PATCH 1/2] fix: start numbering concepts from 1 --- src/miade/annotators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miade/annotators.py b/src/miade/annotators.py index 1b7e1e5..c80c504 100644 --- a/src/miade/annotators.py +++ b/src/miade/annotators.py @@ -488,9 +488,9 @@ def add_numbering_to_name(concepts: List[Concept]) -> List[Concept]: Returns: The list of concepts with numbering added to their names. """ - # Prepend numbering to problem concepts e.g. 00 asthma, 01 stroke... + # Prepend numbering to problem concepts e.g. 01 asthma, 02 stroke... for i, concept in enumerate(concepts): - concept.name = f"{i:02} {concept.name}" + concept.name = f"{(i+1):02} {concept.name}" return concepts From 5091b2d3a22d4fb9dcd6ac7eb6e86cf944088b9b Mon Sep 17 00:00:00 2001 From: James Brandreth Date: Thu, 19 Sep 2024 13:54:43 +0100 Subject: [PATCH 2/2] update numbers in tests --- tests/test_core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index 61eb14e..115be33 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -15,19 +15,19 @@ def test_core(model_directory_path, test_note, test_negated_note, test_duplicate processor.add_annotator("meds/allergies") assert processor.process(test_note) == [ - Concept(id="59927004", name="00 liver failure", category=Category.PROBLEM), + Concept(id="59927004", name="01 liver failure", category=Category.PROBLEM), Concept(id="322236009", name="paracetamol 500mg oral tablets", category=Category.MEDICATION), ] assert processor.process(test_negated_note) == [ Concept(id="322236009", name="paracetamol 500mg oral tablets", category=Category.MEDICATION), ] assert processor.process(test_duplicated_note) == [ - Concept(id="59927004", name="00 liver failure", category=Category.PROBLEM), + Concept(id="59927004", name="01 liver failure", category=Category.PROBLEM), Concept(id="322236009", name="paracetamol 500mg oral tablets", category=Category.MEDICATION), ] assert processor.get_concept_dicts(test_note) == [ { - "name": "00 liver failure", + "name": "01 liver failure", "id": "59927004", "category": "PROBLEM", "start": 12,