r11103: 2006 umls updates
[umlisp.git] / parse-rrf.lisp
index 4c617a02655c539da1e370a52de14c7faec1dcdc..c34f3eec79ef9e54b7b04fb04a73df852f32a6a7 100644 (file)
   "Custom tables to create")
 
 (defparameter +custom-cols+
-    '(("MRCONSO.RRF" "KPFSTR" "TEXT"
-                    (slot-value (find-ucol "STR" "MRCONSO.RRF") 'max)
-                    (lambda (x) (pfstr-hash (parse-ui (nth 0 x)))))
+    '(#+nil ("MRCONSO.RRF" "KPFSTR" "TEXT"
+             (slot-value (find-ucol "STR" "MRCONSO.RRF") 'max)
+             (lambda (x) (pfstr-hash (parse-ui (nth 0 x)))))
+      ;; Set to 1 if term is prefered term for english
+      ("MRCONSO.RRF" "KPFENG" "TINYINT" 0
+       (lambda (x)  (if (and (string-equal (nth 1 x) "ENG") ; LAT
+                             (string-equal (nth 2 x) "P") ; ts
+                             (string-equal (nth 4 x) "PF")) ; stt
+                      "1"
+                      "0")))
       ("MRCONSO.RRF" "KCUISUI" "BIGINT" 0
        (lambda (x) (write-to-string (make-cuisui (parse-ui (nth 0 x)) (parse-ui (nth 5 x))))))
       ("MRCONSO.RRF" "KCUILUI" "BIGINT" 0
        (lambda (x) (write-to-string (lui-lrl (parse-ui (nth 3 x))))))
       ("MRCONSO.RRF" "KSUILRL" "SMALLINT" 0
        (lambda (x) (write-to-string (sui-lrl (parse-ui (nth 5 x))))))
-      ;; Deprecated, last in 2004AA -- skip index
-      #+ignore
-      ("MRLO.RRF" "KLRL" "SMALLINT" 0
-       (lambda (x) (write-to-string
-                   (if (zerop (length (nth 4 x)))
-                       (cui-lrl (parse-ui (nth 0 x)))
-                     (cuisui-lrl (make-cuisui (parse-ui (nth 0 x)) (parse-ui (nth 4 x))))))))
       ("MRSTY.RRF" "KLRL" "SMALLINT" 0
        (lambda (x) (write-to-string (cui-lrl (parse-ui (nth 0 x))))))
       ("MRCOC.RRF" "KLRL" "SMALLINT" 0
        (lambda (x) (write-to-string (sab-srl (nth 1 x)))))
       ("MRDEF.RRF" "KSRL" "SMALLINT" 0
        (lambda (x) (write-to-string (sab-srl (nth 4 x)))))
-      ("MRCXT.RRF" "KSRL" "SMALLINT" 0
-       (lambda (x) (write-to-string (sab-srl (nth 2 x)))))
+      #+nil  ("MRCXT.RRF" "KSRL" "SMALLINT" 0 (lambda (x) (write-to-string (sab-srl (nth 2 x)))))
       ("MRXW_ENG.RRF" "KLRL" "SMALLINT" 0
        (lambda (x) (write-to-string (cuisui-lrl (make-cuisui
                                                 (parse-ui (nth 2 x))
        (lambda (x) (write-to-string (cuisui-lrl (make-cuisui
                                                 (parse-ui (nth 2 x))
                                                 (parse-ui (nth 4 x)))))))
-      ("MRREL.RRF" "KPFSTR2" "TEXT" 1024
-       (lambda (x) (pfstr-hash (parse-ui (nth 4 x)))))
-      ("MRCOC.RRF" "KPFSTR2" "TEXT" 1024
-       (lambda (x) (pfstr-hash (parse-ui (nth 2 x)))))
-      ("MRCXT.RRF" "KCUISUI" "BIGINT" 0
-       (lambda (x) (write-to-string (make-cuisui (parse-ui (nth 0 x)) (parse-ui (nth 1 x))))))
+
+      ;; FIXME: For MRREF and MRCOC, add lookups to KPFSTR2 using new MRCONSO index KPFENG
+
+      #+nil  ("MRREL.RRF" "KPFSTR2" "TEXT" 1024 (lambda (x) (pfstr-hash (parse-ui (nth 4 x)))))
+      #+nil  ("MRCOC.RRF" "KPFSTR2" "TEXT" 1024 (lambda (x) (pfstr-hash (parse-ui (nth 2 x)))))
+      #+use-mrctx  ("MRCXT.RRF" "KCUISUI" "BIGINT" 0 (lambda (x) (write-to-string (make-cuisui (parse-ui (nth 0 x)) (parse-ui (nth 1 x))))))
       ("MRSAT.RRF" "KCUILUI" "BIGINT" 0
        (lambda (x) (write-to-string (make-cuilui (parse-ui (nth 0 x)) (parse-ui (nth 1 x))))))
       ("MRSAT.RRF" "KCUISUI" "BIGINT" 0
 
 (defparameter +index-cols+
     '(("CUI1" "MRCOC") ("CUI" "MRCONSO") ("LUI" "MRCONSO")
-      ("SRL" "MRCONSO") ("AUI" "MRCONSO")
-      ("SUI" "MRCONSO") ("CUI" "MRCXT") ("CUI" "MRDEF") ("CUI" "MRLO")
+      ("SRL" "MRCONSO") ("AUI" "MRCONSO") ("KPFENG" "MRCONSO")
+      ("SUI" "MRCONSO") ("CUI" "MRDEF")
       ("CUI1" "MRREL") ("CUI" "MRSAT") ("LUI" "MRSAT") ("SUI" "MRSAT")
       ("CUI" "MRSTY")
       ("TUI" "MRSTY") ("CUI" "MRXNS_ENG")
+      ;; ("CUI" "MRCXT") ("KCUISUI" "MRCXT") ("KSRL" "MRCXT")
+      ("AUI" "MRHIER") ("PTR" "MRHIER") ("CUI" "MRHIER") ("CXN" "MRHIER") ("RELA" "MRHIER") ("PAUI" "MRHIER")
+      ("SAB" "MRHIER")
       #+ignore ("NSTR" "MRXNS_ENG" 10)
       ("CUI" "MRXNW_ENG") ("NWD" "MRXNW_ENG") ("WD" "MRXW_ENG")
       ("KCUISUI" "MRCONSO") ("KCUILUI" "MRCONSO") ("KCUILRL" "MRCONSO")
-      ("KLUILRL" "MRCONSO") ("KCUISUI" "MRCXT")
+      ("KLUILRL" "MRCONSO")
       ("KCUISUI" "MRSAT")  ("KCUILUI" "MRSAT")
       ("KCUISUI" "MRXW_ENG") ("KCUISUI" "MRXNW_ENG")
       ("KCUISUI" "MRXNS_ENG") ("KCUISUI" "MRXW_NONENG")
-      ("KSRL" "MRCXT") ("KSRL" "MRDEF") ("KSRL" "MRRANK")
+      ("KSRL" "MRDEF") ("KSRL" "MRRANK")
       ("KSRL" "MRREL") ("KSRL" "MRSAT") ("KLRL" "MRCOC")
-      #+ignore ("KLRL" "MRLO")  ;; deprecated
       ("KLRL" "MRSTY") ("KLRL" "MRXW_ENG") ("KLRL" "MRXNW_ENG")
       ("KLRL" "MRXNS_ENG") ("KLRL" "MRXW_NONENG")
       ;; LEX indices
 
       ("SRL" "MRSAB") ("RSAB" "MRSAB") ("VSAB" "MRSAB") ("RCUI" "MRSAB")
       ("VCUI" "MRSAB") ("LAT" "MRSAB") ("MAPSETCUI" "MRMAP")  ("MAPSETCUI" "MRSMAP")
-      ("CUI" "MRHIER") ("AUI" "MRHIER") ("PAUI" "MRHIER"))
+      ("CUI" "MRHIER"))
   "Columns in files to index")