Change default SQL server host
[umlisp.git] / parse-rrf.lisp
index 59f48269aa4bc3bc7520cf0a804f9d89e849559c..5e28ed5ca8a9f82f6cb9c89233e6e677b4fdf5cd 100644 (file)
 
 (declaim (inline srl-to-srlus))
 (defun srl-to-srlus (srl)
-  "Convert the standard SRL category to one oriented for use in the United States.
-Specifically, SRL 4 in the USA has license restrictions between SRL 1 and 2 when
-used in the United States. We create a new scale (SRLUS) where SRL to SRLUS mapping is:
-(0->0, 1->1, 4->2, 2->3, 3->4)."
+  "Convert the standard SRL category to one oriented for use in the ~
+United States. Specifically, SRL 4 in the USA has license restrictions ~
+between SRL 1 and 2 when used in the United States. As of 2009AA, the
+SNOMED SRL changed from 4 to 9. So we create a new scale ~
+(SRLUS) where SRL to SRLUS mapping is: ~
+(0->0, 1->1, 4->2, 9->2, 2->3, 3->4)."
   (declare (type (integer 0 100) srl))
   (cond
     ((<= srl 1) srl)
     ((= srl 4) 2)
+    ((= srl 9) 2)
     ((= srl 2) 3)
     ((= srl 3) 4)
     (t srl)))
@@ -222,7 +225,7 @@ used in the United States. We create a new scale (SRLUS) where SRL to SRLUS mapp
                                                  (parse-ui (vff "MRCONSO.RRF" "SUI" x))))))
       ("MRCONSO.RRF" "KCUILUI" "BIGINT" 0
        (lambda (x) (write-to-string (make-cuilui (parse-ui (vff "MRCONSO.RRF" "CUI" x))
-                                                 (parse-ui (vff "MRCONSO.RRF" "SUI" x))))))
+                                                 (parse-ui (vff "MRCONSO.RRF" "LUI" x))))))
       ("MRCONSO.RRF" "KCUILRL" "TINYINT" 0
        (lambda (x) (write-to-string (cui-lrl (parse-ui (vff "MRCONSO.RRF" "CUI" x))))))
       ("MRCONSO.RRF" "KCUILRLUS" "TINYINT" 0
@@ -243,11 +246,11 @@ used in the United States. We create a new scale (SRLUS) where SRL to SRLUS mapp
        (lambda (x) (write-to-string (cui-lrl (parse-ui (vff "MRSTY.RRF" "CUI" x))))))
       ("MRSTY.RRF" "KLRLUS" "TINYINT" 0
        (lambda (x) (write-to-string (cui-lrlus (parse-ui (vff "MRSTY.RRF" "CUI" x))))))
-      ("MRCOC.RRF" "KLRL" "TINYINT" 0
+      #+mrcoc ("MRCOC.RRF" "KLRL" "TINYINT" 0
        (lambda (x) (write-to-string
                     (max (cui-lrl (parse-ui (vff "MRCOC.RRF" "CUI1" x)))
                          (kmrcl:aif (cui-lrl (parse-ui (vff "MRCOC.RRF" "CUI2" x))) kmrcl::it 0)))))
-      ("MRCOC.RRF" "KLRLUS" "TINYINT" 0
+      #+mrcoc ("MRCOC.RRF" "KLRLUS" "TINYINT" 0
        (lambda (x) (write-to-string
                     (max (cui-lrlus (parse-ui (vff "MRCOC.RRF" "CUI1" x)))
                          (kmrcl:aif (cui-lrl (parse-ui (vff "MRCOC.RRF" "CUI2" x))) kmrcl::it 0)))))
@@ -313,7 +316,7 @@ used in the United States. We create a new scale (SRLUS) where SRL to SRLUS mapp
                                                  (parse-ui (vff "MRXNS_ENG.RRF" "SUI" x)))))))
 
       #+nil  ("MRREL.RRF" "KPFSTR2" "TEXT" 1024 (lambda (x) (pfstr-hash (parse-ui (vff "MRREL.RRF" "CUI2" x)))))
