getMenstrualCycleSummary method
get matrix summary data btn two date
Implementation
Future<Map<String, dynamic>> getMenstrualCycleSummary(
{DateTime? summaryStartDate,
DateTime? summaryEndDate,
bool fetchAllData = false}) async {
int currentDayCycle = await getCurrentCycleDay();
int avgPeriodDuration = await getAvgPeriodDuration();
int avgCycleLength = await getAvgCycleLength();
bool isPeriodStart = await isPeriodStarted();
int periodDay = await getCurrentPeriodDay();
bool ovulationDay = await isOvulationDay();
int prevPeriodDuration = await getPreviousPeriodDuration();
int prevCycleLength = await getPreviousCycleLength();
double cycleCRS = await getCycleRegularityScore();
String cycleCRSStatus = await getCycleRegularityScoreStatus();
double periodPRS = await getPeriodRegularityScore();
String periodPRSStatus = await getPeriodRegularityScoreStatus();
String nextPeriodDay = await getNextPredictedPeriodDate();
String nextOvulationDate = await getNextOvulationDate();
bool periodStartFromToday = await isPeriodStartFromToday();
bool periodStartFromTomorrow = await isPeriodStartFromTomorrow();
List<SymptomsCount> todaySymptomsData = await getSymptomsPattern();
List<SymptomsCount> tomorrowSymptomsData =
await getSymptomsPattern(isForTomorrow: true);
String currentPhase = await getCurrentPhaseName();
Map<String, dynamic> summaryData = {
"key_matrix": {
"current_day_cycle": currentDayCycle,
"current_phase": currentPhase,
"avg_cycle_length": avgCycleLength,
"avg_period_duration": avgPeriodDuration,
"is_period_start": isPeriodStart,
"period_day": periodDay,
"is_ovulation_day": ovulationDay,
"prev_cycle_length": prevCycleLength,
"prev_period_duration": prevPeriodDuration,
"cycle_regularity_score_status": cycleCRSStatus,
"cycle_regularity_score": cycleCRS,
"period_regularity_score_status": periodPRSStatus,
"period_regularity_score": periodPRS,
},
"prediction_matrix": {
"next_period_day": nextPeriodDay,
"next_ovulation_day": nextOvulationDate,
"is_period_start_from_today": periodStartFromToday,
"is_period_start_from_tomorrow": periodStartFromTomorrow,
"chances_of_pregnancy": getPregnancyChances(),
"expected_pregnancy_test_date": getExpectedPregnancyTestDate(),
},
"pregnancy_matrix": {
"current_day": getCurrentPregnancyDay(),
"current_week": getCurrentPregnancyWeek(),
"current_month": getCurrentPregnancyMonth(),
"current_trimester": getCurrentTrimester(),
"expected_due_date": getExpectedDueDate(),
},
"predicted_symptoms_pattern_today":
todaySymptomsData.map((e) => e.toJson()).toList(),
"predicted_symptoms_pattern_tomorrow":
tomorrowSymptomsData.map((e) => e.toJson()).toList()
};
return summaryData;
}