From 56af3cda230d312dfc67322cc0ffb8fb8aded4e3 Mon Sep 17 00:00:00 2001 From: James Brandreth <30596689+jamesbrandreth@users.noreply.github.com> Date: Thu, 19 Sep 2024 14:00:07 +0100 Subject: [PATCH] fix: start numbering concepts from 1 (#126) * fix: start numbering concepts from 1 * update numbers in tests --- src/miade/annotators.py | 4 ++-- tests/test_core.py | 6 +++--- 2 files changed, 5 insertions(+), 5 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 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,