Changeset 1569 for smart/trunk/p/C0SPROB2.m
- Timestamp:
- Oct 11, 2012, 1:42:56 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
smart/trunk/p/C0SPROB2.m
r1540 r1569 1 C0SPROB 2 ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 23 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 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 PROB(GRTN,C0SARY) 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 SNOMED(ZICD) 332 333 334 335 336 337 338 339 340 341 342 343 1 C0SPROB ; GPL - Smart Problem Processing ;5/01/12 17:05 2 ;;0.1;C0S;nopatch;noreleasedate;Build 2 3 ;Copyright 2012 George Lilly. Licensed under the terms of the GNU 4 ;General Public License See attached copy of the License. 5 ; 6 ;This program is free software; you can redistribute it and/or modify 7 ;it under the terms of the GNU General Public License as published by 8 ;the Free Software Foundation; either version 2 of the License, or 9 ;(at your option) any later version. 10 ; 11 ;This program is distributed in the hope that it will be useful, 12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of 13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 ;GNU General Public License for more details. 15 ; 16 ;You should have received a copy of the GNU General Public License along 17 ;with this program; if not, write to the Free Software Foundation, Inc., 18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 ; 20 Q 21 ; 22 ; sample VistA NHIN problem list 23 ; 24 ;^TMP("C0STBL",91,"problem",1,"acuity@value")="C" 25 ;^TMP("C0STBL",91,"problem",1,"entered@value")=3110531 26 ;^TMP("C0STBL",91,"problem",1,"facility@code")=100 27 ;^TMP("C0STBL",91,"problem",1,"facility@name")="VOE OFFICE INSTITUTION" 28 ;^TMP("C0STBL",91,"problem",1,"icd@value")=414.9 29 ;^TMP("C0STBL",91,"problem",1,"id@value")=100 30 ;^TMP("C0STBL",91,"problem",1,"location@value")="DR OFFICE" 31 ;^TMP("C0STBL",91,"problem",1,"name@value")="Coronary Artery Disease" 32 ;^TMP("C0STBL",91,"problem",1,"onset@value")=3100201 33 ;^TMP("C0STBL",91,"problem",1,"provider@code")=63 34 ;^TMP("C0STBL",91,"problem",1,"provider@name")="KING,MATTHEW MICHAEL" 35 ;^TMP("C0STBL",91,"problem",1,"removed@value")=0 36 ;^TMP("C0STBL",91,"problem",1,"sc@value")=0 37 ;^TMP("C0STBL",91,"problem",1,"status@value")="A" 38 ;^TMP("C0STBL",91,"problem",1,"unverified@value")=0 39 ;^TMP("C0STBL",91,"problem",1,"updated@value")=3110531 40 ;^TMP("C0STBL",91,"problem",2,"acuity@value")="C" 41 ;^TMP("C0STBL",91,"problem",2,"entered@value")=3110602 42 ;^TMP("C0STBL",91,"problem",2,"facility@code")=100 43 ;^TMP("C0STBL",91,"problem",2,"facility@name")="VOE OFFICE INSTITUTION" 44 ;^TMP("C0STBL",91,"problem",2,"icd@value")=780.2 45 ;^TMP("C0STBL",91,"problem",2,"id@value")=108 46 ;^TMP("C0STBL",91,"problem",2,"name@value")="Syncope and collapse" 47 ;^TMP("C0STBL",91,"problem",2,"onset@value")=3110102 48 ;^TMP("C0STBL",91,"problem",2,"provider@code")=63 49 ;^TMP("C0STBL",91,"problem",2,"provider@name")="KING,MATTHEW MICHAEL" 50 ;^TMP("C0STBL",91,"problem",2,"removed@value")=0 51 ;^TMP("C0STBL",91,"problem",2,"sc@value")=0 52 ;^TMP("C0STBL",91,"problem",2,"status@value")="A" 53 ;^TMP("C0STBL",91,"problem",2,"unverified@value")=0 54 ;^TMP("C0STBL",91,"problem",2,"updated@value")=3110602 55 ;^TMP("C0STBL",91,"problem",3,"acuity@value")="C" 56 ;^TMP("C0STBL",91,"problem",3,"entered@value")=3110602 57 ;^TMP("C0STBL",91,"problem",3,"facility@code")=100 58 ;^TMP("C0STBL",91,"problem",3,"facility@name")="VOE OFFICE INSTITUTION" 59 ;^TMP("C0STBL",91,"problem",3,"icd@value")=433.91 60 ;^TMP("C0STBL",91,"problem",3,"id@value")=109 61 ;^TMP("C0STBL",91,"problem",3,"name@value")="Occlusion and Stenosis of Unspecifid Precerebral Artery with Cerebral Infarctio" 62 ;^TMP("C0STBL",91,"problem",3,"onset@value")=3100101 63 ;^TMP("C0STBL",91,"problem",3,"provider@code")=63 64 ;^TMP("C0STBL",91,"problem",3,"provider@name")="KING,MATTHEW MICHAEL" 65 ;^TMP("C0STBL",91,"problem",3,"removed@value")=0 66 ;^TMP("C0STBL",91,"problem",3,"sc@value")=0 67 ;^TMP("C0STBL",91,"problem",3,"status@value")="A" 68 ;^TMP("C0STBL",91,"problem",3,"unverified@value")=0 69 ;^TMP("C0STBL",91,"problem",3,"updated@value")=3110602 70 ;^TMP("C0STBL",91,"problem",4,"entered@value")=3110603 71 ;^TMP("C0STBL",91,"problem",4,"facility@code")=100 72 ;^TMP("C0STBL",91,"problem",4,"facility@name")="VOE OFFICE INSTITUTION" 73 ;^TMP("C0STBL",91,"problem",4,"icd@value")="00.66" 74 ;^TMP("C0STBL",91,"problem",4,"id@value")=115 75 ;^TMP("C0STBL",91,"problem",4,"location@value")="DR OFFICE" 76 ;^TMP("C0STBL",91,"problem",4,"name@value")="00.66" 77 ;^TMP("C0STBL",91,"problem",4,"provider@code")=63 78 ;^TMP("C0STBL",91,"problem",4,"provider@name")="KING,MATTHEW MICHAEL" 79 ;^TMP("C0STBL",91,"problem",4,"removed@value")=0 80 ;^TMP("C0STBL",91,"problem",4,"status@value")="A" 81 ;^TMP("C0STBL",91,"problem",4,"unverified@value")=0 82 ;^TMP("C0STBL",91,"problem",4,"updated@value")=3110603 83 ;^TMP("C0STBL",91,"problem",5,"entered@value")=3110603 84 ;^TMP("C0STBL",91,"problem",5,"facility@code")=100 85 ;^TMP("C0STBL",91,"problem",5,"facility@name")="VOE OFFICE INSTITUTION" 86 ;^TMP("C0STBL",91,"problem",5,"icd@value")=37.21 87 ;^TMP("C0STBL",91,"problem",5,"id@value")=116 88 ;^TMP("C0STBL",91,"problem",5,"location@value")="DR OFFICE" 89 ;^TMP("C0STBL",91,"problem",5,"name@value")=37.21 90 ;^TMP("C0STBL",91,"problem",5,"provider@code")=63 91 ;^TMP("C0STBL",91,"problem",5,"provider@name")="KING,MATTHEW MICHAEL" 92 ;^TMP("C0STBL",91,"problem",5,"removed@value")=0 93 ;^TMP("C0STBL",91,"problem",5,"status@value")="A" 94 ;^TMP("C0STBL",91,"problem",5,"unverified@value")=0 95 ;^TMP("C0STBL",91,"problem",5,"updated@value")=3110603 96 ;^TMP("C0STBL",91,"problem",6,"entered@value")=3110603 97 ;^TMP("C0STBL",91,"problem",6,"facility@code")=100 98 ;^TMP("C0STBL",91,"problem",6,"facility@name")="VOE OFFICE INSTITUTION" 99 ;^TMP("C0STBL",91,"problem",6,"icd@value")=81.51 100 ;^TMP("C0STBL",91,"problem",6,"id@value")=117 101 ;^TMP("C0STBL",91,"problem",6,"location@value")="DR OFFICE" 102 ;^TMP("C0STBL",91,"problem",6,"name@value")=81.51 103 ;^TMP("C0STBL",91,"problem",6,"provider@code")=63 104 ;^TMP("C0STBL",91,"problem",6,"provider@name")="KING,MATTHEW MICHAEL" 105 ;^TMP("C0STBL",91,"problem",6,"removed@value")=0 106 ;^TMP("C0STBL",91,"problem",6,"status@value")="A" 107 ;^TMP("C0STBL",91,"problem",6,"unverified@value")=0 108 ;^TMP("C0STBL",91,"problem",6,"updated@value")=3110603 109 ;^TMP("C0STBL",91,"problem",7,"entered@value")=3110603 110 ;^TMP("C0STBL",91,"problem",7,"facility@code")=100 111 ;^TMP("C0STBL",91,"problem",7,"facility@name")="VOE OFFICE INSTITUTION" 112 ;^TMP("C0STBL",91,"problem",7,"icd@value")=47.09 113 ;^TMP("C0STBL",91,"problem",7,"id@value")=118 114 ;^TMP("C0STBL",91,"problem",7,"location@value")="DR OFFICE" 115 ;^TMP("C0STBL",91,"problem",7,"name@value")=47.09 116 ;^TMP("C0STBL",91,"problem",7,"provider@code")=63 117 ;^TMP("C0STBL",91,"problem",7,"provider@name")="KING,MATTHEW MICHAEL" 118 ;^TMP("C0STBL",91,"problem",7,"removed@value")=0 119 ;^TMP("C0STBL",91,"problem",7,"status@value")="A" 120 ;^TMP("C0STBL",91,"problem",7,"unverified@value")=0 121 ;^TMP("C0STBL",91,"problem",7,"updated@value")=3110603 122 ;^TMP("C0STBL",91,"problem",8,"entered@value")=3110603 123 ;^TMP("C0STBL",91,"problem",8,"facility@code")=100 124 ;^TMP("C0STBL",91,"problem",8,"facility@name")="VOE OFFICE INSTITUTION" 125 ;^TMP("C0STBL",91,"problem",8,"icd@value")="250.00" 126 ;^TMP("C0STBL",91,"problem",8,"id@value")=119 127 ;^TMP("C0STBL",91,"problem",8,"location@value")="DR OFFICE" 128 ;^TMP("C0STBL",91,"problem",8,"name@value")="Diabetes Mellitus without mentionof Complication, type II or unspecified type," 129 ;^TMP("C0STBL",91,"problem",8,"provider@code")=63 130 ;^TMP("C0STBL",91,"problem",8,"provider@name")="KING,MATTHEW MICHAEL" 131 ;^TMP("C0STBL",91,"problem",8,"removed@value")=0 132 ;^TMP("C0STBL",91,"problem",8,"status@value")="A" 133 ;^TMP("C0STBL",91,"problem",8,"unverified@value")=0 134 ;^TMP("C0STBL",91,"problem",8,"updated@value")=3110603 135 ; 136 ; sample Smart lab result triples 137 ; 138 ;G("node16rk1fgdvx10882","code")="snomed:40930008" 139 ;G("node16rk1fgdvx10882","dcterms:title")="Hypothyroidism" 140 ;G("node16rk1fgdvx10882","rdf:type")="sp:CodedValue" 141 ;G("node16rk1fgdvx11051","code")="snomed:188155002" 142 ;G("node16rk1fgdvx11051","dcterms:title")="Primary malignant neoplasm of lower outer quadrant of female breast" 143 ;G("node16rk1fgdvx11051","rdf:type")="sp:CodedValue" 144 ;G("node16rk1fgdvx11073","code")="snomed:353295004" 145 ;G("node16rk1fgdvx11073","dcterms:title")="Toxic diffuse goiter" 146 ;G("node16rk1fgdvx11073","rdf:type")="sp:CodedValue" 147 ;G("node16rk1fgdvx11089","code")="snomed:54302000" 148 ;G("node16rk1fgdvx11089","dcterms:title")="Disorder of breast" 149 ;G("node16rk1fgdvx11089","rdf:type")="sp:CodedValue" 150 ;G("node16rk1fgdvx11351","code")="snomed:38341003" 151 ;G("node16rk1fgdvx11351","dcterms:title")="Essential hypertension" 152 ;G("node16rk1fgdvx11351","rdf:type")="sp:CodedValue" 153 ;G("node16rk1fgdvx11390","code")="snomed:44054006" 154 ;G("node16rk1fgdvx11390","dcterms:title")="Diabetes mellitus type 2" 155 ;G("node16rk1fgdvx11390","rdf:type")="sp:CodedValue" 156 ;G("node16rk1fgdvx11558","code")="snomed:195967001" 157 ;G("node16rk1fgdvx11558","dcterms:title")="Asthma" 158 ;G("node16rk1fgdvx11558","rdf:type")="sp:CodedValue" 159 ;G("node16rk1fgdvx11578","code")="snomed:254837009" 160 ;G("node16rk1fgdvx11578","dcterms:title")="Primary malignant neoplasm of female breast" 161 ;G("node16rk1fgdvx11578","rdf:type")="sp:CodedValue" 162 ;G("node16rk1fgdvx11687","code")="snomed:8517006" 163 ;G("node16rk1fgdvx11687","dcterms:title")="History of tobacco use" 164 ;G("node16rk1fgdvx11687","rdf:type")="sp:CodedValue" 165 ;G("node16rk1fgdvx11716","code")="snomed:55822004" 166 ;G("node16rk1fgdvx11716","dcterms:title")="Hyperlipidemia" 167 ;G("node16rk1fgdvx11716","rdf:type")="sp:CodedValue" 168 ;G("smart:1577780/problems/69560e4721e1","belongsTo")="smart:1577780" 169 ;G("smart:1577780/problems/69560e4721e1","problemName")="node16rk1fgdvx11089" 170 ;G("smart:1577780/problems/69560e4721e1","rdf:type")="sp:Problem" 171 ;G("smart:1577780/problems/69560e4721e1","startDate")="2005-08-02" 172 ;G("smart:1577780/problems/06ef10c4e92c","belongsTo")="smart:1577780" 173 ;G("smart:1577780/problems/06ef10c4e92c","problemName")="node16rk1fgdvx11051" 174 ;G("smart:1577780/problems/06ef10c4e92c","rdf:type")="sp:Problem" 175 ;G("smart:1577780/problems/06ef10c4e92c","startDate")="2006-02-20" 176 ;G("smart:1577780/problems/9894ba9dfe5a","belongsTo")="smart:1577780" 177 ;G("smart:1577780/problems/9894ba9dfe5a","problemName")="node16rk1fgdvx11578" 178 ;G("smart:1577780/problems/9894ba9dfe5a","rdf:type")="sp:Problem" 179 ;G("smart:1577780/problems/9894ba9dfe5a","startDate")="2005-08-22" 180 ;G("smart:1577780/problems/c109aa7a0675","belongsTo")="smart:1577780" 181 ;G("smart:1577780/problems/c109aa7a0675","problemName")="node16rk1fgdvx11558" 182 ;G("smart:1577780/problems/c109aa7a0675","rdf:type")="sp:Problem" 183 ;G("smart:1577780/problems/c109aa7a0675","startDate")="2005-09-22" 184 ;G("smart:1577780/problems/1c50100614a2","belongsTo")="smart:1577780" 185 ;G("smart:1577780/problems/1c50100614a2","problemName")="node16rk1fgdvx11073" 186 ;G("smart:1577780/problems/1c50100614a2","rdf:type")="sp:Problem" 187 ;G("smart:1577780/problems/1c50100614a2","startDate")="2007-02-21" 188 ;G("smart:1577780/problems/083dffb2c4a0","belongsTo")="smart:1577780" 189 ;G("smart:1577780/problems/083dffb2c4a0","problemName")="node16rk1fgdvx11390" 190 ;G("smart:1577780/problems/083dffb2c4a0","rdf:type")="sp:Problem" 191 ;G("smart:1577780/problems/083dffb2c4a0","startDate")="2007-01-07" 192 ;G("smart:1577780/problems/762b5639a2d1","belongsTo")="smart:1577780" 193 ;G("smart:1577780/problems/762b5639a2d1","problemName")="node16rk1fgdvx11687" 194 ;G("smart:1577780/problems/762b5639a2d1","rdf:type")="sp:Problem" 195 ;G("smart:1577780/problems/762b5639a2d1","startDate")="2006-02-20" 196 ;G("smart:1577780/problems/9dc9053dd6f4","belongsTo")="smart:1577780" 197 ;G("smart:1577780/problems/9dc9053dd6f4","problemName")="node16rk1fgdvx11716" 198 ;G("smart:1577780/problems/9dc9053dd6f4","rdf:type")="sp:Problem" 199 ;G("smart:1577780/problems/9dc9053dd6f4","startDate")="2008-04-08" 200 ;G("smart:1577780/problems/e3fe9b7ee552","belongsTo")="smart:1577780" 201 ;G("smart:1577780/problems/e3fe9b7ee552","problemName")="node16rk1fgdvx10882" 202 ;G("smart:1577780/problems/e3fe9b7ee552","rdf:type")="sp:Problem" 203 ;G("smart:1577780/problems/e3fe9b7ee552","startDate")="2005-10-27" 204 ;G("smart:1577780/problems/9933307e8f95","belongsTo")="smart:1577780" 205 ;G("smart:1577780/problems/9933307e8f95","problemName")="node16rk1fgdvx11351" 206 ;G("smart:1577780/problems/9933307e8f95","rdf:type")="sp:Problem" 207 ;G("smart:1577780/problems/9933307e8f95","startDate")="2005-08-22" 208 ;G("snomed:188155002","dcterms:identifier")=188155002 209 ;G("snomed:188155002","dcterms:title")="Primary malignant neoplasm of lower outer quadrant of female breast" 210 ;G("snomed:188155002","rdf:type")="sp:Code" 211 ;G("snomed:188155002","system")="http://purl.bioontology.org/ontology/SNOMEDCT" 212 ;G("snomed:195967001","dcterms:identifier")=195967001 213 ;G("snomed:195967001","dcterms:title")="Asthma" 214 ;G("snomed:195967001","rdf:type")="sp:Code" 215 ;G("snomed:195967001","system")="http://purl.bioontology.org/ontology/SNOMEDCT" 216 ;G("snomed:254837009","dcterms:identifier")=254837009 217 ;G("snomed:254837009","dcterms:title")="Primary malignant neoplasm of female breast" 218 ;G("snomed:254837009","rdf:type")="sp:Code" 219 ;G("snomed:254837009","system")="http://purl.bioontology.org/ontology/SNOMEDCT" 220 ;G("snomed:353295004","dcterms:identifier")=353295004 221 ;G("snomed:353295004","dcterms:title")="Toxic diffuse goiter" 222 ;G("snomed:353295004","rdf:type")="sp:Code" 223 ;G("snomed:353295004","system")="http://purl.bioontology.org/ontology/SNOMEDCT" 224 ;G("snomed:38341003","dcterms:identifier")=38341003 225 ;G("snomed:38341003","dcterms:title")="Essential hypertension" 226 ;G("snomed:38341003","rdf:type")="sp:Code" 227 ;G("snomed:38341003","system")="http://purl.bioontology.org/ontology/SNOMEDCT" 228 ;G("snomed:40930008","dcterms:identifier")=40930008 229 ;G("snomed:40930008","dcterms:title")="Hypothyroidism" 230 ;G("snomed:40930008","rdf:type")="sp:Code" 231 ;G("snomed:40930008","system")="http://purl.bioontology.org/ontology/SNOMEDCT" 232 ;G("snomed:44054006","dcterms:identifier")=44054006 233 ;G("snomed:44054006","dcterms:title")="Diabetes mellitus type 2" 234 ;G("snomed:44054006","rdf:type")="sp:Code" 235 ;G("snomed:44054006","system")="http://purl.bioontology.org/ontology/SNOMEDCT" 236 ;G("snomed:54302000","dcterms:identifier")=54302000 237 ;G("snomed:54302000","dcterms:title")="Disorder of breast" 238 ;G("snomed:54302000","rdf:type")="sp:Code" 239 ;G("snomed:54302000","system")="http://purl.bioontology.org/ontology/SNOMEDCT" 240 ;G("snomed:55822004","dcterms:identifier")=55822004 241 ;G("snomed:55822004","dcterms:title")="Hyperlipidemia" 242 ;G("snomed:55822004","rdf:type")="sp:Code" 243 ;G("snomed:55822004","system")="http://purl.bioontology.org/ontology/SNOMEDCT" 244 ;G("snomed:8517006","dcterms:identifier")=8517006 245 ;G("snomed:8517006","dcterms:title")="History of tobacco use" 246 ;G("snomed:8517006","rdf:type")="sp:Code" 247 ;G("snomed:8517006","system")="http://purl.bioontology.org/ontology/SNOMEDCT/" 248 249 ; 250 PROB(GRTN,C0SARY) ; GRTN, passed by reference, 251 ; is the return name of the graph created. "" if none 252 ; C0SARY is passed in by reference and is the NHIN array of problems 253 ; 254 I $O(C0SARY("problem",""))="" D Q ; 255 . I $D(DEBUG) W !,"No Problems" 256 S GRTN="" ; default to no problems 257 N C0SGRF 258 S C0SGRF="vistaSmart:"_ZPATID_"/problems" 259 I $D(DEBUG) W !,"Processing ",C0SGRF 260 D DELGRAPH^C0XF2N(C0SGRF) ; delete the old graph 261 D INITFARY^C0XF2N("C0XFARY") ; which triple store to use 262 N FARY S FARY="C0XFARY" 263 D USEFARY^C0XF2N(FARY) 264 D VOCINIT^C0XUTIL 265 ; 266 D STARTADD^C0XF2N ; initialize to create triples 267 ; 268 N ZI S ZI="" 269 F S ZI=$O(C0SARY("problem",ZI)) Q:ZI="" D ; 270 . N LRN,ZR ; ZR is the local array for building the new triples 271 . S LRN=$NA(C0SARY("problem",ZI)) ; base for values in this lab result 272 . ; 273 . N PROBID ; unique Id for this problem 274 . S PROBID=C0SGRF_"/"_$$LKY17^C0XF2N ; use a random number 275 . ; 276 . ; i don't like this because the same problems gets a 277 . ; different ID every time it's reported. Can't trace it back to VistA 278 . ; I'd rather be using id@value ie "id@value")="118" 279 . ; 280 . N SNOMED,ICD S ICD=$G(@LRN@("icd@value")) 281 . S SNOMED=$$SNOMED(ICD) ; look up the snomed code in the map 282 . N SNOGRF ; graph for SNOMED code 283 . I SNOMED="" D ; 284 . . S SNOMED=ICD ; if not found, return the ICD code 285 . . S SNOGRF="icd9:"_SNOMED 286 . E S SNOGRF="snomed:"_SNOMED 287 . N SNOTIT S SNOTIT=$G(@LRN@("name@value")) 288 . I $D(DEBUG) D ; 289 . . W !,"Processing Problem List ",PROBID 290 . . W !,"problem: ",SNOTIT 291 . . W !,"code: ",SNOMED 292 . ; 293 . ; first do the base result graph 294 . ; 295 . S ZR("rdf:type")="sp:Problem" 296 . S ZR("sp:belongsTo")=C0SGRF ; the subject for this patient's problems 297 . ; ie /vista/smart/99912345/problems 298 . ; 299 . N PROBNAME S PROBNAME=$$ANONS^C0XF2N ; new node for problem name 300 . S ZR("sp:problemName")=PROBNAME 301 . ; 302 . N STARTDT S STARTDT=$$SPDATE^C0SUTIL($G(@LRN@("entered@value"))) 303 . S ZR("sp:startDate")=STARTDT 304 . ; 305 . D ADDINN^C0XF2N(C0SGRF,PROBID,.ZR) ; addIfNotNull the triples 306 . K ZR ; clean up 307 . ; 308 . ; create the problemName graph 309 . ; 310 . S ZR("rdf:type")="sp:CodedValue" 311 . ;S ZR("sp:code")="snomed:"_SNOMED 312 . S ZR("sp:code")=SNOGRF 313 . S ZR("dcterms:title")=$G(@LRN@("name@value")) 314 . D ADDINN^C0XF2N(C0SGRF,PROBNAME,.ZR) 315 . K ZR 316 . ; 317 . ; create snomed graph 318 . ; 319 . S ZR("rdf:type")="sp:Code" 320 . S ZR("sp:system")="http://purl.bioontology.org/ontology/SNOMEDCT" 321 . I SNOGRF["icd9" S ZR("sp:system")="http://purl.bioontology.org/ontology/ICD9" 322 . S ZR("dcterms:identifier")=SNOMED 323 . S ZR("dcterms:title")=SNOTIT 324 . D ADDINN^C0XF2N(C0SGRF,SNOGRF,.ZR) 325 . K ZR 326 . ; 327 D BULKLOAD^C0XF2N(.C0XFDA) 328 S GRTN=C0SGRF 329 Q 330 ; 331 SNOMED(ZICD) ; extrinsic which returns SNOMED code given an ICD9 code 332 ; requires the mapping table installed in the triplestore 333 ; 334 N ZSN,ZARY,ZSUB,ZSUBS 335 I $E(ZICD,$L(ZICD))="." S ZICD=$P(ZICD,".",1) ; handle trailing dots 336 D subjects^C0XGET1(.ZSUBS,"cg:ontology#code",ZICD) ; subjects with the ICD9 code 337 S ZSUB=$O(ZSUBS("")) ; pick the first one 338 I ZSUB="" Q "" 339 D objects^C0XGET1(.ZARY,ZSUB,"cg:ontology#toCode") 340 S ZSN=$O(ZARY("")) 341 I $D(DEBUG) W !,ZSN," ",$$object^C0XGET1(ZSUB,"rdfs:label") 342 Q ZSN 343 ;
Note:
See TracChangeset
for help on using the changeset viewer.