private PatientInfo ParsePatientInfo(DataRow row, int rowIndex)
        {
            bool hasAtLeastOneFieldsFilled = false;

            for (int i = 0; i <= 6; i++)
            {
                if (!DBNull.Value.Equals(row[i]))
                {
                    hasAtLeastOneFieldsFilled = true;
                }
            }

            if (!hasAtLeastOneFieldsFilled)
            {
                return(null);
            }

            var patientNumber           = ParseInt(row[0]) ?? rowIndex;
            var gender                  = GenderParser.Parse(ToSafeText(row[1]));
            var age                     = ParseAge(row[2]);
            var domicile                = ToSafeText(row[3]);
            var infectionContact        = ToSafeText(row[4]);
            var hospitalizationLocation = ToSafeText(row[5]);

            (bool isCured, string healthObservation) = ParseHealthSate(row[6]);

            return(new PatientInfo
            {
                PatientNumber = patientNumber,
                Gender = gender,
                Domicile = domicile,
                InfectionContact = infectionContact,
                InfectionSourceType = InfectionSourceParser.Parse(infectionContact),
                Age = age,
                HospitalizationLocation = hospitalizationLocation,
                HealthState = healthObservation,
                IsCured = isCured,
                Condition = ConditionParser.Parse(isCured, hospitalizationLocation)
            });
        }
示例#2
0
        private PatientInfo ParsePatientInfo(DataRow row, int rowIndex)
        {
            bool hasAtLeastOneFieldsFilled = false;

            for (int i = 0; i <= 6; i++)
            {
                if (!DBNull.Value.Equals(row[i]))
                {
                    hasAtLeastOneFieldsFilled = true;
                }
            }

            if (!hasAtLeastOneFieldsFilled)
            {
                return(null);
            }

            var patientNumber = ParseInt(row[0]) ?? rowIndex;
            var gender        = GenderParser.Parse(TextNormalizer.ToSafeText(row[1]));
            var age           = AgeParser.Parse(TextNormalizer.ToSafeText(row[2]));

            var domicile         = TextNormalizer.ToSafeText(row[3]);
            var infectionContact = TextNormalizer.ToSafeText(row[4]);
            var confirmedOn      = DateParser.Parse(TextNormalizer.ToSafeText(row[5]));

            return(new PatientInfo
            {
                PatientNumber = patientNumber,
                Gender = gender,
                Domicile = domicile.ToUpper(),
                InfectionContact = infectionContact,
                InfectionSourceType = InfectionSourceParser.Parse(infectionContact),
                Age = age,
                ConfirmedOn = confirmedOn
            });
        }
示例#3
0
 public void ReturnCorrectSourceTypeForGivenText(string text, InfectionSourceType expectedInfectionSourceType)
 {
     InfectionSourceParser.Parse(text).ShouldBe(expectedInfectionSourceType);
 }