medcat.data.mctexport
Attributes
The project name, project ID, CUIs str, and TUIs str |
Classes
dict() -> new empty dictionary |
|
dict() -> new empty dictionary |
|
dict() -> new empty dictionary |
|
dict() -> new empty dictionary |
|
dict() -> new empty dictionary |
Functions
|
Iterate over all the projects in the trainer export. |
|
Iterate over all the docs in a trainer export. |
|
Iterate over all the annotations in a trainer export. |
|
Count the number of annotations in a trainer export. |
|
Count the number of documents in a trainer export. |
Get the number of annotations for a tariner export document. |
|
|
Module Contents
- class medcat.data.mctexport.MedCATTrainerExportAnnotationRequired
Bases:
typing_extensions.TypedDictdict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- start: int
- end: int
- cui: str
- value: str
- __contains__()
True if the dictionary has the specified key, else False.
- __delattr__()
Implement delattr(self, name).
- __delitem__()
Delete self[key].
- __dir__()
Default dir() implementation.
- __eq__()
Return self==value.
- __format__()
Default object formatter.
- __ge__()
Return self>=value.
- __getattribute__()
Return getattr(self, name).
- __getitem__()
x.__getitem__(y) <==> x[y]
- __gt__()
Return self>value.
- __init__()
Initialize self. See help(type(self)) for accurate signature.
- __ior__()
Return self|=value.
- __iter__()
Implement iter(self).
- __le__()
Return self<=value.
- __len__()
Return len(self).
- __lt__()
Return self<value.
- __ne__()
Return self!=value.
- __new__()
Create and return a new object. See help(type) for accurate signature.
- __or__()
Return self|value.
- __reduce__()
Helper for pickle.
- __reduce_ex__()
Helper for pickle.
- __repr__()
Return repr(self).
- __reversed__()
Return a reverse iterator over the dict keys.
- __ror__()
Return value|self.
- __setattr__()
Implement setattr(self, name, value).
- __setitem__()
Set self[key] to value.
- __sizeof__()
D.__sizeof__() -> size of D in memory, in bytes
- __str__()
Return str(self).
- __subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- clear()
D.clear() -> None. Remove all items from D.
- copy()
D.copy() -> a shallow copy of D
- get()
Return the value for key if key is in the dictionary, else default.
- items()
D.items() -> a set-like object providing a view on D’s items
- keys()
D.keys() -> a set-like object providing a view on D’s keys
- pop()
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault()
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update()
D.update([E, ]**F) -> None. Update D from dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values()
D.values() -> an object providing a view on D’s values
- class medcat.data.mctexport.MedCATTrainerExportAnnotation
Bases:
MedCATTrainerExportAnnotationRequireddict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- id: str | int
- validated: bool | None
- start: int
- end: int
- cui: str
- value: str
- __contains__()
True if the dictionary has the specified key, else False.
- __delattr__()
Implement delattr(self, name).
- __delitem__()
Delete self[key].
- __dir__()
Default dir() implementation.
- __eq__()
Return self==value.
- __format__()
Default object formatter.
- __ge__()
Return self>=value.
- __getattribute__()
Return getattr(self, name).
- __getitem__()
x.__getitem__(y) <==> x[y]
- __gt__()
Return self>value.
- __init__()
Initialize self. See help(type(self)) for accurate signature.
- __ior__()
Return self|=value.
- __iter__()
Implement iter(self).
- __le__()
Return self<=value.
- __len__()
Return len(self).
- __lt__()
Return self<value.
- __ne__()
Return self!=value.
- __new__()
Create and return a new object. See help(type) for accurate signature.
- __or__()
Return self|value.
- __reduce__()
Helper for pickle.
- __reduce_ex__()
Helper for pickle.
- __repr__()
Return repr(self).
- __reversed__()
Return a reverse iterator over the dict keys.
- __ror__()
Return value|self.
- __setattr__()
Implement setattr(self, name, value).
- __setitem__()
Set self[key] to value.
- __sizeof__()
D.__sizeof__() -> size of D in memory, in bytes
- __str__()
Return str(self).
- __subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- clear()
D.clear() -> None. Remove all items from D.
- copy()
D.copy() -> a shallow copy of D
- get()
Return the value for key if key is in the dictionary, else default.
- items()
D.items() -> a set-like object providing a view on D’s items
- keys()
D.keys() -> a set-like object providing a view on D’s keys
- pop()
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault()
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update()
D.update([E, ]**F) -> None. Update D from dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values()
D.values() -> an object providing a view on D’s values
- class medcat.data.mctexport.MedCATTrainerExportDocument
Bases:
typing_extensions.TypedDictdict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- name: str
- id: Any
- last_modified: str
- text: str
- annotations: list[MedCATTrainerExportAnnotation]
- __contains__()
True if the dictionary has the specified key, else False.
- __delattr__()
Implement delattr(self, name).
- __delitem__()
Delete self[key].
- __dir__()
Default dir() implementation.
- __eq__()
Return self==value.
- __format__()
Default object formatter.
- __ge__()
Return self>=value.
- __getattribute__()
Return getattr(self, name).
- __getitem__()
x.__getitem__(y) <==> x[y]
- __gt__()
Return self>value.
- __init__()
Initialize self. See help(type(self)) for accurate signature.
- __ior__()
Return self|=value.
- __iter__()
Implement iter(self).
- __le__()
Return self<=value.
- __len__()
Return len(self).
- __lt__()
Return self<value.
- __ne__()
Return self!=value.
- __new__()
Create and return a new object. See help(type) for accurate signature.
- __or__()
Return self|value.
- __reduce__()
Helper for pickle.
- __reduce_ex__()
Helper for pickle.
- __repr__()
Return repr(self).
- __reversed__()
Return a reverse iterator over the dict keys.
- __ror__()
Return value|self.
- __setattr__()
Implement setattr(self, name, value).
- __setitem__()
Set self[key] to value.
- __sizeof__()
D.__sizeof__() -> size of D in memory, in bytes
- __str__()
Return str(self).
- __subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- clear()
D.clear() -> None. Remove all items from D.
- copy()
D.copy() -> a shallow copy of D
- get()
Return the value for key if key is in the dictionary, else default.
- items()
D.items() -> a set-like object providing a view on D’s items
- keys()
D.keys() -> a set-like object providing a view on D’s keys
- pop()
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault()
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update()
D.update([E, ]**F) -> None. Update D from dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values()
D.values() -> an object providing a view on D’s values
- class medcat.data.mctexport.MedCATTrainerExportProject
Bases:
typing_extensions.TypedDictdict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- name: str
- id: Any
- cuis: str
- tuis: str | None
- documents: list[MedCATTrainerExportDocument]
- __contains__()
True if the dictionary has the specified key, else False.
- __delattr__()
Implement delattr(self, name).
- __delitem__()
Delete self[key].
- __dir__()
Default dir() implementation.
- __eq__()
Return self==value.
- __format__()
Default object formatter.
- __ge__()
Return self>=value.
- __getattribute__()
Return getattr(self, name).
- __getitem__()
x.__getitem__(y) <==> x[y]
- __gt__()
Return self>value.
- __init__()
Initialize self. See help(type(self)) for accurate signature.
- __ior__()
Return self|=value.
- __iter__()
Implement iter(self).
- __le__()
Return self<=value.
- __len__()
Return len(self).
- __lt__()
Return self<value.
- __ne__()
Return self!=value.
- __new__()
Create and return a new object. See help(type) for accurate signature.
- __or__()
Return self|value.
- __reduce__()
Helper for pickle.
- __reduce_ex__()
Helper for pickle.
- __repr__()
Return repr(self).
- __reversed__()
Return a reverse iterator over the dict keys.
- __ror__()
Return value|self.
- __setattr__()
Implement setattr(self, name, value).
- __setitem__()
Set self[key] to value.
- __sizeof__()
D.__sizeof__() -> size of D in memory, in bytes
- __str__()
Return str(self).
- __subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- clear()
D.clear() -> None. Remove all items from D.
- copy()
D.copy() -> a shallow copy of D
- get()
Return the value for key if key is in the dictionary, else default.
- items()
D.items() -> a set-like object providing a view on D’s items
- keys()
D.keys() -> a set-like object providing a view on D’s keys
- pop()
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault()
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update()
D.update([E, ]**F) -> None. Update D from dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values()
D.values() -> an object providing a view on D’s values
- medcat.data.mctexport.MedCATTrainerExportProjectInfo
The project name, project ID, CUIs str, and TUIs str
- class medcat.data.mctexport.MedCATTrainerExport
Bases:
typing_extensions.TypedDictdict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- projects: list[MedCATTrainerExportProject]
- __contains__()
True if the dictionary has the specified key, else False.
- __delattr__()
Implement delattr(self, name).
- __delitem__()
Delete self[key].
- __dir__()
Default dir() implementation.
- __eq__()
Return self==value.
- __format__()
Default object formatter.
- __ge__()
Return self>=value.
- __getattribute__()
Return getattr(self, name).
- __getitem__()
x.__getitem__(y) <==> x[y]
- __gt__()
Return self>value.
- __init__()
Initialize self. See help(type(self)) for accurate signature.
- __ior__()
Return self|=value.
- __iter__()
Implement iter(self).
- __le__()
Return self<=value.
- __len__()
Return len(self).
- __lt__()
Return self<value.
- __ne__()
Return self!=value.
- __new__()
Create and return a new object. See help(type) for accurate signature.
- __or__()
Return self|value.
- __reduce__()
Helper for pickle.
- __reduce_ex__()
Helper for pickle.
- __repr__()
Return repr(self).
- __reversed__()
Return a reverse iterator over the dict keys.
- __ror__()
Return value|self.
- __setattr__()
Implement setattr(self, name, value).
- __setitem__()
Set self[key] to value.
- __sizeof__()
D.__sizeof__() -> size of D in memory, in bytes
- __str__()
Return str(self).
- __subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- clear()
D.clear() -> None. Remove all items from D.
- copy()
D.copy() -> a shallow copy of D
- get()
Return the value for key if key is in the dictionary, else default.
- items()
D.items() -> a set-like object providing a view on D’s items
- keys()
D.keys() -> a set-like object providing a view on D’s keys
- pop()
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault()
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update()
D.update([E, ]**F) -> None. Update D from dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values()
D.values() -> an object providing a view on D’s values
- medcat.data.mctexport.iter_projects(export)
Iterate over all the projects in the trainer export.
- Parameters:
export (MedCATTrainerExport) – The trainer export.
- Yields:
Iterator[MedCATTrainerExportProject] – Project iterator.
- Return type:
Iterator[MedCATTrainerExportProject]
- medcat.data.mctexport.iter_docs(export)
Iterate over all the docs in a trainer export.
- Parameters:
export (MedCATTrainerExport) – The trainer export.
- Yields:
- Iterator[tuple[MedCATTrainerExportProjectInfo,
MedCATTrainerExportDocument]]:
The project info and the document.
- Return type:
Iterator[tuple[MedCATTrainerExportProjectInfo, MedCATTrainerExportDocument]]
- medcat.data.mctexport.iter_anns(export)
Iterate over all the annotations in a trainer export.
- Parameters:
export (MedCATTrainerExport) – The trainer export.
- Yields:
- Iterator[tuple[MedCATTrainerExportProjectInfo,
MedCATTrainerExportDocument, MedCATTrainerExportAnnotation]]:
The project info, the document, and the annotation.
- Return type:
Iterator[tuple[MedCATTrainerExportProjectInfo, MedCATTrainerExportDocument, MedCATTrainerExportAnnotation]]
- medcat.data.mctexport.count_all_annotations(export)
Count the number of annotations in a trainer export.
- Parameters:
export (MedCATTrainerExport) – The trainer export.
- Returns:
int – The total number of annotations.
- Return type:
int
- medcat.data.mctexport.count_all_docs(export)
Count the number of documents in a trainer export.
- Parameters:
export (MedCATTrainerExport) – The trainer export.
- Returns:
int – The total number of documents.
- Return type:
int
- medcat.data.mctexport.get_nr_of_annotations(doc)
Get the number of annotations for a tariner export document.
- Parameters:
doc (MedCATTrainerExportDocument) – The trainer export document.
- Returns:
int – The number of annotations within the document.
- Return type:
int
- medcat.data.mctexport.count_anns_per_concept(export)
- Parameters:
export (MedCATTrainerExport)
- Return type:
dict[str, int]