-      #+nil  ("MRCOC.RRF" "KPFSTR2" "TEXT" 1024 (lambda (x) (pfstr-hash (parse-ui (vff "MRCOC.RRF" "CUI2" x)))))
+      #+mrcoc  ("MRCOC.RRF" "KPFSTR2" "TEXT" 1024 (lambda (x) (pfstr-hash (parse-ui (vff "MRCOC.RRF" "CUI2" x)))))
 
       ("MRSAT.RRF" "KCUILUI" "BIGINT" 0
        (lambda (x) (write-to-string (make-cuilui
@@ -347,19 +350,20 @@ used in the United States. We create a new scale (SRLUS) where SRL to SRLUS mapp
     "Custom columns to create.(filename, col, sqltype, value-func).")
 
 (defparameter +index-cols+
-    '(("CUI1" "MRCOC") ("CUI" "MRCONSO") ("LUI" "MRCONSO")
-      ("SRL" "MRCONSO") ("KSRLUS" "MRCONSO") ("AUI" "MRCONSO") ("KPFENG" "MRCONSO")
-      ("SUI" "MRCONSO") ("SAUI" "MRCONSO") ("CODE" "MRCONSO")
-      ("SCUI" "MRCONSO")
-      ("CUI" "MRDEF")
-      ("CUI1" "MRREL") ("CUI2" "MRREL") ("SAB" "MRREL")
+  '( #+mrcoc ("CUI1" "MRCOC") #+mrcoc ("KLRL" "MRCOC") #+mrcoc ("KLRLUS" "MRCOC")
+    ("CUI" "MRCONSO") ("LUI" "MRCONSO")
+    ("SRL" "MRCONSO") ("KSRLUS" "MRCONSO") ("AUI" "MRCONSO") ("KPFENG" "MRCONSO")
+    ("SUI" "MRCONSO") ("SAUI" "MRCONSO") ("CODE" "MRCONSO")
+    ("SCUI" "MRCONSO")
+    ("CUI" "MRDEF")
+    ("CUI1" "MRREL") ("CUI2" "MRREL") ("SAB" "MRREL")
       ("RUI" "MRREL") ("AUI1" "MRREL") ("AUI2" "MRREL")
       ("CUI" "MRSAT") ("LUI" "MRSAT") ("SUI" "MRSAT")
       ("METAUI" "MRSAT") ("ATN" "MRSAT")
       ("CUI" "MRSTY")  ("TUI" "MRSTY") ("CUI" "MRXNS_ENG")
-      ("AUI" "MRHIER") ("CUI" "MRHIER") ("CXN" "MRHIER") ("RELA" "MRHIER") ("PAUI" "MRHIER")
-      ("SAB" "MRHIER")
-      #+ignore ("NSTR" "MRXNS_ENG" 10)
+      ("AUI" "MRHIER") ("CUI" "MRHIER") ("CXN" "MRHIER") ("RELA" "MRHIER")
+      ("PAUI" "MRHIER") ("SAB" "MRHIER")
+      ("NSTR" "MRXNS_ENG" 255)
       ("CUI" "MRXNW_ENG") ("NWD" "MRXNW_ENG") ("WD" "MRXW_ENG")
       ("KCUISUI" "MRCONSO") ("KCUILUI" "MRCONSO")
       ("KCUILRL" "MRCONSO") ("KLUILRL" "MRCONSO") ("KSUILRL" "MRCONSO")
@@ -369,8 +373,8 @@ used in the United States. We create a new scale (SRLUS) where SRL to SRLUS mapp
       ("KCUISUI" "MRXNS_ENG") ("KCUISUI" "MRXW_NONENG")
       ("KSRL" "MRDEF") ("KSRL" "MRRANK")("KSRL" "MRREL") ("KSRL" "MRSAT")
       ("KSRLUS" "MRDEF") ("KSRLUS" "MRRANK")("KSRLUS" "MRREL") ("KSRLUS" "MRSAT")
-      ("KLRL" "MRCOC") ("KLRL" "MRSTY") ("KLRL" "MRXW_ENG") ("KLRL" "MRXNW_ENG")
-      ("KLRLUS" "MRCOC") ("KLRLUS" "MRSTY") ("KLRLUS" "MRXW_ENG") ("KLRLUS" "MRXNW_ENG")
+      ("KLRL" "MRSTY") ("KLRL" "MRXW_ENG") ("KLRL" "MRXNW_ENG")
+      ("KLRLUS" "MRSTY") ("KLRLUS" "MRXW_ENG") ("KLRLUS" "MRXNW_ENG")
       ("KLRL" "MRXNS_ENG") ("KLRL" "MRXW_NONENG")
       ("KLRLUS" "MRXNS_ENG") ("KLRLUS" "MRXW_NONENG")
       ;; LEX indices
@@ -384,8 +388,7 @@ used in the United States. We create a new scale (SRLUS) where SRL to SRLUS mapp
       ("RL" "SRSTR")
 
       ("SRL" "MRSAB") ("KSRLUS" "MRSAB") ("RSAB" "MRSAB") ("VSAB" "MRSAB") ("RCUI" "MRSAB")
-      ("VCUI" "MRSAB") ("LAT" "MRSAB") ("MAPSETCUI" "MRMAP")  ("MAPSETCUI" "MRSMAP")
-      ("CUI" "MRHIER"))
+      ("VCUI" "MRSAB") ("LAT" "MRSAB") ("MAPSETCUI" "MRMAP")  ("MAPSETCUI" "MRSMAP"))
   "Columns in files to index")
 
 
@@ -459,6 +462,3 @@ used in the United States. We create a new scale (SRLUS) where SRL to SRLUS mapp
 (defun gen-ufiles-custom ()
   (make-ufile "META" "MRXW_NONENG.RRF" "Custom NonEnglish Index"
               5 0 0 (fields (find-ufile "MRXW_ENG.RRF"))))
-
-
-