Skip to content

Commit

Permalink
Re-added deprecated method with deprecated flag and addtional comments
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-sutton-1992 committed Nov 6, 2023
1 parent 94827bb commit 26b5120
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions medcat/cdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from medcat.utils.hasher import Hasher
from medcat.utils.matutils import unitvec
from medcat.utils.ml_utils import get_lr_linking
from medcat.utils.decorators import deprecated
from medcat.config import Config, weighted_average, workers
from medcat.utils.saving.serializer import CDBSerializer

Expand Down Expand Up @@ -215,6 +216,44 @@ def add_names(self, cui: str, names: Dict, name_status: str = 'A', full_build: b

self._add_concept(cui=cui, names=names, ontologies=set(), name_status=name_status, type_ids=set(), description='', full_build=full_build)

@deprecated("Use `cdb._add_concept` as this will be removed in a future release.")
def add_concept(self,
cui: str,
names: Dict,
ontologies: set,
name_status: str,
type_ids: Set[str],
description: str,
full_build: bool = False) -> None:
"""
Deprecated: Use `cdb._add_concept` as this will be removed in a future release.
Add a concept to internal Concept Database (CDB). Depending on what you are providing
this will add a large number of properties for each concept.
Args:
cui (str):
Concept ID or unique identifier in this database, all concepts that have
the same CUI will be merged internally.
names (Dict[str, Dict]):
Names for this concept, or the value that if found in free text can be linked to this concept.
Names is a dict like: `{name: {'tokens': tokens, 'snames': snames, 'raw_name': raw_name}, ...}`
Names should be generated by helper function 'medcat.preprocessing.cleaners.prepare_name'
ontologies (Set[str]):
ontologies in which the concept exists (e.g. SNOMEDCT, HPO)
name_status (str):
One of `P`, `N`, `A`
type_ids (Set[str]):
Semantic type identifier (have a look at TUIs in UMLS or SNOMED-CT)
description (str):
Description of this concept.
full_build (bool):
If True the dictionary self.addl_info will also be populated, contains a lot of extra information
about concepts, but can be very memory consuming. This is not necessary
for normal functioning of MedCAT (Default Value `False`).
"""
self._add_concept(cui, names, ontologies, name_status, type_ids, description, full_build)

def _add_concept(self,
cui: str,
names: Dict,
Expand Down

0 comments on commit 26b5120

Please sign in to comment.