示例#1
0
        ///<summary>Called after file is downloaded.  Throws exceptions.  It is assumed that this is called from a worker thread.  Progress delegate will be called every 100th iteration to inform thread of current progress. Quit flag can be set at any time in order to quit importing prematurely.</summary>
        public static void ImportRxNorm(string tempFileName, ProgressArgs progress, ref bool quit)
        {
            if (tempFileName == null)
            {
                return;
            }
            HashSet <string> codeHash = new HashSet <string>(RxNorms.GetAllCodes());

            string[] lines = File.ReadAllLines(tempFileName);
            string[] arrayRxNorm;
            RxNorm   rxNorm = new RxNorm();

            for (int i = 0; i < lines.Length; i++)       //each loop should read exactly one line of code. and each line of code should be a unique code
            {
                if (quit)
                {
                    return;
                }
                if (i % 100 == 0)
                {
                    progress(i + 1, lines.Length);
                }
                arrayRxNorm = lines[i].Split('\t');
                if (codeHash.Contains(arrayRxNorm[0]))                 //code already exists
                {
                    continue;
                }
                rxNorm.RxCui       = arrayRxNorm[0];
                rxNorm.MmslCode    = arrayRxNorm[1];
                rxNorm.Description = arrayRxNorm[2];
                RxNorms.Insert(rxNorm);
            }
        }
示例#2
0
文件: FormRxNorms.cs 项目: mnisl/OD
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			if(!IsSelectionMode) {
				return;
			}
			SelectedRxNorm=rxList[e.Row];
			ListSelectedRxNorms=new List<RxNorm>();
			ListSelectedRxNorms.Add(rxList[e.Row]);
			DialogResult=DialogResult.OK;
		}
示例#3
0
 ///<summary></summary>
 public static long Insert(RxNorm rxNorm)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         rxNorm.RxNormNum = Meth.GetLong(MethodBase.GetCurrentMethod(), rxNorm);
         return(rxNorm.RxNormNum);
     }
     return(Crud.RxNormCrud.Insert(rxNorm));
 }
示例#4
0
 ///<summary></summary>
 public static void Update(RxNorm rxNorm)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), rxNorm);
         return;
     }
     Crud.RxNormCrud.Update(rxNorm);
 }
示例#5
0
 private void butOK_Click(object sender,EventArgs e)
 {
     if(gridMain.GetSelectedIndex()<0) {
         MsgBox.Show(this,"Please select an item first.");
         return;
     }
     SelectedRxNorm=rxList[gridMain.GetSelectedIndex()];
     DialogResult=DialogResult.OK;
 }
示例#6
0
        ///<summary>Called after file is downloaded.  Throws exceptions.  It is assumed that this is called from a worker thread.  Progress delegate will be called every 100th iteration to inform thread of current progress. Quit flag can be set at any time in order to quit importing prematurely.</summary>
        public static void ImportRxNorm(string tempFileName, ProgressArgs progress, ref bool quit, ref int numCodesImported, ref int numCodesUpdated,
                                        bool updateExisting)
        {
            if (tempFileName == null)
            {
                return;
            }
            //RxNorms can have two codes for each RxCui. One RxNorm will have a value in the MmslCode and a blank description and the other will have a
            //value in the Description and a blank MmslCode.
            List <RxNorm> listRxNorms = RxNorms.GetAll();
            Dictionary <string, RxNorm> dictRxNormsMmslCodes   = listRxNorms.Where(x => x.MmslCode != "").ToDictionary(x => x.RxCui, x => x);
            Dictionary <string, RxNorm> dictRxNormsDefinitions = listRxNorms.Where(x => x.Description != "").ToDictionary(x => x.RxCui, x => x);

            string[] lines = File.ReadAllLines(tempFileName);
            string[] arrayRxNorm;
            RxNorm   rxNorm = new RxNorm();

            for (int i = 0; i < lines.Length; i++)       //Each loop should read exactly one line of code. Each line will NOT be a unique code.
            {
                if (quit)
                {
                    return;
                }
                if (i % 100 == 0)
                {
                    progress(i + 1, lines.Length);
                }
                arrayRxNorm = lines[i].Split('\t');
                if (dictRxNormsMmslCodes.ContainsKey(arrayRxNorm[0]))                 //code with an MmslCode already exists
                {
                    rxNorm = dictRxNormsMmslCodes[arrayRxNorm[0]];
                    if (updateExisting)
                    {
                        if (arrayRxNorm[1] != "" && arrayRxNorm[1] != rxNorm.MmslCode)
                        {
                            rxNorm.MmslCode    = arrayRxNorm[1];
                            rxNorm.Description = "";                          //Should be blank for all MMSL code entries. See below for non-MMSL entries with descriptions.
                            RxNorms.Update(rxNorm);
                            numCodesUpdated++;
                        }
                    }
                    continue;
                }
                if (dictRxNormsDefinitions.ContainsKey(arrayRxNorm[0]))                 //code with a Description already exists
                {
                    rxNorm = dictRxNormsDefinitions[arrayRxNorm[0]];
                    if (updateExisting)
                    {
                        string newDescript = arrayRxNorm[2];
                        //if(newDescript.Length>255) {
                        //	newDescript=newDescript.Substring(0,255);//Description column is only varchar(255) so some descriptions will get truncated.
                        //}
                        //if(arrayRxNorm[2]!="" && newDescript!=rxNorm.Description) {
                        if (arrayRxNorm[2] != "" && arrayRxNorm[2] != rxNorm.Description)
                        {
                            rxNorm.MmslCode    = "";                       //should be blank for all entries that have a description.
                            rxNorm.Description = arrayRxNorm[2];
                            RxNorms.Update(rxNorm);
                            numCodesUpdated++;
                        }
                    }
                    continue;
                }
                rxNorm.RxCui       = arrayRxNorm[0];
                rxNorm.MmslCode    = arrayRxNorm[1];
                rxNorm.Description = arrayRxNorm[2];
                RxNorms.Insert(rxNorm);
                numCodesImported++;
            }
        }
