Exemplo n.º 1
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
            });
        }
Exemplo n.º 2
0
 public void Parse_age_correctly(string text, int?expectedMap)
 {
     AgeParser.Parse(text).ShouldBe(expectedMap);
 }