Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: GMRAZRXU

GMRAZRXU.m

Go to the documentation of this file.
  1. GMRAZRXU ; IHS/MSC/MGH - RxNorm and UNI code ;04-Feb-2014 16:21;DU
  1. ;;4.0;Adverse Reaction Tracking;**1007**;Mar 29, 1996;Build 18
  1. ;
  1. ;When a new allergy is stored, find the Rxnorm and/or UNI codes to be attached to the allergy and it symptoms
  1. RXNORM(GMRAIEN) ;EP
  1. N TYPE
  1. S TYPE=$P($G(^GMR(120.8,GMRAIEN,0)),U,3)
  1. I $P(TYPE,";",2)="GMRD(120.82," D GMR(GMRAIEN)
  1. E D ING(GMRAIEN)
  1. D SIGNS(GMRAIEN)
  1. Q
  1. ;Lookup and set the UNII code associated with this GMR allergy
  1. GMR(GMRAIEN) ;GMR files
  1. N TXT,ARR,IN,OUT,X,UNII,IEN,ERR,IEN2
  1. Q:'GMRAIEN
  1. S TXT=$P($G(^GMR(120.8,GMRAIEN,0)),U,2)
  1. ;Do Apelon lookup here
  1. S IN=TXT_U_"32773^^1"
  1. S X=$$ASSOC^BSTSAPI(IN)
  1. I $P(X,U,3)'="" D
  1. . S IEN=GMRAIEN_","
  1. . S FDA(120.8,IEN,9999999.15)=$P(X,U,3)
  1. . D UPDATE^DIE(,"FDA","IEN2","ERR")
  1. Q
  1. ;Lookup the drug ingredients and store the RxNorm and UNII codes associated with each
  1. ING(GMRAIEN) ;drug ingredients
  1. N TXT,ARR,IN,OUT,X,RXNORM,UNII,IEN,ERR,ING,VUID,PRIM,RET,AIEN
  1. S RET=0
  1. S IEN=0 F S IEN=$O(^GMR(120.8,GMRAIEN,2,IEN)) Q:'+IEN D
  1. .S ING=$P($G(^GMR(120.8,GMRAIEN,2,IEN,0)),U,1)
  1. .S PRIM=$$GET1^DIQ(50.416,ING,.02,"I")
  1. .S ING=$P($G(^PS(50.416,ING,0)),U)
  1. .S AIEN=IEN_","_GMRAIEN_","
  1. .;Lookup the RxNorm and UNII based on the name
  1. .S IN=ING_U_"32771^^1"
  1. .S X=$$ASSOC^BSTSAPI(IN)
  1. .I $P(X,U,2)'=""!($P(X,U,3)'="") D
  1. ..I $P(X,U,2)'="" S FDA(120.802,AIEN,9999999.01)=$P(X,U,2)
  1. ..I $P(X,U,3)'="" S FDA(120.802,AIEN,9999999.02)=$P(X,U,3)
  1. ..D UPDATE^DIE(,"FDA","IEN2","ERR")
  1. .I $P(X,U,2)=""&($P(X,U,3)="") D
  1. ..Q:PRIM=""
  1. ..S IN=PRIM_U_"32771^^1"
  1. ..S X=$$ASSOC^BSTSAPI(IN)
  1. ..I $P(X,U,2)'="" S FDA(120.802,AIEN,9999999.01)=$P(X,U,2)
  1. ..I $P(X,U,3)'="" S FDA(120.802,AIEN,9999999.02)=$P(X,U,3)
  1. ..D UPDATE^DIE(,"FDA","IEN2","ERR")
  1. Q
  1. ;For signs/symptoms
  1. SIGNS(GMRAIEN) ;signs multiple
  1. N REACT,X,IN,FNUM,FDA,IEN2,ERR
  1. S RET=0
  1. S IEN=0 F S IEN=$O(^GMR(120.8,GMRAIEN,10,IEN)) Q:'+IEN D
  1. .S AIEN=IEN_","_GMRAIEN_","
  1. .S REACT=$$GET1^DIQ(120.81,AIEN,.01)
  1. .S IN=REACT_"^32772^^1"
  1. .S X=$$ASSOC^BSTSAPI(IN)
  1. .I $P(X,U,1)'="" D
  1. ..S FNUM=120.81
  1. ..S FDA(FNUM,AIEN,9999999.12)=$P(X,U,1)
  1. ..D UPDATE^DIE(,"FDA","IEN2","ERR")
  1. Q
  1. BACKLOAD ;EP Backload this data on entire allergy file
  1. N GMRAIEN,DFN,REACT,TYPE,DATA,EIE
  1. S GMRAIEN=0 F S GMRAIEN=$O(^GMR(120.8,GMRAIEN)) Q:'+GMRAIEN D
  1. .S DATA=$G(^GMR(120.8,GMRAIEN,0))
  1. .S DFN=$P(DATA,U),REACT=$P(DATA,U,2),TYPE=$P(DATA,U,3)
  1. .Q:(DFN="")!(REACT="")!(TYPE="")
  1. .S EIE=$$GET1^DIQ(120.8,GMRAIEN,22,"I")
  1. .Q:EIE=1
  1. .D RXNORM(GMRAIEN)
  1. Q