示例#1
0
        ///<summary>Called after file is downloaded.  Throws exceptions.</summary>
        //public static void ImportCDT(string tempFileName) ... not necessary.

        ///<summary>Called after user provides resource file.  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 ImportCpt(string tempFileName, ProgressArgs progress, ref bool quit)
        {
            if (tempFileName == null)
            {
                return;
            }
            HashSet <string> codeHash = new HashSet <string>(Cpts.GetAllCodes());

            string[] lines = File.ReadAllLines(tempFileName);
            string[] arrayCpt;
            bool     isHeader = true;
            Cpt      cpt      = new Cpt();

            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);
                }
                if (isHeader)
                {
                    if (!lines[i].Contains("\t"))
                    {
                        continue;                        //Copyright info is present at the head of the file.
                    }
                    isHeader = false;
                }
                arrayCpt = lines[i].Split('\t');
                if (codeHash.Contains(arrayCpt[0]))                 //code already exists
                {
                    continue;
                }
                cpt.CptCode     = arrayCpt[0];
                cpt.Description = arrayCpt[1];
                Cpts.Insert(cpt);
            }
        }
示例#2
0
        /// <summary>If the CodeValue of the EhrCode exists in its respective code table (I.e. Snomed, Loinc, Cpt, etc.) this will set IsInDb=true otherwise false.</summary>
        private static void updateCodeExistsHelper()
        {
            //No need to check RemotingRole; no call to db.
            if (listt.Count == 0)
            {
                return;
            }
            //Cache lists of codes.
            HashSet <string> cdcrecHS = new HashSet <string>(Cdcrecs.GetAllCodes());
            HashSet <string> cdtHS    = new HashSet <string>(ProcedureCodes.GetAllCodes());
            HashSet <string> cptHS    = new HashSet <string>(Cpts.GetAllCodes());
            HashSet <string> cvxHS    = new HashSet <string>(Cvxs.GetAllCodes());
            HashSet <string> hcpcsHS  = new HashSet <string>(Hcpcses.GetAllCodes());
            HashSet <string> icd10HS  = new HashSet <string>(Icd10s.GetAllCodes());
            HashSet <string> icd9HS   = new HashSet <string>(ICD9s.GetAllCodes());
            HashSet <string> loincHS  = new HashSet <string>(Loincs.GetAllCodes());
            HashSet <string> rxnormHS = new HashSet <string>(RxNorms.GetAllCodes());
            HashSet <string> snomedHS = new HashSet <string>(Snomeds.GetAllCodes());
            HashSet <string> sopHS    = new HashSet <string>(Sops.GetAllCodes());

            for (int i = 0; i < listt.Count; i++)
            {
                switch (listt[i].CodeSystem)
                {
                case "AdministrativeSex":                        //always "in DB", even though there is no DB table
                    listt[i].IsInDb = true;
                    break;

                case "CDCREC":
                    listt[i].IsInDb = cdcrecHS.Contains(listt[i].CodeValue);
                    break;

                case "CDT":
                    listt[i].IsInDb = cdtHS.Contains(listt[i].CodeValue);
                    break;

                case "CPT":
                    listt[i].IsInDb = cptHS.Contains(listt[i].CodeValue);
                    break;

                case "CVX":
                    listt[i].IsInDb = cvxHS.Contains(listt[i].CodeValue);
                    break;

                case "HCPCS":
                    listt[i].IsInDb = hcpcsHS.Contains(listt[i].CodeValue);
                    break;

                case "ICD9CM":
                    listt[i].IsInDb = icd9HS.Contains(listt[i].CodeValue);
                    break;

                case "ICD10CM":
                    listt[i].IsInDb = icd10HS.Contains(listt[i].CodeValue);
                    break;

                case "LOINC":
                    listt[i].IsInDb = loincHS.Contains(listt[i].CodeValue);
                    break;

                case "RXNORM":
                    listt[i].IsInDb = rxnormHS.Contains(listt[i].CodeValue);
                    break;

                case "SNOMEDCT":
                    listt[i].IsInDb = snomedHS.Contains(listt[i].CodeValue);
                    break;

                case "SOP":
                    listt[i].IsInDb = sopHS.Contains(listt[i].CodeValue);
                    break;
                }
            }

            //This updates the last column "ExistsInDatabse" based on weather or not the code is found in another table in the database.
        }