github.com/hscells/guru@v0.0.0-20200207042420-2dabeb950d69/semtypes.go (about) 1 package guru 2 3 import ( 4 "bufio" 5 "bytes" 6 "strings" 7 ) 8 9 type SemType struct { 10 Abbreviation string 11 TUI string 12 TypeName string 13 } 14 15 var types map[string]SemType 16 17 func LoadSemTypes(input string) map[string]SemType { 18 g := make(map[string]SemType) 19 s := bufio.NewScanner(bytes.NewBufferString(input)) 20 for s.Scan() { 21 line := strings.Split(s.Text(), "|") 22 g[line[0]] = SemType{ 23 Abbreviation: line[0], 24 TUI: line[1], 25 TypeName: line[2], 26 } 27 } 28 return g 29 } 30 31 func MapSemType(abbr string) (SemType, bool) { 32 if types == nil { 33 types = LoadSemTypes(SEMTYPES) 34 } 35 v, ok := types[abbr] 36 return v, ok 37 } 38 39 const SEMTYPES = `aapp|T116|Amino Acid, Peptide, or Protein 40 acab|T020|Acquired Abnormality 41 acty|T052|Activity 42 aggp|T100|Age Group 43 amas|T087|Amino Acid Sequence 44 amph|T011|Amphibian 45 anab|T190|Anatomical Abnormality 46 anim|T008|Animal 47 anst|T017|Anatomical Structure 48 antb|T195|Antibiotic 49 arch|T194|Archaeon 50 bacs|T123|Biologically Active Substance 51 bact|T007|Bacterium 52 bdsu|T031|Body Substance 53 bdsy|T022|Body System 54 bhvr|T053|Behavior 55 biof|T038|Biologic Function 56 bird|T012|Bird 57 blor|T029|Body Location or Region 58 bmod|T091|Biomedical Occupation or Discipline 59 bodm|T122|Biomedical or Dental Material 60 bpoc|T023|Body Part, Organ, or Organ Component 61 bsoj|T030|Body Space or Junction 62 celc|T026|Cell Component 63 celf|T043|Cell Function 64 cell|T025|Cell 65 cgab|T019|Congenital Abnormality 66 chem|T103|Chemical 67 chvf|T120|Chemical Viewed Functionally 68 chvs|T104|Chemical Viewed Structurally 69 clas|T185|Classification 70 clna|T201|Clinical Attribute 71 clnd|T200|Clinical Drug 72 cnce|T077|Conceptual Entity 73 comd|T049|Cell or Molecular Dysfunction 74 crbs|T088|Carbohydrate Sequence 75 diap|T060|Diagnostic Procedure 76 dora|T056|Daily or Recreational Activity 77 drdd|T203|Drug Delivery Device 78 dsyn|T047|Disease or Syndrome 79 edac|T065|Educational Activity 80 eehu|T069|Environmental Effect of Humans 81 elii|T196|Element, Ion, or Isotope 82 emod|T050|Experimental Model of Disease 83 emst|T018|Embryonic Structure 84 enty|T071|Entity 85 enzy|T126|Enzyme 86 euka|T204|Eukaryote 87 evnt|T051|Event 88 famg|T099|Family Group 89 ffas|T021|Fully Formed Anatomical Structure 90 fish|T013|Fish 91 fndg|T033|Finding 92 fngs|T004|Fungus 93 food|T168|Food 94 ftcn|T169|Functional Concept 95 genf|T045|Genetic Function 96 geoa|T083|Geographic Area 97 gngm|T028|Gene or Genome 98 gora|T064|Governmental or Regulatory Activity 99 grpa|T102|Group Attribute 100 grup|T096|Group 101 hcpp|T068|Human-caused Phenomenon or Process 102 hcro|T093|Health Care Related Organization 103 hlca|T058|Health Care Activity 104 hops|T131|Hazardous or Poisonous Substance 105 horm|T125|Hormone 106 humn|T016|Human 107 idcn|T078|Idea or Concept 108 imft|T129|Immunologic Factor 109 inbe|T055|Individual Behavior 110 inch|T197|Inorganic Chemical 111 inpo|T037|Injury or Poisoning 112 inpr|T170|Intellectual Product 113 irda|T130|Indicator, Reagent, or Diagnostic Aid 114 lang|T171|Language 115 lbpr|T059|Laboratory Procedure 116 lbtr|T034|Laboratory or Test Result 117 mamm|T015|Mammal 118 mbrt|T063|Molecular Biology Research Technique 119 mcha|T066|Machine Activity 120 medd|T074|Medical Device 121 menp|T041|Mental Process 122 mnob|T073|Manufactured Object 123 mobd|T048|Mental or Behavioral Dysfunction 124 moft|T044|Molecular Function 125 mosq|T085|Molecular Sequence 126 neop|T191|Neoplastic Process 127 nnon|T114|Nucleic Acid, Nucleoside, or Nucleotide 128 npop|T070|Natural Phenomenon or Process 129 nusq|T086|Nucleotide Sequence 130 ocac|T057|Occupational Activity 131 ocdi|T090|Occupation or Discipline 132 orch|T109|Organic Chemical 133 orga|T032|Organism Attribute 134 orgf|T040|Organism Function 135 orgm|T001|Organism 136 orgt|T092|Organization 137 ortf|T042|Organ or Tissue Function 138 patf|T046|Pathologic Function 139 phob|T072|Physical Object 140 phpr|T067|Phenomenon or Process 141 phsf|T039|Physiologic Function 142 phsu|T121|Pharmacologic Substance 143 plnt|T002|Plant 144 podg|T101|Patient or Disabled Group 145 popg|T098|Population Group 146 prog|T097|Professional or Occupational Group 147 pros|T094|Professional Society 148 qlco|T080|Qualitative Concept 149 qnco|T081|Quantitative Concept 150 rcpt|T192|Receptor 151 rept|T014|Reptile 152 resa|T062|Research Activity 153 resd|T075|Research Device 154 rnlw|T089|Regulation or Law 155 sbst|T167|Substance 156 shro|T095|Self-help or Relief Organization 157 socb|T054|Social Behavior 158 sosy|T184|Sign or Symptom 159 spco|T082|Spatial Concept 160 tisu|T024|Tissue 161 tmco|T079|Temporal Concept 162 topp|T061|Therapeutic or Preventive Procedure 163 virs|T005|Virus 164 vita|T127|Vitamin 165 vtbt|T010|Vertebrate 166 `