public int GetExistingDataLoadMismatch(Observation obx) { int existingDataLoadMismatchId = 0; SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = SqlConnectionMain; cmd.CommandText = "GetExistingDataLoadMismatch"; cmd.Parameters.Clear(); cmd.Parameters.Add(new SqlParameter("@LastName", obx.LastName)); cmd.Parameters.Add(new SqlParameter("@FirstName", obx.FirstName)); cmd.Parameters.Add(new SqlParameter("@Gender", obx.Gender)); cmd.Parameters.Add(new SqlParameter("@DateOfBirth", obx.DOB)); cmd.Parameters.Add(new SqlParameter("@SSN", obx.SSN)); reader = cmd.ExecuteReader(); if (reader.Read()) { existingDataLoadMismatchId = Convert.ToInt32(reader.GetValue(0)); } reader.Close(); return existingDataLoadMismatchId; }
public void ProcessFullMatchAndGoodValue(Observation obx) { string messageString = "User " + obx.UserCN + " (" + obx.FirstName + " " + obx.LastName + ") WAS found in our user database, as user (" + obx.UserId + "), and the test result was loaded."; Logger.LogLine(messageString); DAL.InsertNewTestResult(obx); DAL.UpdateProcessedObservationStatus(obx, true, messageString, null, null); // Add user ID to the user ID list, if not already in it if (!UserIdList.Contains(obx.UserId)) { UserIdList.Add(obx.UserId); } // If a replacement value was used, mark the DataLoadValueError entry as resolved if (obx.DataLoadValueErrorID > 0 && obx.ReplacementValue != null && obx.ResultData == obx.ReplacementValue) { DAL.ResolveDataLoadValueError(obx.DataLoadValueErrorID); } }
public void InsertNewTestResult(Observation obx) { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = SqlConnectionMain; Logger.LogLine("Inserting new test result for:"); Logger.LogLine(" UserId:" + obx.UserId); Logger.LogLine(" TestId:" + obx.UserId); Logger.LogLine(" EntryDate:" + obx.UserId); // Add a new test result cmd.CommandText = "InsertNewTestResult"; cmd.Parameters.Clear(); cmd.Parameters.Add(new SqlParameter("@UserId", obx.UserId)); cmd.Parameters.Add(new SqlParameter("@EntryDate", obx.EntryDate)); // Should come from the MSH segment... cmd.Parameters.Add(new SqlParameter("@Test", obx.ObservationIdText)); cmd.Parameters.Add(new SqlParameter("@TestResult", "")); // Do we need to compute this on test entry? cmd.Parameters.Add(new SqlParameter("@TestId", obx.TestId)); cmd.Parameters.Add(new SqlParameter("@TestValue", obx.ResultData)); cmd.Parameters.Add(new SqlParameter("@NormalRange", obx.ReferenceRange)); cmd.ExecuteNonQuery(); }
private void GetAutoMatchMappedUserId(Observation obx, List<AutoMatch> autoMatchList) { string obxLastName = obx.LastName.ToLower(); string obxFirstName = obx.FirstName.ToLower(); string obxGender = obx.Gender.ToLower(); string obxSSN = obx.SSN; DateTime obxDOB = ImplausibleDateTime; // A perfectly implausible date of birth... DateTime.TryParseExact(obx.DOB, DAL.DateFormats, new CultureInfo("en-US"), DateTimeStyles.None, out obxDOB); foreach (AutoMatch autoMatch in autoMatchList) { string autoMatchSSN = autoMatch.SSN; string autoMatchLastName = autoMatch.LastName.ToLower(); string autoMatchFirstName = autoMatch.FirstName.ToLower(); string autoMatchGender = autoMatch.Gender.ToLower(); if (obxSSN == autoMatchSSN && obxLastName == autoMatchLastName && obxFirstName == autoMatchFirstName && obxGender == autoMatchGender) { if (obxDOB.Date == autoMatch.DOB.Date) { obx.UserId = autoMatch.MatchedToUserId; return; } } } }
private void GetExplicitMatchMappedUserIdAndTestId(Observation obx, List<ExplicitMatch> explicitMatchList) { foreach (ExplicitMatch explicitMatch in explicitMatchList) { if (obx.DataLoadMismatchTestID == explicitMatch.DataLoadMismatchTestId) { if (obx.UserId == 0) { obx.UserId = explicitMatch.MatchedToUserId; } if (obx.TestId == 0) { obx.TestId = explicitMatch.MatchedToTestId; } return; } } }
public void ProcessObservationMismatch(Observation obx) { string messageString = "User " + obx.UserCN + " (" + obx.FirstName + " " + obx.LastName + ") found as user (" + obx.UserId + "), BUT the test result was NOT loaded, because there was no USHC test corresponding to observation (" + obx.ObservationId + ")."; Logger.LogLine(messageString); int mismatchTestId = RecordMismatchForLaterResolution(obx); DAL.UpdateProcessedObservationStatus(obx, false, messageString, mismatchTestId, null); }
public bool TestValueIsValid(Observation obx) { if (ContainsAtLeastOneDigit(obx.TestNormalRange) || ContainsAtLeastOneDigit(obx.TestNormalRangeFemale)) { decimal decimalResultData = 0; if (!decimal.TryParse(obx.ResultData, out decimalResultData)) { return false; } } return true; }
public List <Observation> GetObservationList() { List <Observation> obxList = new List <Observation>(); SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = SqlConnectionMain; // Get previously processed observations that failed cmd.CommandText = "GetMessageObservationsFailed"; reader = cmd.ExecuteReader(); while (reader.Read()) { Observation obx = new Observation(); obx.MessageId = UtilitiesDAL.ToString(reader["MessageID"]); obx.SequenceId = UtilitiesDAL.ToInt(reader["SequenceID"]); obx.CustomerString = UtilitiesDAL.ToString(reader["CustomerString"]); obx.ObservationId = UtilitiesDAL.ToString(reader["OBXID"]); obx.ObservationIdText = UtilitiesDAL.ToString(reader["OBXIDTEXT"]); obx.ResultData = UtilitiesDAL.ToString(reader["OBXRESULT"]); obx.ResultUnits = UtilitiesDAL.ToString(reader["OBXUNITS"]); obx.ReferenceRange = UtilitiesDAL.ToString(reader["OBXREFRANGE"]); obx.TestId = UtilitiesDAL.ToInt(reader["TestID"]); obx.TestNormalRange = UtilitiesDAL.ToString(reader["NormalRange"]); obx.TestNormalRangeFemale = UtilitiesDAL.ToString(reader["NormalRangeF"]); obx.InternalPatientId = UtilitiesDAL.ToString(reader["PIDINTERNALPATIENTID"]); obx.SSN = GetSSN(reader); obx.LastName = UtilitiesDAL.ToString(reader["PIDLASTNAME"]); obx.FirstName = UtilitiesDAL.ToString(reader["PIDFIRSTNAME"]); obx.MiddleName = UtilitiesDAL.ToString(reader["PIDMIDDLENAME"]); obx.DOB = UtilitiesDAL.ToString(reader["PIDDOB"]); obx.Gender = UtilitiesDAL.ToString(reader["PIDGENDER"]); obx.StreetAddress = UtilitiesDAL.ToString(reader["PIDSTREET"]); obx.OtherAddress = UtilitiesDAL.ToString(reader["PIDOTHER"]); obx.City = UtilitiesDAL.ToString(reader["PIDCITY"]); obx.State = UtilitiesDAL.ToString(reader["PIDSTATE"]); obx.Zip = UtilitiesDAL.ToString(reader["PIDZIP"]); obx.DataLoadMismatchTestID = UtilitiesDAL.ToInt(reader["DataLoadMismatchTestID"]); obx.DataLoadValueErrorID = UtilitiesDAL.ToInt(reader["DataLoadValueErrorID"]); obx.ReplacementValue = UtilitiesDAL.ToNullableString(reader["ReplacementValue"]); SpecialObxSetup(obx, reader); obxList.Add(obx); } reader.Close(); // Get new never-before-processed observations cmd.CommandText = "GetMessageObservationsUnattempted"; reader = cmd.ExecuteReader(); while (reader.Read()) { Observation obx = new Observation(); obx.MessageId = UtilitiesDAL.ToString(reader["MessageID"]); obx.SequenceId = UtilitiesDAL.ToInt(reader["SequenceID"]); obx.CustomerString = UtilitiesDAL.ToString(reader["CustomerString"]); obx.ObservationId = UtilitiesDAL.ToString(reader["OBXID"]); obx.ObservationIdText = UtilitiesDAL.ToString(reader["OBXIDTEXT"]); obx.ResultData = UtilitiesDAL.ToString(reader["OBXRESULT"]); obx.ResultUnits = UtilitiesDAL.ToString(reader["OBXUNITS"]); obx.ReferenceRange = UtilitiesDAL.ToString(reader["OBXREFRANGE"]); obx.TestId = UtilitiesDAL.ToInt(reader["TestID"]); obx.TestNormalRange = UtilitiesDAL.ToString(reader["NormalRange"]); obx.TestNormalRangeFemale = UtilitiesDAL.ToString(reader["NormalRangeF"]); obx.InternalPatientId = UtilitiesDAL.ToString(reader["PIDINTERNALPATIENTID"]); obx.SSN = GetSSN(reader); obx.LastName = UtilitiesDAL.ToString(reader["PIDLASTNAME"]); obx.FirstName = UtilitiesDAL.ToString(reader["PIDFIRSTNAME"]); obx.MiddleName = UtilitiesDAL.ToString(reader["PIDMIDDLENAME"]); obx.DOB = UtilitiesDAL.ToString(reader["PIDDOB"]); obx.Gender = UtilitiesDAL.ToString(reader["PIDGENDER"]); obx.StreetAddress = UtilitiesDAL.ToString(reader["PIDSTREET"]); obx.OtherAddress = UtilitiesDAL.ToString(reader["PIDOTHER"]); obx.City = UtilitiesDAL.ToString(reader["PIDCITY"]); obx.State = UtilitiesDAL.ToString(reader["PIDSTATE"]); obx.Zip = UtilitiesDAL.ToString(reader["PIDZIP"]); obx.DataLoadMismatchTestID = 0; obx.DataLoadValueErrorID = 0; SpecialObxSetup(obx, reader); obxList.Add(obx); } reader.Close(); FillInUserIdFields(obxList); return(obxList); }
private void SpecialObxSetup(Observation obx, SqlDataReader reader) { // Create the UserCN (username) that is used to identify the user for each observation string firstNameFirstLetter = (obx.FirstName.Length > 0) ? obx.FirstName.Substring(0, 1) : ""; string lastName = obx.LastName; string lastFourOfSSN = (obx.SSN.Length == 9) ? obx.SSN.Substring(5, 4) : "XXXX"; obx.UserCN = firstNameFirstLetter + lastName + lastFourOfSSN; // Extract the actual date part of the message date field string messageDateStringRaw = UtilitiesDAL.ToString(reader["EntryDate"]); string messageDateString = ""; foreach (char ch in messageDateStringRaw.ToCharArray()) { if (!char.IsDigit(ch)) { break; } messageDateString += ch; } DateTime messageDateTime; if (!DateTime.TryParseExact(messageDateString, DateFormats, new CultureInfo("en-US"), DateTimeStyles.None, out messageDateTime)) { messageDateTime = DateTime.Now; } obx.EntryDate = messageDateTime; int firstComponentSeparatorPosition = obx.ResultData.IndexOf('^'); if (firstComponentSeparatorPosition > -1) { obx.ResultData = obx.ResultData.Substring(0, firstComponentSeparatorPosition); } // Use the replacement value, if given if (obx.DataLoadValueErrorID > 0 && obx.ReplacementValue != null) { obx.ResultData = obx.ReplacementValue; } }
public int InsertDataLoadMismatchTest(Observation obx, int dataLoadMismatchId) { int newDataLoadMismatchTestId = 0; SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = SqlConnectionMain; cmd.CommandText = "InsertDataLoadMismatchTest"; cmd.Parameters.Clear(); cmd.Parameters.Add(new SqlParameter("@DataLoadMismatchID", dataLoadMismatchId)); cmd.Parameters.Add(new SqlParameter("@MatchedToTestID", (obx.TestId == 0) ? (object)DBNull.Value : obx.TestId)); cmd.Parameters.Add(new SqlParameter("@ObservationID", obx.ObservationId)); cmd.Parameters.Add(new SqlParameter("@ObservationTestMismatch", obx.TestId == 0)); reader = cmd.ExecuteReader(); if (reader.Read()) { newDataLoadMismatchTestId = Convert.ToInt32(reader.GetValue(0)); } reader.Close(); return newDataLoadMismatchTestId; }
private void GetUserIdBasedOnUserCN(Observation obx) { int censusUserId = 0; string censusGender = ""; DateTime censusDOB = new DateTime(); SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = SqlConnectionMain; // Get the matching UserId for the UserCN in the current observation cmd.CommandText = "GetUserIdBasedOnUserCN"; if (UserCNCache.Keys.Contains(obx.UserCN)) { Logger.LogLine("Found " + obx.UserCN + " in the cache"); obx.UserId = UserCNCache[obx.UserCN]; } else { cmd.Parameters.Clear(); cmd.Parameters.Add(new SqlParameter("@UserCN", obx.UserCN)); reader = cmd.ExecuteReader(); if (reader.Read()) { censusUserId = UtilitiesDAL.ToInt(reader["UserID"]); censusGender = UtilitiesDAL.ToString(reader["Gender"]); censusDOB = UtilitiesDAL.ToDateTime(reader["DOB"]); } obx.UserId = censusUserId; UserCNCache[obx.UserCN] = censusUserId; Logger.LogLine("Added " + obx.UserCN + " to the cache"); if (censusUserId > 0 && !MatchOnGenderAndDOB(obx, censusGender, censusDOB)) { obx.UserId = 0; // Treat as if user was not found, due to gender/DOB mismatch } reader.Close(); } }
private bool MatchOnGenderAndDOB(Observation obx, string censusGender, DateTime censusDOB) { DateTime obxDOB; if (DateTime.TryParseExact(obx.DOB, DateFormats, new CultureInfo("en-US"), DateTimeStyles.None, out obxDOB)) { if (censusDOB.Date == obxDOB && censusGender.ToLower() == obx.Gender.ToLower()) { return true; } } return false; }
private void GetUserIdBasedOnSSN(Observation obx) { int censusUserId = 0; string censusGender = ""; DateTime censusDOB = new DateTime(); SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = SqlConnectionMain; // Get the matching UserId for the SSN in the current observation cmd.CommandText = "GetUserIdBasedOnSSN"; if (obx.SSN.Length < 9) { Logger.LogLine("SSN (" + obx.SSN + ") is not long enough"); obx.UserId = 0; } else if (SSNCache.Keys.Contains(obx.SSN)) { Logger.LogLine("Found " + obx.SSN + " in the cache"); obx.UserId = SSNCache[obx.SSN]; } else { try { cmd.Parameters.Clear(); cmd.Parameters.Add(new SqlParameter("@SSN", obx.SSN)); reader = cmd.ExecuteReader(); if (reader.Read()) { censusUserId = UtilitiesDAL.ToInt(reader["UserID"]); censusGender = UtilitiesDAL.ToString(reader["Gender"]); censusDOB = UtilitiesDAL.ToDateTime(reader["DOB"]); } obx.UserId = censusUserId; SSNCache[obx.SSN] = censusUserId; Logger.LogLine("Added " + obx.SSN + " to the cache"); if (censusUserId > 0 && !MatchOnGenderAndDOB(obx, censusGender, censusDOB)) { obx.UserId = 0; // Treat as if user was not found, due to gender/DOB mismatch } reader.Close(); } catch (Exception ex) { Logger.LogLine("Unexpected error when trying to process " + obx.SSN + " (" + ex.Message + ")"); } } }
public void UpdateProcessedObservationStatus(Observation obx, bool success, string message, int? mismatchForLaterResolution, int? valueErrorId) { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = SqlConnectionMain; // Add a new test result cmd.CommandText = "UpdateProcessedObservationStatus"; cmd.Parameters.Clear(); cmd.Parameters.Add(new SqlParameter("@MessageID", obx.MessageId)); cmd.Parameters.Add(new SqlParameter("@SequenceID", obx.SequenceId)); cmd.Parameters.Add(new SqlParameter("@Success", success)); cmd.Parameters.Add(new SqlParameter("@Message", message)); cmd.Parameters.Add(new SqlParameter("@DataLoadMismatchTestID", (success || !mismatchForLaterResolution.HasValue) ? (object)DBNull.Value : mismatchForLaterResolution.Value)); cmd.Parameters.Add(new SqlParameter("@DataLoadValueErrorID", valueErrorId.HasValue ? valueErrorId.Value : (object)DBNull.Value)); cmd.ExecuteNonQuery(); }
public void InsertUnmappedObservation(Observation obx) { SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = SqlConnectionMain; cmd.CommandText = "InsertUnmappedObservation"; cmd.Parameters.Clear(); cmd.Parameters.Add(new SqlParameter("@OBXID", obx.ObservationId)); reader = cmd.ExecuteReader(); reader.Close(); }
private int RecordMismatchForLaterResolution(Observation obx) { int mismatchId = DAL.GetExistingDataLoadMismatch(obx); if (mismatchId == 0) { mismatchId = DAL.InsertDataLoadMismatch(obx); } if (obx.TestId == 0) { DAL.InsertUnmappedObservation(obx); } return DAL.InsertDataLoadMismatchTest(obx, mismatchId); }
public void ProcessNameMismatch(Observation obx) { string messageString = "User " + obx.UserCN + " (" + obx.FirstName + " " + obx.LastName + ") was NOT found in our user database."; Logger.LogLine(messageString); int mismatchTestId = RecordMismatchForLaterResolution(obx); DAL.UpdateProcessedObservationStatus(obx, false, messageString, mismatchTestId, null); }
private int RecordValueErrorForLaterResolution(Observation obx) { return DAL.InsertDataLoadValueError(obx); }
public int InsertDataLoadMismatch(Observation obx) { int newDataLoadMismatchId = 0; SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = SqlConnectionMain; cmd.CommandText = "InsertDataLoadMismatch"; cmd.Parameters.Clear(); cmd.Parameters.Add(new SqlParameter("@LastName", obx.LastName)); cmd.Parameters.Add(new SqlParameter("@FirstName", obx.FirstName)); cmd.Parameters.Add(new SqlParameter("@Gender", obx.Gender)); cmd.Parameters.Add(new SqlParameter("@DateOfBirth", obx.DOB)); cmd.Parameters.Add(new SqlParameter("@SSN", obx.SSN)); cmd.Parameters.Add(new SqlParameter("@MatchedToUserID", (obx.UserId == 0) ? (object)DBNull.Value : obx.UserId)); cmd.Parameters.Add(new SqlParameter("@CustomerString", obx.CustomerString)); reader = cmd.ExecuteReader(); if (reader.Read()) { newDataLoadMismatchId = Convert.ToInt32(reader.GetValue(0)); } reader.Close(); return newDataLoadMismatchId; }
public void ProcessInvalidTestValue(Observation obx) { string messageString = "User " + obx.UserCN + " (" + obx.FirstName + " " + obx.LastName + ") found as user (" + obx.UserId + "), BUT the test result was NOT loaded, because it appears to be invalid based on the USHC test normal ranges (" + obx.TestId + ": " + obx.TestNormalRange + ", " + obx.TestNormalRangeFemale + ")."; Logger.LogLine(messageString); int valueErrorId = RecordValueErrorForLaterResolution(obx); DAL.UpdateProcessedObservationStatus(obx, false, messageString, null, valueErrorId); }
public int InsertDataLoadValueError(Observation obx) { int newDataLoadValueErrorId = 0; SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = SqlConnectionMain; cmd.CommandText = "InsertDataLoadValueError"; cmd.Parameters.Clear(); cmd.Parameters.Add(new SqlParameter("@SuppliedValue", obx.ResultData)); cmd.Parameters.Add(new SqlParameter("@ReferenceRange", obx.ReferenceRange)); cmd.Parameters.Add(new SqlParameter("@TestID", obx.TestId)); cmd.Parameters.Add(new SqlParameter("@TestNormalRange", obx.TestNormalRange)); cmd.Parameters.Add(new SqlParameter("@TestNormalRangeFemale", obx.TestNormalRangeFemale)); reader = cmd.ExecuteReader(); if (reader.Read()) { newDataLoadValueErrorId = Convert.ToInt32(reader.GetValue(0)); } reader.Close(); return newDataLoadValueErrorId; }
private int RecordValueErrorForLaterResolution(Observation obx) { return(DAL.InsertDataLoadValueError(obx)); }
public List<Observation> GetObservationList() { List<Observation> obxList = new List<Observation>(); SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = SqlConnectionMain; // Get previously processed observations that failed cmd.CommandText = "GetMessageObservationsFailed"; reader = cmd.ExecuteReader(); while (reader.Read()) { Observation obx = new Observation(); obx.MessageId = UtilitiesDAL.ToString(reader["MessageID"]); obx.SequenceId = UtilitiesDAL.ToInt(reader["SequenceID"]); obx.CustomerString = UtilitiesDAL.ToString(reader["CustomerString"]); obx.ObservationId = UtilitiesDAL.ToString(reader["OBXID"]); obx.ObservationIdText = UtilitiesDAL.ToString(reader["OBXIDTEXT"]); obx.ResultData = UtilitiesDAL.ToString(reader["OBXRESULT"]); obx.ResultUnits = UtilitiesDAL.ToString(reader["OBXUNITS"]); obx.ReferenceRange = UtilitiesDAL.ToString(reader["OBXREFRANGE"]); obx.TestId = UtilitiesDAL.ToInt(reader["TestID"]); obx.TestNormalRange = UtilitiesDAL.ToString(reader["NormalRange"]); obx.TestNormalRangeFemale = UtilitiesDAL.ToString(reader["NormalRangeF"]); obx.InternalPatientId = UtilitiesDAL.ToString(reader["PIDINTERNALPATIENTID"]); obx.SSN = GetSSN(reader); obx.LastName = UtilitiesDAL.ToString(reader["PIDLASTNAME"]); obx.FirstName = UtilitiesDAL.ToString(reader["PIDFIRSTNAME"]); obx.MiddleName = UtilitiesDAL.ToString(reader["PIDMIDDLENAME"]); obx.DOB = UtilitiesDAL.ToString(reader["PIDDOB"]); obx.Gender = UtilitiesDAL.ToString(reader["PIDGENDER"]); obx.StreetAddress = UtilitiesDAL.ToString(reader["PIDSTREET"]); obx.OtherAddress = UtilitiesDAL.ToString(reader["PIDOTHER"]); obx.City = UtilitiesDAL.ToString(reader["PIDCITY"]); obx.State = UtilitiesDAL.ToString(reader["PIDSTATE"]); obx.Zip = UtilitiesDAL.ToString(reader["PIDZIP"]); obx.DataLoadMismatchTestID = UtilitiesDAL.ToInt(reader["DataLoadMismatchTestID"]); obx.DataLoadValueErrorID = UtilitiesDAL.ToInt(reader["DataLoadValueErrorID"]); obx.ReplacementValue = UtilitiesDAL.ToNullableString(reader["ReplacementValue"]); SpecialObxSetup(obx, reader); obxList.Add(obx); } reader.Close(); // Get new never-before-processed observations cmd.CommandText = "GetMessageObservationsUnattempted"; reader = cmd.ExecuteReader(); while (reader.Read()) { Observation obx = new Observation(); obx.MessageId = UtilitiesDAL.ToString(reader["MessageID"]); obx.SequenceId = UtilitiesDAL.ToInt(reader["SequenceID"]); obx.CustomerString = UtilitiesDAL.ToString(reader["CustomerString"]); obx.ObservationId = UtilitiesDAL.ToString(reader["OBXID"]); obx.ObservationIdText = UtilitiesDAL.ToString(reader["OBXIDTEXT"]); obx.ResultData = UtilitiesDAL.ToString(reader["OBXRESULT"]); obx.ResultUnits = UtilitiesDAL.ToString(reader["OBXUNITS"]); obx.ReferenceRange = UtilitiesDAL.ToString(reader["OBXREFRANGE"]); obx.TestId = UtilitiesDAL.ToInt(reader["TestID"]); obx.TestNormalRange = UtilitiesDAL.ToString(reader["NormalRange"]); obx.TestNormalRangeFemale = UtilitiesDAL.ToString(reader["NormalRangeF"]); obx.InternalPatientId = UtilitiesDAL.ToString(reader["PIDINTERNALPATIENTID"]); obx.SSN = GetSSN(reader); obx.LastName = UtilitiesDAL.ToString(reader["PIDLASTNAME"]); obx.FirstName = UtilitiesDAL.ToString(reader["PIDFIRSTNAME"]); obx.MiddleName = UtilitiesDAL.ToString(reader["PIDMIDDLENAME"]); obx.DOB = UtilitiesDAL.ToString(reader["PIDDOB"]); obx.Gender = UtilitiesDAL.ToString(reader["PIDGENDER"]); obx.StreetAddress = UtilitiesDAL.ToString(reader["PIDSTREET"]); obx.OtherAddress = UtilitiesDAL.ToString(reader["PIDOTHER"]); obx.City = UtilitiesDAL.ToString(reader["PIDCITY"]); obx.State = UtilitiesDAL.ToString(reader["PIDSTATE"]); obx.Zip = UtilitiesDAL.ToString(reader["PIDZIP"]); obx.DataLoadMismatchTestID = 0; obx.DataLoadValueErrorID = 0; SpecialObxSetup(obx, reader); obxList.Add(obx); } reader.Close(); FillInUserIdFields(obxList); return obxList; }