コード例 #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 ImportLoinc(string tempFileName, ProgressArgs progress, ref bool quit)
        {
            if (tempFileName == null)
            {
                return;
            }
            HashSet <string> codeHash = new HashSet <string>(Loincs.GetAllCodes());

            string[] lines = File.ReadAllLines(tempFileName);
            string[] arrayLoinc;
            Loinc    loinc = new Loinc();

            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);
                }
                arrayLoinc = lines[i].Split('\t');
                if (codeHash.Contains(arrayLoinc[0]))                 //code already exists
                {
                    continue;
                }
                loinc.LoincCode               = arrayLoinc[0];
                loinc.Component               = arrayLoinc[1];
                loinc.PropertyObserved        = arrayLoinc[2];
                loinc.TimeAspct               = arrayLoinc[3];
                loinc.SystemMeasured          = arrayLoinc[4];
                loinc.ScaleType               = arrayLoinc[5];
                loinc.MethodType              = arrayLoinc[6];
                loinc.StatusOfCode            = arrayLoinc[7];
                loinc.NameShort               = arrayLoinc[8];
                loinc.ClassType               = arrayLoinc[9];
                loinc.UnitsRequired           = arrayLoinc[10] == "Y";
                loinc.OrderObs                = arrayLoinc[11];
                loinc.HL7FieldSubfieldID      = arrayLoinc[12];
                loinc.ExternalCopyrightNotice = arrayLoinc[13];
                loinc.NameLongCommon          = arrayLoinc[14];
                loinc.UnitsUCUM               = arrayLoinc[15];
                loinc.RankCommonTests         = PIn.Int(arrayLoinc[16]);
                loinc.RankCommonOrders        = PIn.Int(arrayLoinc[17]);
                Loincs.Insert(loinc);
            }
        }
コード例 #2
0
ファイル: EhrCodes.cs プロジェクト: steev90/opendental
        /// <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.
        }