Changeset 312 for ccr


Ignore:
Timestamp:
Jan 4, 2009, 5:55:58 PM (16 years ago)
Author:
Sam Habiel
Message:

Updated all meds files to use RxNorm codes instead of NDCs.

Location:
ccr/trunk/p
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ccr/trunk/p/C0CRXNRD.m

    r311 r312  
    6868 D CLOSE^%ZISH("FILE")
    6969 U $P ; reset back to principle device
     70 Q
     71 ;
     72READSRC(PATH) ; Open the read RxNorm Sources file: RXNSAB.RRF
     73 I PATH="" QUIT
     74 N FILENAME S FILENAME="RXNSAB.RRF"
     75 D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
     76 IF POP W "Error reading file..., Please check...",! BREAK
     77 F I=1:1 Q:$$STATUS^%ZISH  D
     78 . U IO
     79 . N LINE R LINE
     80 . IF $$STATUS^%ZISH QUIT
     81 . U $P W I,! U IO  ; Write I to the screen, then go back to reading the file
     82 . N VCUI,RCUI,VSAB,RSAB,SON,SF,SVER,SCIT ; Fileman fields numbers below
     83 . S VCUI=$P(LINE,"|",1)        ; .01
     84 . S RCUI=$P(LINE,"|",2)        ; 2
     85 . S VSAB=$P(LINE,"|",3)        ; 3
     86 . S RSAB=$P(LINE,"|",4)        ; 4
     87 . S SON=$P(LINE,"|",5)         ; 5
     88 . S SF=$P(LINE,"|",6)          ; 6
     89 . S SVER=$P(LINE,"|",7)        ; 7
     90 . S SCIT=$P(LINE,"|",25)       ; 25
     91 . ; Remove embedded "^"
     92 . S SCIT=$TR(SCIT,"^")
     93 . ; Convert SCIT into an array of 80 characters on each line
     94 . ; In each line, chop 80 characters off, reset SCIT to be the rest
     95 . N SCITLINE S SCITLINE=$L(SCIT)\80+1
     96 . F J=1:1:SCITLINE S SCIT(J)=$E(SCIT,1,80) S SCIT=$E(SCIT,81,$L(SCIT))
     97 . ; Now, construct the FDA array
     98 . N RXNFDA
     99 . S RXNFDA(176.003,"+"_I_",",.01)=VCUI
     100 . S RXNFDA(176.003,"+"_I_",",2)=RCUI
     101 . S RXNFDA(176.003,"+"_I_",",3)=VSAB
     102 . S RXNFDA(176.003,"+"_I_",",4)=RSAB
     103 . S RXNFDA(176.003,"+"_I_",",5)=SON
     104 . S RXNFDA(176.003,"+"_I_",",6)=SF
     105 . S RXNFDA(176.003,"+"_I_",",7)=SVER
     106 . D UPDATE^DIE("","RXNFDA")
     107 . I $D(^TMP("DIERR",$J)) U $P BREAK
     108 . ; Now, file WP field SCIT
     109 . D WP^DIE(176.003,I_",",25,,$NA(SCIT))
     110 D CLOSE^%ZISH("FILE")
     111 Q
    70112
    71 
  • ccr/trunk/p/CCRMEDS1.m

    r204 r312  
    6969 . S @MAP@("MEDSOURCEACTORID")="ACTORPROVIDER_"_$P(MED(4),U)
    7070 . S @MAP@("MEDPRODUCTNAMETEXT")=$P(MED(6),U,2)
    71  . S @MAP@("MEDPRODUCTNAMECODEVALUE")=MED(27)
    72  . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")="NDC"
    73  . S @MAP@("MEDPRODUCTNAMECODEVERSION")="none"
     71 . ; 12/30/08: I will be using RxNorm for coding...
     72 . ; 176.001 is the file for Concepts; 176.003 is the file for
     73 . ; sources (i.e. for RxNorm Version)
     74 . ;
     75 . ; We need the VUID first for the National Drug File entry first
     76 . ; We get the VUID of the drug, by looking up the VA Product entry
     77 . ; (file 50.68) using the call NDF^PSS50, returned in node 22.
     78 . ; Field 99.99 is the VUID.
     79 . ;
     80 . ; We use the VUID to look up the RxNorm in file 176.001; same idea.
     81 . ; Get IEN first using $$FIND1^DIC, then get the RxNorm number by
     82 . ; $$GET1^DIQ.
     83 . ;
     84 . ; I get the RxNorm name and version from the RxNorm Sources (file
     85 . ; 176.003), by searching for "RXNORM", then get the data.
     86 . N MEDIEN S MEDIEN=$P(MED(6),U)
     87 . D NDF^PSS50(MEDIEN,,,,,"NDF")
     88 . N NDFDATA M NDFDATA=^TMP($J,"NDF",MEDIEN)
     89 . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
     90 . N VAPROD S VAPROD=$P(NDFDATA(22),U)
     91 . ;
     92 . ; NDFIEN is not necessarily defined; it won't be if the drug
     93 . ; is not matched to the national drug file (e.g. if the drug is
     94 . ; new on the market, compounded, or is a fake drug [blue pill].
     95 . ; To protect against failure, I will put an if/else block
     96 . ;
     97 . N VUID,RXNIEN,RXNORM,SRCIEN,RXNNAME,RXNVER
     98 . I NDFIEN D
     99 . . S VUID=$$GET1^DIQ(50.68,VAPROD,99.99)
     100 . . S RXNIEN=$$FIND1^DIC(176.001,,,VUID,"VUID")
     101 . . S RXNORM=$$GET1^DIQ(176.001,RXNIEN,.01)
     102 . . S SRCIEN=$$FIND1^DIC(176.003,,"B","RXNORM")
     103 . . S RXNNAME=$$GET1^DIQ(176.003,SRCIEN,6)
     104 . . S RXNVER=$$GET1^DIQ(176.003,SRCIEN,7)
     105 . ;
     106 . E  S (RXNORM,RXNNAME,RXNVER)=""
     107 . ; End if/else block
     108 . S @MAP@("MEDPRODUCTNAMECODEVALUE")=RXNORM
     109 . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")=RXNNAME
     110 . S @MAP@("MEDPRODUCTNAMECODEVERSION")=RXNVER
     111 . ;
    74112 . S @MAP@("MEDBRANDNAMETEXT")=MED(6.5)
    75  . N MEDIEN S MEDIEN=$P(MED(6),U)
    76113 . D DOSE^PSS50(MEDIEN,,,,,"DOSE")
    77114 . N DOSEDATA M DOSEDATA=^TMP($J,"DOSE",MEDIEN)
     
    81118 . ; $$CPRS^PSNAPIS which returns dosage-form^va class^strengh^unit
    82119 . ; This call takes nodes 1 and 3 of ^PSDRUG(D0,"ND") as parameters
    83  . ; NDF Entry IEN, and VA Product Name
     120 . ; NDF Entry IEN, and VA Product IEN
    84121 . ; These can be obtained using NDF^PSS50 (IEN,,,,,"SUBSCRIPT")
    85  . ; Documented in the same manual.
    86  . D NDF^PSS50(MEDIEN,,,,,"CONC")
    87  . N NDFDATA M NDFDATA=^TMP($J,"CONC",MEDIEN)
    88  . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
    89  . N VAPROD S VAPROD=$P(NDFDATA(22),U)
     122 . ; These have been collected above.
    90123 . N CONCDATA
    91124 . ; If a drug was not matched to NDF, then the NDFIEN is gonna be ""
  • ccr/trunk/p/CCRMEDS2.m

    r295 r312  
    8585 . ; with that
    8686 . N MEDIEN S MEDIEN=$P(MED(11),U)
    87  . I +MEDIEN>0 D
    88  . . S @MAP@("MEDPRODUCTNAMECODEVALUE")=$$GET1^DIQ(50,MEDIEN,31,"E")
    89  . . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")="NDC"
    90  . . S @MAP@("MEDPRODUCTNAMECODEVERSION")="none"
     87 . I +MEDIEN>0 D  ; start of if/else block
     88 . . ; 12/30/08: I will be using RxNorm for coding...
     89 . . ; 176.001 is the file for Concepts; 176.003 is the file for
     90 . . ; sources (i.e. for RxNorm Version)
     91 . . ;
     92 . . ; We need the VUID first for the National Drug File entry first
     93 . . ; We get the VUID of the drug, by looking up the VA Product entry
     94 . . ; (file 50.68) using the call NDF^PSS50, returned in node 22.
     95 . . ; Field 99.99 is the VUID.
     96 . . ;
     97 . . ; We use the VUID to look up the RxNorm in file 176.001; same idea.
     98 . . ; Get IEN first using $$FIND1^DIC, then get the RxNorm number by
     99 . . ; $$GET1^DIQ.
     100 . . ;
     101 . . ; I get the RxNorm name and version from the RxNorm Sources (file
     102 . . ; 176.003), by searching for "RXNORM", then get the data.
     103 . . D NDF^PSS50(MEDIEN,,,,,"NDF")
     104 . . N NDFDATA M NDFDATA=^TMP($J,"NDF",MEDIEN)
     105 . . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
     106 . . N VAPROD S VAPROD=$P(NDFDATA(22),U)
     107 . . ;
     108 . . ; NDFIEN is not necessarily defined; it won't be if the drug
     109 . . ; is not matched to the national drug file (e.g. if the drug is
     110 . . ; new on the market, compounded, or is a fake drug [blue pill].
     111 . . ; To protect against failure, I will put an if/else block
     112 . . N VUID,RXNIEN,RXNORM,SRCIEN,RXNNAME,RXNVER
     113 . . I NDFIEN D
     114 . . . S VUID=$$GET1^DIQ(50.68,VAPROD,99.99)
     115 . . . S RXNIEN=$$FIND1^DIC(176.001,,,VUID,"VUID")
     116 . . . S RXNORM=$$GET1^DIQ(176.001,RXNIEN,.01)
     117 . . . S SRCIEN=$$FIND1^DIC(176.003,,"B","RXNORM")
     118 . . . S RXNNAME=$$GET1^DIQ(176.003,SRCIEN,6)
     119 . . . S RXNVER=$$GET1^DIQ(176.003,SRCIEN,7)
     120 . . ;
     121 . . E  S (RXNORM,RXNNAME,RXNVER)=""
     122 . . ; End if/else block
     123 . . S @MAP@("MEDPRODUCTNAMECODEVALUE")=RXNORM
     124 . . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")=RXNNAME
     125 . . S @MAP@("MEDPRODUCTNAMECODEVERSION")=RXNVER
     126 . . ;
    91127 . . S @MAP@("MEDBRANDNAMETEXT")=""
    92128 . . D DOSE^PSS50(MEDIEN,,,,,"DOSE")
     
    99135 . . ; NDF Entry IEN, and VA Product Name
    100136 . . ; These can be obtained using NDF^PSS50 (IEN,,,,,"SUBSCRIPT")
    101  . . ; Documented in the same manual.
    102  . . D NDF^PSS50(MEDIEN,,,,,"CONC")
    103  . . N NDFDATA M NDFDATA=^TMP($J,"CONC",MEDIEN)
    104  . . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
    105  . . N VAPROD S VAPROD=$P(NDFDATA(22),U)
     137 . . ; Documented in the same manual; executed above.
    106138 . . N CONCDATA
    107139 . . ; If a drug was not matched to NDF, then the NDFIEN is gonna be ""
     
    134166 . . S @MAP@("MEDQUANTITYVALUE")=""
    135167 . . S @MAP@("MEDQUANTITYUNIT")=""
    136  . ;
     168 . ; end of if/else block
    137169 . ;
    138170 . ; --- START OF DIRECTIONS ---
  • ccr/trunk/p/CCRMEDS3.m

    r295 r312  
    2121 Q
    2222 ;
    23 EXTRACT(MINXML,DFN,OUTXML)           ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
     23EXTRACT(MINXML,DFN,OUTXML) ; Extract medications into provided xml template
    2424 ;
    2525 ; MINXML is the Input XML Template, passed by name
     
    7878 . ; It' node 1, internal form.
    7979 . N MEDIEN S MEDIEN=MED(1,"I")
    80  . I +MEDIEN D
    81  . . S @MAP@("MEDPRODUCTNAMECODEVALUE")=$$GET1^DIQ(50,MEDIEN,31,"E")
    82  . . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")="NDC"
    83  . . S @MAP@("MEDPRODUCTNAMECODEVERSION")="none"
     80 . I +MEDIEN D  ; start of if/else block
     81 . . ; 12/30/08: I will be using RxNorm for coding...
     82 . . ; 176.001 is the file for Concepts; 176.003 is the file for
     83 . . ; sources (i.e. for RxNorm Version)
     84 . . ;
     85 . . ; We need the VUID first for the National Drug File entry first
     86 . . ; We get the VUID of the drug, by looking up the VA Product entry
     87 . . ; (file 50.68) using the call NDF^PSS50, returned in node 22.
     88 . . ; Field 99.99 is the VUID.
     89 . . ;
     90 . . ; We use the VUID to look up the RxNorm in file 176.001; same idea.
     91 . . ; Get IEN first using $$FIND1^DIC, then get the RxNorm number by
     92 . . ; $$GET1^DIQ.
     93 . . ;
     94 . . ; I get the RxNorm name and version from the RxNorm Sources (file
     95 . . ; 176.003), by searching for "RXNORM", then get the data.
     96 . . D NDF^PSS50(MEDIEN,,,,,"NDF")
     97 . . N NDFDATA M NDFDATA=^TMP($J,"NDF",MEDIEN)
     98 . . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
     99 . . N VAPROD S VAPROD=$P(NDFDATA(22),U)
     100 . . ;
     101 . . ; NDFIEN is not necessarily defined; it won't be if the drug
     102 . . ; is not matched to the national drug file (e.g. if the drug is
     103 . . ; new on the market, compounded, or is a fake drug [blue pill].
     104 . . ; To protect against failure, I will put an if/else block
     105 . . N VUID,RXNIEN,RXNORM,SRCIEN,RXNNAME,RXNVER
     106 . . I NDFIEN D
     107 . . . S VUID=$$GET1^DIQ(50.68,VAPROD,99.99)
     108 . . . S RXNIEN=$$FIND1^DIC(176.001,,,VUID,"VUID")
     109 . . . S RXNORM=$$GET1^DIQ(176.001,RXNIEN,.01)
     110 . . . S SRCIEN=$$FIND1^DIC(176.003,,"B","RXNORM")
     111 . . . S RXNNAME=$$GET1^DIQ(176.003,SRCIEN,6)
     112 . . . S RXNVER=$$GET1^DIQ(176.003,SRCIEN,7)
     113 . . ;
     114 . . E  S (RXNORM,RXNNAME,RXNVER)=""
     115 . . ; End if/else block
     116 . . S @MAP@("MEDPRODUCTNAMECODEVALUE")=RXNORM
     117 . . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")=RXNNAME
     118 . . S @MAP@("MEDPRODUCTNAMECODEVERSION")=RXNVER
     119 . . ;
    84120 . . S @MAP@("MEDBRANDNAMETEXT")=""
    85121 . . D DOSE^PSS50(MEDIEN,,,,,"DOSE")
     
    92128 . . ; NDF Entry IEN, and VA Product Name
    93129 . . ; These can be obtained using NDF^PSS50 (IEN,,,,,"SUBSCRIPT")
    94  . . ; Documented in the same manual.
     130 . . ; Documented in the same manual; executed above.
    95131 . . ;
    96  . . ; If the drug is not matched to the National Drug File
    97  . . ; there will be no NDF Data.
    98  . . N NDFDATA,CONCDATA
    99  . . D NDF^PSS50(MEDIEN,,,,,"CONC")
    100  . . M NDFDATA=^TMP($J,"CONC",MEDIEN)
    101  . . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
    102  . . N VAPROD S VAPROD=$P(NDFDATA(22),U)
    103132 . . ; If a drug was not matched to NDF, then the NDFIEN is gonna be ""
    104133 . . ; and this will crash the call. So...
     
    130159 . . S @MAP@("MEDQUANTITYVALUE")=""
    131160 . . S @MAP@("MEDQUANTITYUNIT")=""
    132  . ;
     161 . ; End If/Else
    133162 . ; --- START OF DIRECTIONS ---
    134163 . ; Dosage is field 2, route is 3, schedule is 4
Note: See TracChangeset for help on using the changeset viewer.