/// <summary> /// Initialize a new instance of type <see cref="TravelerJournal"/> with its <see langword="default"/> values /// </summary> /// <param name="_id"></param> public TravelerJournal(int?_id = null) : base(_id) { MenstrualInfo = new MenstrualCycleInfo(); WeightInfo = new WeightInfo(); HepB = new Screening(); AntiDImmunoglobulinGiven = new JournalData(); UrineCulture = new JournalData(); journalStamps = new List <JournalStamp> (); journalComments = new List <JournalComment> (); ultraSoundScans = new List <UltrasoundResult> (); OddsForDS = new JournalData(); PlacentaTest = new JournalData(); AmnioticFluidTest = new JournalData(); OralGlukoseToleranceTest = new OGTTScreening(); BirthplaceInfo = new BirthplaceInformation(); }
public TermData(MenstrualCycleInfo _mentrualInfo, DateTime _expectedBirthDate, string _comment) { MenstrualInfo = _mentrualInfo; ExpectedBirthDate = _expectedBirthDate; Comment = _comment; }
public override void BuildEntity(string _data) { string[] data = _data.Split(Environment.NewLine); if (data.Length - 1 == 6) { #region Core Journal data [Line 0] string[] coreJournalData = data[0].Split(","); if (int.TryParse(coreJournalData[0].Replace("JournalID", string.Empty), out int _id) && int.TryParse(coreJournalData[2], out int _journalDest)) { if (int.TryParse(coreJournalData[1].Replace("PatientID", string.Empty), out int _patientID)) { ID = _id; } else { Debug.LogWarning($"Invalid Journal ({ID}) build from storage; No Patient Attached!"); } JournalDestination = ( JournalDest )_journalDest; PatientData = PatientRepo.Link.GetDataByIdentifier(_patientID); JournalDestination = ( JournalDest )_journalDest; } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 0 ] ?? "Null" )}"); } #endregion if (PatientData != null) { #region Pregnancy History Record [Line 1] string[] pEntries = data[1].Split(COLITEMSEPERATOR); foreach (string pEntryDataStream in pEntries) { string[] pEntryData = pEntryDataStream.Split(","); if (pEntryDataStream != string.Empty) { if (pEntryData.Length == 10 && bool.TryParse(pEntryData[0], out bool _bornAlive) && bool.TryParse(pEntryData[3], out bool _male) && int.TryParse(pEntryData[5], out int _pregnancyExperience) && bool.TryParse(pEntryData[7], out bool _stillBorn) && double.TryParse(pEntryData[8], NumberStyles.AllowDecimalPoint, new CultureInfo("en-US"), out double _weight) && int.TryParse(pEntryData[9], out int _year)) { PregnancyHistoryEntry pEntry = new PregnancyHistoryEntry() { BornAlive = _bornAlive, CurrentStatusOfChild = pEntryData[1].Replace(COMMAIDENTIFIER, ","), GestationAge = pEntryData[2].Replace(COMMAIDENTIFIER, ","), Male = _male, PlaceOfBirth = pEntryData[4].Replace(COMMAIDENTIFIER, ","), PregnancyExperience = ( Experience )_pregnancyExperience, PregnancyProgress = pEntryData[6].Replace(COMMAIDENTIFIER, ","), StillBorn = _stillBorn, Weight = _weight, Year = _year }; Pregnancies.AddHistory(pEntry); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 1 ] ?? "Null" )}"); } } } #endregion #region Abortion History Record [Line 2] string[] aEntries = data[2].Split(COLITEMSEPERATOR); foreach (string aEntryDataStream in aEntries) { string[] aEntryData = aEntryDataStream.Split(","); if (aEntryDataStream != string.Empty) { if (aEntryData.Length == 3 && int.TryParse(aEntryData[2], out int _year)) { AbortionHistoryEntry aEntry = new AbortionHistoryEntry() { PlannedAbortionGA = aEntryData[0].Replace(COMMAIDENTIFIER, ","), UnplannedAbortionGA = aEntryData[1].Replace(COMMAIDENTIFIER, ","), Year = _year }; Abortions.AddHistory(aEntry); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 2 ] ?? "Null" )}"); } } } #endregion #region Anamnese [Line 3] string[] anamDataStream = data[3].Split(OBJECTSEPERATOR); if (anamDataStream.Length == 14) { #region Alcohol History [Line 0] string[] alcoHistoryStream = anamDataStream[0].Split(","); if (alcoHistoryStream.Length == 3 && int.TryParse(alcoHistoryStream[0], out int _amountPrWeek) && bool.TryParse(alcoHistoryStream[1], out bool _duringPregnancy) && bool.TryParse(alcoHistoryStream[2], out bool _multiplePrSession)) { Anamnese.AlcoholInfo = new AlcoholHistory(_duringPregnancy, _amountPrWeek, _multiplePrSession); } else { throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 0 ] ?? "Null" )}"); } #endregion #region Allergies [Line 1] string[] allergyStream = anamDataStream[1].Split(","); if (allergyStream.Length == 2 && int.TryParse(allergyStream[1], out int _childAllergyRisk)) { Anamnese.Allergies = new AllergyAssessement(allergyStream[0].Replace(COMMAIDENTIFIER, ","), ( ChildDisposedAllergy )_childAllergyRisk); } else { throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 1 ] ?? "Null" )}"); } #endregion #region Chronic Medical Data [Line 2] string[] chronicDataStream = anamDataStream[2].Split(","); if (chronicDataStream.Length == 8 && bool.TryParse(chronicDataStream[0], out bool _airways) && bool.TryParse(chronicDataStream[1], out bool _circulation) && bool.TryParse(chronicDataStream[2], out bool _diabetes) && bool.TryParse(chronicDataStream[3], out bool _epilepsy) && bool.TryParse(chronicDataStream[4], out bool _herpesGenitalis) && bool.TryParse(chronicDataStream[5], out bool _psychologicalIllness) && bool.TryParse(chronicDataStream[6], out bool _recurrentUTI) && bool.TryParse(chronicDataStream[7], out bool _thyroidea)) { Anamnese.ChronicMedicalData = new ChronicMedicalHistory(_circulation, _airways, _thyroidea, _diabetes, _epilepsy, _psychologicalIllness, _herpesGenitalis, _recurrentUTI); } else { throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 2 ] ?? "Null" )}"); } #endregion Anamnese.DietAndActivity = anamDataStream[3].Replace(COMMAIDENTIFIER, ","); #region Fertility Info [Line 4] string[] fertilityStream = anamDataStream[4].Split(","); if (fertilityStream.Length == 2 && bool.TryParse(fertilityStream[0], out bool _recievedFertilityTreatment)) { Anamnese.FertilityInfo = new FertilityTreatmentData(_recievedFertilityTreatment, fertilityStream[1].Replace(COMMAIDENTIFIER, ",")); } else { throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 4 ] ?? "Null" )}"); } #endregion Anamnese.Medicin = anamDataStream[5].Replace(COMMAIDENTIFIER, ","); #region MMR Vaccinated [Line 6] if (int.TryParse(anamDataStream[6], out int _mMRVaccinated)) { Anamnese.MMRVaccinated = ( MMRVaccinationStatus )_mMRVaccinated; } else { throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 6 ] ?? "Null" )}"); } #endregion #region Other Drugs [Line 7] if (bool.TryParse(anamDataStream[7], out bool _otherDrugs)) { Anamnese.OtherDrugs = _otherDrugs; } else { throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 7 ] ?? "Null" )}"); } #endregion Anamnese.OtherDrugsComment = anamDataStream[8].Replace(COMMAIDENTIFIER, ","); Anamnese.PastAdmittance = anamDataStream[9].Replace(COMMAIDENTIFIER, ","); #region Risk Assessement [Line 10] string[] riskStream = anamDataStream[10].Split(","); if (riskStream.Length == 5 && bool.TryParse(riskStream[0], out bool _doubleTestTaken) && bool.TryParse(riskStream[2], out bool _requestedMalformationScan) && bool.TryParse(riskStream[3], out bool _requestedNuchalFoldScan) && bool.TryParse(riskStream[4], out bool _tripleTestTaken)) { Anamnese.RiskAssessment = new PrenatalRiskAssessment(riskStream[1].Replace(COMMAIDENTIFIER, ","), _doubleTestTaken, _tripleTestTaken, _requestedNuchalFoldScan, _requestedMalformationScan); } else { throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 10 ] ?? "Null" )}"); } #endregion #region Term Data [Line 11] string[] termStream = anamDataStream[11].Split(","); if (termStream.Length == 3 && DateTime.TryParse(termStream[1], out DateTime _expectedBirthDate)) { #region Menstrual Cycle Info [Line 0] string[] mensInfoStream = termStream[0].Split(COLITEMSEPERATOR); MenstrualCycleInfo mensInfo; if (bool.TryParse(mensInfoStream[0], out bool _isCalculationSafe) && DateTime.TryParse(mensInfoStream[1], out DateTime _lastMenstrualDay)) { mensInfo = new MenstrualCycleInfo(_lastMenstrualDay, mensInfoStream[2].Replace(COMMAIDENTIFIER, ","), _isCalculationSafe); } else { throw new Exception($"One or more fields couldn't be retrived from (Term Data): { ( termStream[ 0 ] ?? "Null" )}"); } #endregion Anamnese.TermInfo = new TermData(mensInfo, _expectedBirthDate, termStream[2].Replace(COMMAIDENTIFIER, ",")); } else { throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 11 ] ?? "Null" )}"); } #endregion #region TobaccoInfo [Line 12] string[] tobaccoStream = anamDataStream[12].Split(","); if (tobaccoStream.Length == 4 && int.TryParse(tobaccoStream[0], out int _amountPrDay) && DateTime.TryParse(tobaccoStream[1], out DateTime _quitDate) && bool.TryParse(tobaccoStream[2], out bool _requestedRehab) && bool.TryParse(tobaccoStream[3], out bool _smoker)) { Anamnese.TobaccoInfo = new TobaccoHistory(_smoker, _amountPrDay, _quitDate, _requestedRehab); } else { throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 12 ] ?? "Null" )}"); } #endregion #region WorkEnvironment [Line 13] string[] environmentStream = anamDataStream[13].Split(","); if (environmentStream.Length >= 8 && bool.TryParse(environmentStream[1], out bool _leaveNotification) && bool.TryParse(environmentStream[3], out bool _partialLeaveNotification) && bool.TryParse(environmentStream[4], out bool _referedToOMClinic) && int.TryParse(environmentStream[6], out int _workHoursPrWeek)) { Anamnese.WorkEnvironment.FathersWorkPosition = environmentStream[0].Replace(COMMAIDENTIFIER, ","); Anamnese.WorkEnvironment.LeaveNotification = _leaveNotification; Anamnese.WorkEnvironment.NatureAndPeriod = environmentStream[2].Replace(COMMAIDENTIFIER, ","); Anamnese.WorkEnvironment.PartialLeaveNotification = _partialLeaveNotification; Anamnese.WorkEnvironment.ReferedToOMClinic = _referedToOMClinic; #region WorkEnvironment flag build [Line 5] string[] environmentflags = environmentStream[5].Split(COLITEMSEPERATOR); for (int i = 0; i < environmentflags.Length; i++) { if (int.TryParse(environmentflags[i], out int _flag)) { Anamnese.WorkEnvironment.WorkEnvironments[i] = ( WorkEnvironment )_flag; } else { throw new Exception($"One or more fields couldn't be retrived from (Environment Flags): { ( environmentStream[ 5 ] ?? "Null" )}"); } } #endregion Anamnese.WorkEnvironment.WorkHoursPrWeek = _workHoursPrWeek; Anamnese.WorkEnvironment.WorkPosition = environmentStream[7].Replace(COMMAIDENTIFIER, ","); } else { throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 13 ] ?? "Null" )}"); } #endregion } else { throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( data[ 3 ] ?? "Null" )}"); } #endregion #region Investigations [Line 4] string[] investigationStream = data[4].Split(OBJECTSEPERATOR); if (investigationStream.Length == 9) { #region Clamydia Data [Line 0] string[] claDataStream = investigationStream[0].Split(","); if (DateTime.TryParse(claDataStream[0], out DateTime _claDate) && int.TryParse(claDataStream[1], out int _claResult)) { Investegations.Clamydia = new Screening(_claDate, ( ScreeningInfo )_claResult); } else { throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 0 ] ?? "Null" )}"); } #endregion #region DVataminReadingDate Data [Line 1] if (DateTime.TryParse(investigationStream[1], out DateTime _dVatDate)) { Investegations.DVataminReadingDate = _dVatDate; } else { throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 1 ] ?? "Null" )}"); } #endregion Investegations.DVataminReadingResult = investigationStream[2].Replace(COMMAIDENTIFIER, ","); #region Gonore Data [Line 3] string[] gonDataStream = investigationStream[3].Split(","); if (DateTime.TryParse(gonDataStream[0], out DateTime _gonDate) && int.TryParse(gonDataStream[1], out int _gonResult)) { Investegations.Gonorrhea = new Screening(_gonDate, ( ScreeningInfo )_gonResult); } else { throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 3 ] ?? "Null" )}"); } #endregion #region Hemoglobinopathy Data [Line 4] string[] hemDataStream = investigationStream[0].Split(","); if (DateTime.TryParse(hemDataStream[0], out DateTime _hemDate) && int.TryParse(hemDataStream[1], out int _hemResult)) { Investegations.Hemoglobinopathy = new Screening(_hemDate, ( ScreeningInfo )_hemResult); } else { throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 4 ] ?? "Null" )}"); } #endregion #region HepB Data [Line 5] string[] hepDataStream = investigationStream[5].Split(","); if (DateTime.TryParse(hepDataStream[0], out DateTime _hepDate) && int.TryParse(hepDataStream[1], out int _hepResult)) { Investegations.HepB = new Screening(_hepDate, ( ScreeningInfo )_hepResult); } else { throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 5 ] ?? "Null" )}"); } #endregion #region HIV Data [Line 6] string[] hivDataStream = investigationStream[6].Split(","); if (DateTime.TryParse(hivDataStream[0], out DateTime _hivDate) && int.TryParse(hivDataStream[1], out int _hivResult)) { Investegations.HIV = new Screening(_hivDate, ( ScreeningInfo )_hivResult); } else { throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 6 ] ?? "Null" )}"); } #endregion #region Syphilis Data [Line 7] string[] sypDataStream = investigationStream[7].Split(","); if (DateTime.TryParse(sypDataStream[0], out DateTime _sypDate) && int.TryParse(sypDataStream[1], out int _sypResult)) { Investegations.Clamydia = new Screening(_sypDate, ( ScreeningInfo )_sypResult); } else { throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 7 ] ?? "Null" )}"); } #endregion } else { throw new Exception($"One or more fields couldn't be retrived from (Investigation): { ( data[ 4 ] ?? "Null" )}"); } #endregion #region Resource and Risk Assessement [Line 5] string[] resAndRiskStream = data[5].Split(","); if (bool.TryParse(resAndRiskStream[1], out bool _needObstetricAssessement) && bool.TryParse(resAndRiskStream[2], out bool _needSocialAndHealthAdministration) && int.TryParse(resAndRiskStream[3], out int _niveauDistrubution)) { ResAndRiskAssessement.Assessment = resAndRiskStream[0].Replace(COMMAIDENTIFIER, ","); ResAndRiskAssessement.NeedObstetricAssessement = _needObstetricAssessement; ResAndRiskAssessement.NeedSocialAndHealthAdministration = _needSocialAndHealthAdministration; ResAndRiskAssessement.NiveauDistrubution = ( NiveauDist )_niveauDistrubution; ResAndRiskAssessement.ObstetricAssessmentNote = resAndRiskStream[4].Replace(COMMAIDENTIFIER, ","); ResAndRiskAssessement.SocialAndHealthAdministrationNote = resAndRiskStream[5].Replace(COMMAIDENTIFIER, ","); } else { throw new Exception($"One or more fields couldn't be retrived from (Resource and Risk Assessement): { ( data[ 5 ] ?? "Null" )}"); } #endregion } else { try { throw new Exception($"No Patient found!"); } catch (Exception _e) { Debug.LogWarning(_e.ToString()); } } return; } throw new Exception($"One or more fields couldn't be retrived from: { ( _data ?? "Null" )}"); }
public override void BuildEntity(string _data) { string[] data = _data.Split(Environment.NewLine); if (data.Length - 1 == 19) { #region Core Journal data [Line 0] string[] coreJournalData = data[0].Split(","); if (int.TryParse(coreJournalData[0].Replace("JournalID", string.Empty), out int _id) && int.TryParse(coreJournalData[2], out int _journalDest)) { if (int.TryParse(coreJournalData[1].Replace("PatientID", string.Empty), out int _patientID)) { ID = _id; } else { Debug.LogWarning($"Invalid Journal ({ID}) build from storage; No Patient Attached!"); } PatientData = PatientRepo.Link.GetDataByIdentifier(_patientID); JournalDestination = ( JournalDest )_journalDest; } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 0 ] ?? "Null" )}"); } #endregion #region MenstrualInfo [Line 1] string[] mensStream = data[1].Split(","); if (mensStream.Length == 3 && DateTime.TryParse(mensStream[1], out DateTime _date) && bool.TryParse(mensStream[0], out bool _isCalculationSafe)) { MenstrualInfo = new MenstrualCycleInfo(_date, mensStream[2].Replace(COMMAIDENTIFIER, ","), _isCalculationSafe); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 1 ] ?? "Null" )}"); } #endregion #region NaegelsRule & UltraSoundTermin [Line 2] string[] dateDataStream = data[2].Split(","); if (dateDataStream.Length == 2 && DateTime.TryParse(dateDataStream[0], out DateTime _naegelsRule) && DateTime.TryParse(dateDataStream[1], out DateTime _ultraSoundTermin)) { NaegelsRule = _naegelsRule; UltrasoundTermin = _ultraSoundTermin; } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 2 ] ?? "Null" )}"); } #endregion #region WeightInfo [Line 3] string[] weightStream = data[3].Split(","); if (weightStream.Length == 3 && double.TryParse(weightStream[0], out double _weightbeforePregnancy) && double.TryParse(weightStream[1], out double _height) && double.TryParse(weightStream[2], out double _bmi)) { WeightInfo = new WeightInfo(_weightbeforePregnancy, _height, _bmi); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 3 ] ?? "Null" )}"); } #endregion #region Rhesus Values [Line 4] string[] rhesusStream = data[4].Split(","); if (rhesusStream.Length == 2 && bool.TryParse(rhesusStream[0], out bool _mothersRhesusFactor) && bool.TryParse(rhesusStream[1], out bool _childsRhesusFactor)) { MothersRhesusFactor = _mothersRhesusFactor; ChildsRhesusFactor = _childsRhesusFactor; } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 4 ] ?? "Null" )}"); } #endregion #region HepB [Line 5] string[] hepBStream = data[5].Split(","); if (hepBStream.Length == 2 && DateTime.TryParse(hepBStream[0], out DateTime _hepBDate) && int.TryParse(hepBStream[1], out int _result)) { HepB = new Screening(_hepBDate, ( ScreeningInfo )_result); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 5 ] ?? "Null" )}"); } #endregion #region BloodtypeDetermined, AntibodyRhesusNegative & IrregularAntibody [Line 6] string[] antibodyDataStream = data[6].Split(","); if (antibodyDataStream.Length == 3 && bool.TryParse(antibodyDataStream[0], out bool _bloodTypeDetermined) && bool.TryParse(antibodyDataStream[0], out bool _antibodyRhesusNegative) && bool.TryParse(antibodyDataStream[0], out bool _irregularAntibody)) { BloodTypeDetermined = _bloodTypeDetermined; AntibodyByRhesusNegative = _antibodyRhesusNegative; IrregularAntibody = _irregularAntibody; } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 6 ] ?? "Null" )}"); } #endregion #region AntiDImmunoglobulinGiven [Line 7] string[] antiDStream = data[7].Split(","); if (antiDStream.Length == 3 && DateTime.TryParse(antiDStream[0], out DateTime _antiDDate)) { AntiDImmunoglobulinGiven = new JournalData(_antiDDate, antiDStream[1].Replace(COMMAIDENTIFIER, ","), antiDStream[2].Replace(COMMAIDENTIFIER, ",")); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 7 ] ?? "Null" )}"); } #endregion #region UrinCulture [Line 8] string[] urinCultureStream = data[8].Split(","); if (urinCultureStream.Length == 3 && DateTime.TryParse(urinCultureStream[0], out DateTime _urinCulturedate)) { UrineCulture = new JournalData(_urinCulturedate, urinCultureStream[1].Replace(COMMAIDENTIFIER, ","), urinCultureStream[2].Replace(COMMAIDENTIFIER, ",")); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 8 ] ?? "Null" )}"); } #endregion #region journalStamps [Line 9] string[] stampsStream = data[9].Split(COLITEMSEPERATOR); if (stampsStream != null && !string.IsNullOrWhiteSpace(stampsStream[0])) { foreach (string stampData in stampsStream) { string[] stampDataStream = stampData.Split(","); if (stampDataStream.Length == 12 && DateTime.TryParse(stampDataStream[1], out DateTime _stampDate) && bool.TryParse(stampDataStream[2], out bool _edema) && bool.TryParse(stampDataStream[4], out bool _fetusActivity) && double.TryParse(stampDataStream[10], NumberStyles.AllowDecimalPoint, new CultureInfo("en-US"), out double _uterusSizeInCM) && double.TryParse(stampDataStream[11], NumberStyles.AllowDecimalPoint, new CultureInfo("en-US"), out double _weight)) { JournalStamp stamp = new JournalStamp() { BloodPressure = stampDataStream[0].Replace(COMMAIDENTIFIER, ","), Date = _stampDate, Edema = _edema, ExaminationLocation = stampDataStream[3].Replace(COMMAIDENTIFIER, ","), FetusActivity = _fetusActivity, FetusGender = stampDataStream[5].Replace(COMMAIDENTIFIER, ","), FosterRepresentation = stampDataStream[6].Replace(COMMAIDENTIFIER, ","), GestationAge = stampDataStream[7].Replace(COMMAIDENTIFIER, ","), Initials = stampDataStream[8].Replace(COMMAIDENTIFIER, ","), UrinSample = stampDataStream[9].Replace(COMMAIDENTIFIER, ","), UterusSizeInCM = _uterusSizeInCM, Weight = _weight }; AddJournalStamp(stamp); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( stampData ?? "Null" )}"); } } } #endregion #region JournalComments [Line 10] string[] commentsStream = data[10].Split(COLITEMSEPERATOR); if (commentsStream != null && !string.IsNullOrWhiteSpace(commentsStream[0])) { foreach (string commentData in commentsStream) { string[] commentDataStream = commentData.Split(","); if (commentDataStream.Length == 2 && DateTime.TryParse(commentDataStream[1], out DateTime _commentDate)) { JournalComment comment = new JournalComment() { Comment = commentDataStream[0].Replace(COMMAIDENTIFIER, ","), Date = _commentDate }; AddJournalComment(comment); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( commentData ?? "Null" )}"); } } } #endregion #region UltraSoundScans [Line 11] string[] ultraStream = data[11].Split(COLITEMSEPERATOR); if (ultraStream != null && !string.IsNullOrWhiteSpace(ultraStream[0])) { foreach (string ultraData in ultraStream) { string[] ultraDataStream = ultraData.Split(","); if (ultraDataStream.Length == 9 && double.TryParse(ultraDataStream[0], NumberStyles.AllowDecimalPoint, new CultureInfo("en-US"), out double _amnioticFluidAmount) && DateTime.TryParse(ultraDataStream[1], out DateTime _ultraResultDate) && double.TryParse(ultraDataStream[7], NumberStyles.AllowDecimalPoint, new CultureInfo("en-US"), out double _usWeight) && double.TryParse(ultraDataStream[8], NumberStyles.AllowDecimalPoint, new CultureInfo("en-US"), out double _weightDifference)) { UltrasoundResult ultraSoundScan = new UltrasoundResult() { AmnioticFluidAmount = _amnioticFluidAmount, Date = _ultraResultDate, ExaminationLocation = ultraDataStream[2].Replace(COMMAIDENTIFIER, ","), Flow = ultraDataStream[3].Replace(COMMAIDENTIFIER, ","), FosterRepresentation = ultraDataStream[4].Replace(COMMAIDENTIFIER, ","), GestationAge = ultraDataStream[5].Replace(COMMAIDENTIFIER, ","), Initials = ultraDataStream[6].Replace(COMMAIDENTIFIER, ","), USWeight = _usWeight, WeightDifference = _weightDifference }; AddUltraSoundScan(ultraSoundScan); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( ultraData ?? "Null" )}"); } } } #endregion #region NuchalFoldScan, DoubleTest & TripleTest [Line 12] string[] testData = data[12].Split(","); if (testData.Length == 3 && DateTime.TryParse(testData[0], out DateTime _nuchalFoldScan) && DateTime.TryParse(testData[1], out DateTime _doubleTest) && DateTime.TryParse(testData[2], out DateTime _tripleTest)) { NuchalFoldScan = _nuchalFoldScan; DoubleTest = _doubleTest; TripleTest = _tripleTest; } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 12 ] ?? "Null" )}"); } #endregion #region OddsForDS [Line 13] string[] oddsForDSStream = data[13].Split(","); if (oddsForDSStream.Length == 3 && DateTime.TryParse(oddsForDSStream[0], out DateTime _oddsForDSDate)) { OddsForDS = new JournalData(_oddsForDSDate, oddsForDSStream[1].Replace(COMMAIDENTIFIER, ","), oddsForDSStream[2].Replace(COMMAIDENTIFIER, ",")); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 13 ] ?? "Null" )}"); } #endregion #region PlacentaTest [Line 14] string[] placentaTestStream = data[14].Split(","); if (placentaTestStream.Length == 3 && DateTime.TryParse(placentaTestStream[0], out DateTime _placentaTestSDate)) { PlacentaTest = new JournalData(_placentaTestSDate, placentaTestStream[1].Replace(COMMAIDENTIFIER, ","), placentaTestStream[2].Replace(COMMAIDENTIFIER, ",")); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 14 ] ?? "Null" )}"); } #endregion #region AmnioticFluidTest [Line 15] string[] amnioticFluidTestStream = data[15].Split(","); if (amnioticFluidTestStream.Length == 3 && DateTime.TryParse(amnioticFluidTestStream[0], out DateTime _amnioticFluidTestSDate)) { AmnioticFluidTest = new JournalData(_amnioticFluidTestSDate, amnioticFluidTestStream[1].Replace(COMMAIDENTIFIER, ","), amnioticFluidTestStream[2].Replace(COMMAIDENTIFIER, ",")); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 15 ] ?? "Null" )}"); } #endregion #region OralGlukoseToleranceTest [Line 16] string[] oralGTTStream = data[16].Split(OBJECTSEPERATOR); if (oralGTTStream.Length == 3) { #region Glycosuria [Line 0] JournalData glycosuria; JournalData week18_20; JournalData week28_30; string[] glycosuriaStream = oralGTTStream[0].Split(","); if (glycosuriaStream.Length == 3 && DateTime.TryParse(glycosuriaStream[0], out DateTime _glycosuriaStreamDate)) { glycosuria = new JournalData(_glycosuriaStreamDate, glycosuriaStream[1].Replace(COMMAIDENTIFIER, ","), glycosuriaStream[2].Replace(COMMAIDENTIFIER, ",")); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( oralGTTStream[ 0 ] ?? "Null" )}"); } #endregion #region Week18_20 [Line 1] string[] week18_20Stream = oralGTTStream[1].Split(","); if (week18_20Stream.Length == 3 && DateTime.TryParse(week18_20Stream[0], out DateTime _week18_20StreamDate)) { week18_20 = new JournalData(_week18_20StreamDate, week18_20Stream[1].Replace(COMMAIDENTIFIER, ","), week18_20Stream[2].Replace(COMMAIDENTIFIER, ",")); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( oralGTTStream[ 1 ] ?? "Null" )}"); } #endregion #region Week28_30 [Line 2] string[] week28_30Stream = oralGTTStream[2].Split(","); if (week28_30Stream.Length == 3 && DateTime.TryParse(week28_30Stream[0], out DateTime _Week28_30Date)) { week28_30 = new JournalData(_Week28_30Date, week28_30Stream[1].Replace(COMMAIDENTIFIER, ","), week28_30Stream[2].Replace(COMMAIDENTIFIER, ",")); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( oralGTTStream[ 2 ] ?? "Null" )}"); } #endregion OralGlukoseToleranceTest = new OGTTScreening(glycosuria, week18_20, week28_30); } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 16 ] ?? "Null" )}"); } #endregion #region AdditonalContext [Line 17] AdditonalContext = data[17].Replace(COMMAIDENTIFIER, ","); #endregion #region BirthplaceInfo [Line 18] string[] birthPlaceInfoStream = data[18].Split(","); if (bool.TryParse(birthPlaceInfoStream[1], out bool _birthWish) && int.TryParse(birthPlaceInfoStream[3], out int _conFormat)) { BirthplaceInfo = new BirthplaceInformation() { BirthplaceWish = birthPlaceInfoStream[0].Replace(COMMAIDENTIFIER, ","), BirthPreperationWish = _birthWish, ChangedBirthplace = birthPlaceInfoStream[2].Replace(COMMAIDENTIFIER, ","), ConFormat = ( ConsultationFormat )_conFormat, MidwifeCenterCity = birthPlaceInfoStream[4].Replace(COMMAIDENTIFIER, ","), MidwifeCenterHouseNumber = birthPlaceInfoStream[5].Replace(COMMAIDENTIFIER, ","), MidwifeCenterName = birthPlaceInfoStream[6].Replace(COMMAIDENTIFIER, ","), MidwifeCenterPhone = birthPlaceInfoStream[7].Replace(COMMAIDENTIFIER, ","), MidwifeCenterPostalCode = birthPlaceInfoStream[8].Replace(COMMAIDENTIFIER, ","), MidwifeCenterStreet = birthPlaceInfoStream[9].Replace(COMMAIDENTIFIER, ","), MidwifeConsultationWish = birthPlaceInfoStream[10].Replace(COMMAIDENTIFIER, ","), PrimaryExpectedBirthplace = birthPlaceInfoStream[11].Replace(COMMAIDENTIFIER, ",") }; } else { throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 18 ] ?? "Null" )}"); } #endregion } else { throw new Exception($"One or more fields couldn't be retrived from: { ( _data ?? "Null" )}"); } }