示例#7
0
		///<summary>Called after file is downloaded.  Throws exceptions.  It is assumed that this is called from a worker thread.  Progress delegate will be called every 100th iteration to inform thread of current progress. Quit flag can be set at any time in order to quit importing prematurely.</summary>
		public static void ImportRxNorm(string tempFileName,ProgressArgs progress,ref bool quit) {
			if(tempFileName==null) {
				return;
			}
			HashSet<string> codeHash=new HashSet<string>(RxNorms.GetAllCodes());
			string[] lines=File.ReadAllLines(tempFileName);
			string[] arrayRxNorm;
			RxNorm rxNorm=new RxNorm();
			for(int i=0;i<lines.Length;i++) {//each loop should read exactly one line of code. and each line of code should be a unique code
				if(quit) {
					return;
				}
				if(i%100==0) {
					progress(i+1,lines.Length);
				}
				arrayRxNorm=lines[i].Split('\t');
				if(codeHash.Contains(arrayRxNorm[0])) {//code already exists
					continue;
				}
				rxNorm.RxCui				=arrayRxNorm[0];
				rxNorm.MmslCode			=arrayRxNorm[1];
				rxNorm.Description	=arrayRxNorm[2];
				RxNorms.Insert(rxNorm);
			}
		}
示例#8
0
文件: FormRxNorms.cs 项目: mnisl/OD
		private void butOK_Click(object sender,EventArgs e) {
			if(gridMain.GetSelectedIndex()<0) {
				MsgBox.Show(this,"Please select an item first.");
				return;
			}
			SelectedRxNorm=rxList[gridMain.GetSelectedIndex()];
			ListSelectedRxNorms=new List<RxNorm>();
			for(int i=0;i<gridMain.SelectedIndices.Length;i++) {
				ListSelectedRxNorms.Add(rxList[gridMain.SelectedIndices[i]]);
			}
			DialogResult=DialogResult.OK;
		}
示例#9
0
文件: FormRxNorms.cs 项目: mnisl/OD
		//private void butRxNorm_Click(object sender,EventArgs e) {
		//	//if(!MsgBox.Show(this,MsgBoxButtons.OKCancel,"This will ")) {
		//	//	return;
		//	//}
		//	Cursor=Cursors.WaitCursor;
		//	RxNorms.CreateFreshRxNormTableFromZip();
		//	Cursor=Cursors.Default;
		//	MsgBox.Show(this,"done");
		//	//just making sure it worked:
		//	/*
		//	RxNorm rxNorm=RxNorms.GetOne(1);
		//	MsgBox.Show(this,rxNorm.RxNormNum+" "+rxNorm.RxCui+" "+rxNorm.MmslCode+" "+rxNorm.Description);
		//	MsgBox.Show(this,RxNorms.GetMmslCodeByRxCui("1000005")+" <-- should be 26420");
		//	MsgBox.Show(this,RxNorms.GetMmslCodeByRxCui("1000002")+" <-- should be blank");*/
		//}

		private void butNone_Click(object sender,EventArgs e) {
			SelectedRxNorm=new RxNorm();
			ListSelectedRxNorms=new List<RxNorm>();
			DialogResult=DialogResult.OK;
		}
示例#10
0
文件: RxNorms.cs 项目: mnisl/OD
		///<summary></summary>
		public static long Insert(RxNorm rxNorm) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				rxNorm.RxNormNum=Meth.GetLong(MethodBase.GetCurrentMethod(),rxNorm);
				return rxNorm.RxNormNum;
			}
			return Crud.RxNormCrud.Insert(rxNorm);
		}
示例#11
0
		public void AddCode(RxNorm rxNorm) {
			subject4List.Add(new Subject3(new Value(rxNorm.RxCui,"2.16.840.1.113883.6.88","RxNorm",rxNorm.Description)));
			subject4List[subject4List.Count-1].mainSearchCriteria.originalText=rxNorm.Description;
		}
示例#12
0
 private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e)
 {
     SelectedRxNorm=rxList[e.Row];
     DialogResult=DialogResult.OK;
 }