/// <summary>If the number of codes in the code tables (I.e. Snomed, Loinc, Cpt, etc.) are greater than the number we expect then 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. #region Count Variables //Counts from the DB long countCdcDB = -1; long countCdtDB = -1; long countCptDB = -1; long countCvxDB = -1; long countHcpcsDB = -1; long countIcd9DB = -1; long countIcd10DB = -1; long countLoincDB = -1; long countRxNormDB = -1; long countSnomedDB = -1; long countSopDB = -1; //Counts hard-coded from the EhrCodes.Listt. Lowered slightly to give a buffer, in case we decide to remove some codes later. const long countCdcList = 5; const long countCdtList = 10; const long countCptList = 300; const long countCvxList = 5; const long countHcpcsList = 20; const long countIcd9List = 1500; const long countIcd10List = 2000; const long countLoincList = 20; const long countRxNormList = 40; const long countSnomedList = 700; const long countSopList = 100; #endregion for (int i = 0; i < listt.Count; i++) { if (listt[i].IsInDb) { continue; //The codes are already present in the database, so we don't need to check again. } switch (listt[i].CodeSystem) { case "AdministrativeSex": //always "in DB", even though there is no DB table listt[i].IsInDb = true; break; case "CDCREC": if (countCdcDB == -1) { countCdcDB = Cdcrecs.GetCodeCount(); } if (countCdcDB > countCdcList) { listt[i].IsInDb = true; } break; case "CDT": if (countCdtDB == -1) { countCdtDB = ProcedureCodes.GetCodeCount(); } if (countCdtDB > countCdtList) { listt[i].IsInDb = true; } break; case "CPT": if (countCptDB == -1) { countCptDB = Cpts.GetCodeCount(); } if (countCptDB > countCptList) { listt[i].IsInDb = true; } break; case "CVX": if (countCvxDB == -1) { countCvxDB = Cvxs.GetCodeCount(); } if (countCvxDB > countCvxList) { listt[i].IsInDb = true; } break; case "HCPCS": if (countHcpcsDB == -1) { countHcpcsDB = Hcpcses.GetCodeCount(); } if (countHcpcsDB > countHcpcsList) { listt[i].IsInDb = true; } break; case "ICD9CM": if (countIcd9DB == -1) { countIcd9DB = ICD9s.GetCodeCount(); } if (countIcd9DB > countIcd9List) { listt[i].IsInDb = true; } break; case "ICD10CM": if (countIcd10DB == -1) { countIcd10DB = Icd10s.GetCodeCount(); } if (countIcd10DB > countIcd10List) { listt[i].IsInDb = true; } break; case "LOINC": if (countLoincDB == -1) { countLoincDB = Loincs.GetCodeCount(); } if (countLoincDB > countLoincList) { listt[i].IsInDb = true; } break; case "RXNORM": if (countRxNormDB == -1) { countRxNormDB = RxNorms.GetCodeCount(); } if (countRxNormDB > countRxNormList) { listt[i].IsInDb = true; } break; case "SNOMEDCT": if (countSnomedDB == -1) { countSnomedDB = Snomeds.GetCodeCount(); } if (countSnomedDB > countSnomedList) { listt[i].IsInDb = true; } break; case "SOP": if (countSopDB == -1) { countSopDB = Sops.GetCodeCount(); } if (countSopDB > countSopList) { listt[i].IsInDb = true; } break; } } //This updates the last column "ExistsInDatabse" based on weather or not the code is found in another table in the database. }