Skip to content

Commit

Permalink
fix: start numbering concepts from 1 (#126)
Browse files Browse the repository at this point in the history
* fix: start numbering concepts from 1

* update numbers in tests
  • Loading branch information
jamesbrandreth authored Sep 19, 2024
1 parent 77dfb39 commit 56af3cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/miade/annotators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 56af3cd

Please sign in to comment.