diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..ea91428 --- /dev/null +++ b/404.html @@ -0,0 +1,1005 @@ + + + +
+ + + + + + + + + + + + + + + + +Data about people’s health stored in electronic health records (EHRs) can play an important role in improving the quality of patient care. Much of the information in EHRs is recorded in ordinary language without any restriction on format ('free text'), as this is the natural way in which people communicate. However, if this information were stored in a standardised, structured format, computers will also be able to process the information to help clinicians find and interpret information for better and safer decision making. This would enable EHR systems such as Epic, the system in place at UCLH since April 2019, to support clinical decision making. For instance, the system may be able to ensure that a patient is not prescribed medicine that would give them an allergic reaction.
+Free text may contain words and abbreviations which may be interpreted in more than one way, such as 'HR', which can mean 'Hour' or 'Heart Rate'. Free text may also contain negations; for example, a diagnosis may be mentioned in the text but the rest of the sentence might say that it was ruled out. Although computers can be used to interpret free text, they cannot always get it right, so clinicians will always have to check the results to ensure patient safety. Expressing information in a structured way can avoid this problem, but has a big disadvantage - it can be time-consuming for clinicians to enter the information. This can mean that information is incomplete, or clinicians are so busy on the computer that they do not have time to listen to their patients.
+The aim of MiADE is to develop a system to support automatic conversion of the clinician’s free text into a structured format. The clinician can check the structured data immediately, before making it a formal part of the patient’s record. The system will record a patient’s diagnoses, medications and allergies in a structured way, using NHS-endorsed clinical data standards (e.g. FIHR and SNOMED CT). It will use a technique called Natural Language Processing (NLP). NLP has been used by research teams to extract information from existing EHRs but has rarely been used to improve the way information is entered in the first place. Our NLP system will continuously learn and improve as more text is analysed and checked by clinicians.
+We will first test the system in University College London Hospitals, where a new EHR system called Epic is in place. We will study how effective it is, and how clinicians and patients find it when it is used in consultations. Based on feedback, we will make improvements and install it for testing at a second site (Great Ormond Street Hospital). Our aim is for the system to be eventually rolled out to more hospitals and doctors’ surgeries across the NHS.
+ + + + + + + + + + + + + +The MiADE project is developed by a team of clinicians, developers, AI researchers, and data standard experts at University College London (UCL) and the University College London Hospitals (UCLH), in collaboration with the Cogstack at King's College London (KCL).
+ + + + + + + + + + + + + +
+ Bases: ABC
An abstract base class for annotators.
+Annotators are responsible for processing medical notes and extracting relevant concepts from them.
+ + +Attributes:
+Name | +Type | +Description | +
---|---|---|
cat |
+
+ CAT
+ |
+
+
+
+ The MedCAT instance used for concept extraction. + |
+
config |
+
+ AnnotatorConfig
+ |
+
+
+
+ The configuration for the annotator. + |
+
miade/annotators.py
182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 |
|
concept_types
+
+
+ abstractmethod
+ property
+
+
+¶Abstract property that should return a list of concept types supported by the annotator.
+pipeline
+
+
+ abstractmethod
+ property
+
+
+¶Abstract property that should return a list of pipeline steps for the annotator.
+__call__(note, record_concepts=None, dosage_extractor=None)
+
+¶Runs the annotation pipeline on a given note and returns the extracted concepts.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
note |
+
+ Note
+ |
+
+
+
+ The input note to process. + |
+ + required + | +
record_concepts |
+
+ Optional[List[Concept]]
+ |
+
+
+
+ The list of concepts from existing EHR records. + |
+
+ None
+ |
+
dosage_extractor |
+
+ Optional[DosageExtractor]
+ |
+
+
+
+ The dosage extractor to use for extracting dosage information. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ List[Concept]: The extracted concepts from the note. + |
+
miade/annotators.py
add_dosages_to_concepts(dosage_extractor, concepts, note)
+
+
+ staticmethod
+
+
+¶Gets dosages for medication concepts
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
dosage_extractor |
+
+ DosageExtractor
+ |
+
+
+
+ The dosage extractor object + |
+ + required + | +
concepts |
+
+ List[Concept]
+ |
+
+
+
+ List of concepts extracted + |
+ + required + | +
note |
+
+ Note
+ |
+
+
+
+ The input note + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ List of concepts with dosages for medication concepts + |
+
miade/annotators.py
add_numbering_to_name(concepts)
+
+
+ staticmethod
+
+
+¶Adds numbering to the names of problem concepts to control output ordering.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
concepts |
+
+ List[Concept]
+ |
+
+
+
+ The list of concepts to add numbering to. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ The list of concepts with numbering added to their names. + |
+
miade/annotators.py
deduplicate(concepts, record_concepts)
+
+
+ staticmethod
+
+
+¶Removes duplicate concepts from the extracted concepts list by strict ID matching.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
concepts |
+
+ List[Concept]
+ |
+
+
+
+ The list of extracted concepts. + |
+ + required + | +
record_concepts |
+
+ Optional[List[Concept]]
+ |
+
+
+
+ The list of concepts from existing EHR records. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ The deduplicated list of concepts. + |
+
miade/annotators.py
get_concepts(note)
+
+¶Extracts concepts from a note using the MedCAT instance.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
note |
+
+ Note
+ |
+
+
+
+ The input note to extract concepts from. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ The extracted concepts from the note. + |
+
miade/annotators.py
postprocess()
+
+
+ abstractmethod
+
+
+¶Abstract method that should implement the logic for post-processing extracted concepts.
+ + +preprocess(note)
+
+
+ staticmethod
+
+
+¶Preprocesses a note by cleaning its text and splitting it into paragraphs.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
note |
+
+ Note
+ |
+
+
+
+ The input note to preprocess. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ Note
+ |
+
+
+
+ The preprocessed note. + |
+
miade/annotators.py
run_pipeline(note, record_concepts, dosage_extractor=None)
+
+¶Runs the annotation pipeline on a given note and returns the extracted concepts.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
note |
+
+ Note
+ |
+
+
+
+ The input note to process. + |
+ + required + | +
record_concepts |
+
+ List[Concept]
+ |
+
+
+
+ The list of concepts from existing EHR records. + |
+ + required + | +
dosage_extractor |
+
+ Optional[DosageExtractor]
+ |
+
+
+
+ An optional dosage extractor to add dosages to concepts. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ List[Concept]: The extracted concepts from the note. + |
+
miade/annotators.py
+ Bases: object
Represents a concept in the system.
+ + +Attributes:
+Name | +Type | +Description | +
---|---|---|
id |
+
+ str
+ |
+
+
+
+ The unique identifier of the concept. + |
+
name |
+
+ str
+ |
+
+
+
+ The name of the concept. + |
+
category |
+
+ Optional[Enum]
+ |
+
+
+
+ The category of the concept (optional). + |
+
start |
+
+ Optional[int]
+ |
+
+
+
+ The start position of the concept (optional). + |
+
end |
+
+ Optional[int]
+ |
+
+
+
+ The end position of the concept (optional). + |
+
dosage |
+
+ Optional[Dosage]
+ |
+
+
+
+ The dosage of the concept (optional). + |
+
linked_concepts |
+
+ Optional[List[Concept]]
+ |
+
+
+
+ The linked concepts of the concept (optional). + |
+
negex |
+
+ Optional[bool]
+ |
+
+
+
+ The negex value of the concept (optional). + |
+
meta_anns |
+
+ Optional[List[MetaAnnotations]]
+ |
+
+
+
+ The meta annotations of the concept (optional). + |
+
debug_dict |
+
+ Optional[Dict]
+ |
+
+
+
+ The debug dictionary of the concept (optional). + |
+
miade/concept.py
18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 |
|
from_entity(entity)
+
+
+ classmethod
+
+
+¶Converts an entity dictionary into a Concept object.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
entity |
+
+ Dict
+ |
+
+
+
+ The entity dictionary containing the necessary information. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ Concept
+ |
+
+
+
+ The Concept object created from the entity dictionary. + |
+
miade/concept.py
+ Bases: object
Container for drug dosage information
+ +miade/dosage.py
268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 |
|
from_doc(doc, calculate=True)
+
+
+ classmethod
+
+
+¶Parses dosage from a spacy doc object.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
doc |
+
+ Doc
+ |
+
+
+
+ Spacy doc object with processed dosage text. + |
+ + required + | +
calculate |
+
+ bool
+ |
+
+
+
+ Whether to calculate duration if total and daily dose is given. Defaults to True. + |
+
+ True
+ |
+
Returns:
+Type | +Description | +
---|---|
+ | +
+
+
+ An instance of the class with the parsed dosage information. + |
+
miade/dosage.py
287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 |
|
Parses and extracts drug dosage
+ + +Attributes:
+Name | +Type | +Description | +
---|---|---|
model |
+
+ str
+ |
+
+
+
+ The name of the model to be used for dosage extraction. + |
+
dosage_extractor |
+
+ Language
+ |
+
+
+
+ The Spacy pipeline for dosage extraction. + |
+
miade/dosageextractor.py
extract(text, calculate=True)
+
+¶Processes a string that contains dosage instructions (excluding drug concept as this is handled by core)
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
text |
+
+ str
+ |
+
+
+
+ The string containing dosage instructions. + |
+ + required + | +
calculate |
+
+ bool
+ |
+
+
+
+ Whether to calculate duration from total and daily dose, if given. + |
+
+ True
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Optional[Dosage]
+ |
+
+
+
+ The dosage object with parsed dosages in CDA format. + |
+
miade/dosageextractor.py
+ Bases: Annotator
Annotator class for medication and allergy concepts.
+This class extends the Annotator
base class and provides methods for running a pipeline of
+annotation tasks on a given note, as well as validating and converting concepts related to
+medications and allergies.
Attributes:
+Name | +Type | +Description | +
---|---|---|
valid_meds |
+
+ List[int]
+ |
+
+
+
+ A list of valid medication IDs. + |
+
reactions_subset_lookup |
+
+ Dict[int, str]
+ |
+
+
+
+ A dictionary mapping reaction IDs to their corresponding subset IDs. + |
+
allergens_subset_lookup |
+
+ Dict[int, str]
+ |
+
+
+
+ A dictionary mapping allergen IDs to their corresponding subset IDs. + |
+
allergy_type_lookup |
+
+ Dict[str, List[str]]
+ |
+
+
+
+ A dictionary mapping allergen types to their corresponding codes. + |
+
vtm_to_vmp_lookup |
+
+ Dict[str, str]
+ |
+
+
+
+ A dictionary mapping VTM (Virtual Therapeutic Moiety) IDs to VMP (Virtual Medicinal Product) IDs. + |
+
vtm_to_text_lookup |
+
+ Dict[str, str]
+ |
+
+
+
+ A dictionary mapping VTM IDs to their corresponding text. + |
+
miade/annotators.py
677 + 678 + 679 + 680 + 681 + 682 + 683 + 684 + 685 + 686 + 687 + 688 + 689 + 690 + 691 + 692 + 693 + 694 + 695 + 696 + 697 + 698 + 699 + 700 + 701 + 702 + 703 + 704 + 705 + 706 + 707 + 708 + 709 + 710 + 711 + 712 + 713 + 714 + 715 + 716 + 717 + 718 + 719 + 720 + 721 + 722 + 723 + 724 + 725 + 726 + 727 + 728 + 729 + 730 + 731 + 732 + 733 + 734 + 735 + 736 + 737 + 738 + 739 + 740 + 741 + 742 + 743 + 744 + 745 + 746 + 747 + 748 + 749 + 750 + 751 + 752 + 753 + 754 + 755 + 756 + 757 + 758 + 759 + 760 + 761 + 762 + 763 + 764 + 765 + 766 + 767 + 768 + 769 + 770 + 771 + 772 + 773 + 774 + 775 + 776 + 777 + 778 + 779 + 780 + 781 + 782 + 783 + 784 + 785 + 786 + 787 + 788 + 789 + 790 + 791 + 792 + 793 + 794 + 795 + 796 + 797 + 798 + 799 + 800 + 801 + 802 + 803 + 804 + 805 + 806 + 807 + 808 + 809 + 810 + 811 + 812 + 813 + 814 + 815 + 816 + 817 + 818 + 819 + 820 + 821 + 822 + 823 + 824 + 825 + 826 + 827 + 828 + 829 + 830 + 831 + 832 + 833 + 834 + 835 + 836 + 837 + 838 + 839 + 840 + 841 + 842 + 843 + 844 + 845 + 846 + 847 + 848 + 849 + 850 + 851 + 852 + 853 + 854 + 855 + 856 + 857 + 858 + 859 + 860 + 861 + 862 + 863 + 864 + 865 + 866 + 867 + 868 + 869 + 870 + 871 + 872 + 873 + 874 + 875 + 876 + 877 + 878 + 879 + 880 + 881 + 882 + 883 + 884 + 885 + 886 + 887 + 888 + 889 + 890 + 891 + 892 + 893 + 894 + 895 + 896 + 897 + 898 + 899 + 900 + 901 + 902 + 903 + 904 + 905 + 906 + 907 + 908 + 909 + 910 + 911 + 912 + 913 + 914 + 915 + 916 + 917 + 918 + 919 + 920 + 921 + 922 + 923 + 924 + 925 + 926 + 927 + 928 + 929 + 930 + 931 + 932 + 933 + 934 + 935 + 936 + 937 + 938 + 939 + 940 + 941 + 942 + 943 + 944 + 945 + 946 + 947 + 948 + 949 + 950 + 951 + 952 + 953 + 954 + 955 + 956 + 957 + 958 + 959 + 960 + 961 + 962 + 963 + 964 + 965 + 966 + 967 + 968 + 969 + 970 + 971 + 972 + 973 + 974 + 975 + 976 + 977 + 978 + 979 + 980 + 981 + 982 + 983 + 984 + 985 + 986 + 987 + 988 + 989 + 990 + 991 + 992 + 993 + 994 + 995 + 996 + 997 + 998 + 999 +1000 +1001 +1002 +1003 +1004 +1005 +1006 +1007 +1008 +1009 +1010 +1011 +1012 +1013 +1014 +1015 +1016 +1017 +1018 +1019 +1020 +1021 +1022 +1023 +1024 +1025 +1026 +1027 +1028 +1029 +1030 +1031 +1032 +1033 +1034 +1035 +1036 +1037 +1038 +1039 +1040 +1041 +1042 +1043 +1044 +1045 +1046 +1047 +1048 +1049 +1050 +1051 +1052 +1053 +1054 +1055 +1056 +1057 +1058 +1059 +1060 +1061 +1062 +1063 +1064 +1065 +1066 +1067 +1068 +1069 +1070 +1071 +1072 +1073 +1074 +1075 +1076 +1077 +1078 +1079 +1080 +1081 +1082 +1083 +1084 +1085 +1086 +1087 +1088 +1089 +1090 +1091 +1092 +1093 +1094 +1095 +1096 +1097 +1098 +1099 +1100 +1101 +1102 +1103 +1104 +1105 +1106 +1107 +1108 +1109 +1110 +1111 +1112 +1113 +1114 +1115 +1116 +1117 +1118 +1119 +1120 +1121 +1122 +1123 +1124 +1125 +1126 +1127 +1128 +1129 +1130 +1131 +1132 +1133 +1134 +1135 +1136 +1137 +1138 +1139 +1140 +1141 +1142 +1143 +1144 +1145 +1146 +1147 +1148 +1149 +1150 +1151 +1152 +1153 +1154 +1155 +1156 +1157 +1158 +1159 +1160 +1161 +1162 +1163 +1164 +1165 +1166 +1167 +1168 +1169 +1170 +1171 +1172 +1173 +1174 +1175 +1176 +1177 +1178 +1179 +1180 +1181 +1182 +1183 +1184 +1185 +1186 +1187 +1188 +1189 +1190 +1191 +1192 +1193 +1194 +1195 |
|
concept_types: List[Category]
+
+
+ property
+
+
+¶Returns a list of concept types.
+ + +Returns:
+Type | +Description | +
---|---|
+ List[Category]
+ |
+
+
+
+ [Category.MEDICATION, Category.ALLERGY, Category.REACTION] + |
+
pipeline: List[str]
+
+
+ property
+
+
+¶Returns a list of annotators in the pipeline.
+The annotators are executed in the order they appear in the list.
+ + +Returns:
+Type | +Description | +
---|---|
+ List[str]
+ |
+
+
+
+ ["preprocessor", "medcat", "paragrapher", "postprocessor", "dosage_extractor", "vtm_converter", "deduplicator"] + |
+
convert_VTM_to_VMP_or_text(concepts)
+
+¶Converts medication concepts from VTM (Virtual Therapeutic Moiety) to VMP (Virtual Medicinal Product) or text.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
concepts |
+
+ List[Concept]
+ |
+
+
+
+ A list of medication concepts. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ A list of medication concepts with updated IDs, names, and dosages. + |
+
miade/annotators.py
1125 +1126 +1127 +1128 +1129 +1130 +1131 +1132 +1133 +1134 +1135 +1136 +1137 +1138 +1139 +1140 +1141 +1142 +1143 +1144 +1145 +1146 +1147 +1148 +1149 +1150 +1151 +1152 +1153 +1154 +1155 +1156 +1157 +1158 +1159 +1160 +1161 +1162 +1163 +1164 +1165 +1166 +1167 +1168 +1169 +1170 +1171 +1172 +1173 +1174 +1175 +1176 +1177 +1178 +1179 +1180 +1181 +1182 +1183 +1184 +1185 +1186 +1187 +1188 +1189 +1190 +1191 +1192 +1193 +1194 +1195 |
|
postprocess(concepts, note)
+
+¶Postprocesses a list of concepts and links reactions to allergens.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
concepts |
+
+ List[Concept]
+ |
+
+
+
+ The list of concepts to be postprocessed. + |
+ + required + | +
note |
+
+ Note
+ |
+
+
+
+ The note object associated with the concepts. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ The postprocessed list of concepts. + |
+
miade/annotators.py
process_paragraphs(note, concepts)
+
+¶Process the paragraphs in a note and update the list of concepts.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
note |
+
+ Note
+ |
+
+
+
+ The note object containing the paragraphs. + |
+ + required + | +
concepts |
+
+ List[Concept]
+ |
+
+
+
+ The list of concepts to be updated. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ The updated list of concepts. + |
+
miade/annotators.py
run_pipeline(note, record_concepts, dosage_extractor)
+
+¶Runs the annotation pipeline on the given note.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
note |
+
+ Note
+ |
+
+
+
+ The input note to run the pipeline on. + |
+ + required + | +
record_concepts |
+
+ List[Concept]
+ |
+
+
+
+ The list of previously recorded concepts. + |
+ + required + | +
dosage_extractor |
+
+ Optional[DosageExtractor]
+ |
+
+
+
+ The dosage extractor function. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ The list of annotated concepts. + |
+
miade/annotators.py
+ Bases: BaseModel
Represents a meta annotation with a name, value, and optional confidence.
+ + +Attributes:
+Name | +Type | +Description | +
---|---|---|
name |
+
+ str
+ |
+
+
+
+ The name of the meta annotation. + |
+
value |
+
+ Enum
+ |
+
+
+
+ The value of the meta annotation. + |
+
confidence |
+
+ float
+ |
+
+
+
+ The confidence level of the meta annotation. + |
+
miade/metaannotations.py
+ Bases: object
Represents a note object.
+ + +Attributes:
+Name | +Type | +Description | +
---|---|---|
text |
+
+ str
+ |
+
+
+
+ The text content of the note. + |
+
raw_text |
+
+ str
+ |
+
+
+
+ The raw text content of the note. + |
+
regex_config |
+
+ str
+ |
+
+
+
+ The path to the regex configuration file. + |
+
paragraphs |
+
+ Optional[List[Paragraph]]
+ |
+
+
+
+ A list of paragraphs in the note. + |
+
miade/note.py
49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 |
|
clean_text()
+
+¶Cleans the text content of the note.
+This method performs various cleaning operations on the text content of the note, +such as replacing spaces, removing punctuation, and removing empty lines.
+ +miade/note.py
get_paragraphs()
+
+¶Splits the note into paragraphs.
+This method splits the text content of the note into paragraphs based on double line breaks. +It also assigns a paragraph type to each paragraph based on matching patterns in the heading.
+ +miade/note.py
Main processor of MiADE which extract, postprocesses, and deduplicates concepts given +annotators (MedCAT models), Note, and existing concepts
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
model_directory |
+
+ Path
+ |
+
+
+
+ Path to directory that contains medcat models and a config.yaml file + |
+ + required + | +
model_config_path |
+
+ Path
+ |
+
+
+
+ Path to the model config file. Defaults to None. + |
+
+ None
+ |
+
log_level |
+
+ int
+ |
+
+
+
+ Log level. Defaults to logging.INFO. + |
+
+ INFO
+ |
+
dosage_extractor_log_level |
+
+ int
+ |
+
+
+
+ Log level for dosage extractor. Defaults to logging.INFO. + |
+
+ INFO
+ |
+
device |
+
+ str
+ |
+
+
+
+ Device to run inference on (cpu or gpu). Defaults to "cpu". + |
+
+ 'cpu'
+ |
+
custom_annotators |
+
+ List[Annotator]
+ |
+
+
+
+ List of custom annotators. Defaults to None. + |
+
+ None
+ |
+
miade/core.py
55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 |
|
add_annotator(name)
+
+¶Adds an annotator to the processor.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
name |
+
+ str
+ |
+
+
+
+ The alias of the annotator to add. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
Raises:
+Type | +Description | +
---|---|
+ Exception
+ |
+
+
+
+ If there is an error creating the annotator. + |
+
miade/core.py
get_concept_dicts(note, filter_uncategorized=True, record_concepts=None)
+
+¶Returns concepts in dictionary format.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
note |
+
+ Note
+ |
+
+
+
+ Note containing text to extract concepts from. + |
+ + required + | +
filter_uncategorized |
+
+ bool
+ |
+
+
+
+ If True, does not return concepts where category=None. Default is True. + |
+
+ True
+ |
+
record_concepts |
+
+ Optional[List[Concept]]
+ |
+
+
+
+ List of concepts in existing record. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ List[Dict]
+ |
+
+
+
+ Extracted concepts in JSON-compatible dictionary format. + |
+
miade/core.py
print_model_cards()
+
+¶Prints the model cards for each annotator in the annotators
list.
Each model card includes the name of the annotator's class and its category.
+ +miade/core.py
process(note, record_concepts=None)
+
+¶Process the given note and extract concepts using the loaded annotators.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
note |
+
+ Note
+ |
+
+
+
+ The note to be processed. + |
+ + required + | +
record_concepts |
+
+ Optional[List[Concept]]
+ |
+
+
+
+ A list of existing concepts in the EHR record. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ A list of extracted concepts. + |
+
miade/core.py
remove_annotator(name)
+
+¶Removes an annotator from the processor.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
name |
+
+ str
+ |
+
+
+
+ The alias of the annotator to remove. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
miade/core.py
+ Bases: Annotator
Annotator class for identifying and processing problems in medical notes.
+This class extends the base Annotator
class and provides specific functionality
+for identifying and processing problems in medical notes. It implements methods
+for loading problem lookup data, processing meta annotations, filtering concepts,
+and post-processing the annotated concepts.
Attributes:
+Name | +Type | +Description | +
---|---|---|
cat |
+
+ CAT
+ |
+
+
+
+ The CAT (Concept Annotation Tool) instance used for annotation. + |
+
config |
+
+ AnnotatorConfig
+ |
+
+
+
+ The configuration object for the annotator. + |
+
concept_types (list): A list of concept types supported by this annotator. +pipeline (list): The list of processing steps in the annotation pipeline.
+miade/annotators.py
424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612 +613 +614 +615 +616 +617 +618 +619 +620 +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631 +632 +633 +634 +635 +636 +637 +638 +639 +640 +641 +642 +643 +644 +645 +646 +647 +648 +649 +650 +651 +652 +653 +654 +655 +656 +657 +658 +659 +660 +661 +662 +663 +664 +665 +666 +667 +668 +669 +670 +671 +672 +673 +674 |
|
concept_types: List[Category]
+
+
+ property
+
+
+¶Get the list of concept types supported by this annotator.
+ + +Returns:
+Type | +Description | +
---|---|
+ List[Category]
+ |
+
+
+
+ [Category.PROBLEM] + |
+
pipeline: List[str]
+
+
+ property
+
+
+¶Get the list of processing steps in the annotation pipeline.
+ + +Returns:
+Type | +Description | +
---|---|
+ List[str]
+ |
+
+
+
+ ["preprocessor", "medcat", "paragrapher", "postprocessor", "deduplicator"] + |
+
postprocess(concepts)
+
+¶Post-process the concepts and filter out irrelevant concepts.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
concepts |
+
+ List[Concept]
+ |
+
+
+
+ The list of concepts to post-process. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ The filtered list of concepts. + |
+
miade/annotators.py
process_paragraphs(note, concepts)
+
+¶Process the paragraphs in a note and filter the concepts.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
note |
+
+ Note
+ |
+
+
+
+ The note to process. + |
+ + required + | +
concepts |
+
+ List[Concept]
+ |
+
+
+
+ The list of concepts to filter. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ List[Concept]
+ |
+
+
+
+ The filtered list of concepts. + |
+
miade/annotators.py