Esempio n. 1
0
        public async Task AddDescriptionsToAllItems()
        {
            var bms = _elmDb.GetAllBowelMovementItemsForUser();
            var sss = _elmDb.GetAllStomachSymptomItemsUser();
            var fs  = _elmDb.GetAllFoodItemsForUser();

            foreach (var bm in bms)
            {
                if (String.IsNullOrEmpty(bm.Description))
                {
                    bm.Description = "Bowel Movement";
                    await _elmDb.UpsertTrackedItem(bm);
                }
            }
            foreach (var ss in sss)
            {
                if (String.IsNullOrEmpty(ss.Description))
                {
                    ss.Description = "Stomach Symptom";
                    await _elmDb.UpsertTrackedItem(ss);
                }
            }
            foreach (var f in fs)
            {
                if (String.IsNullOrEmpty(f.Description))
                {
                    f.Description = f.Name;
                    await _elmDb.UpsertTrackedItem(f);
                }
            }
        }
Esempio n. 2
0
        private UserReport BuildReportForUser(string userId)
        {
            var foodRecords       = _elmDb.GetAllFoodItemsForUser(userId);
            var bowelMovRecords   = _elmDb.GetAllBowelMovementItemsForUser(userId);
            var stomachSymRecords = _elmDb.GetAllStomachSymptomItemsUser(userId);

            var foodRecordRelatedDataList       = _foodDataTransformationBl.AssociateRelatedDataWithFoodRecord(foodRecords, bowelMovRecords, stomachSymRecords);
            var explodedFoodRecords             = _foodDataTransformationBl.ExplodeFoodRecords(foodRecordRelatedDataList);
            var aggregatedSummary               = _foodDataTransformationBl.AggregateExplodedRecords(explodedFoodRecords);
            var flattendedMealBrandSummaryList  = _foodDataTransformationBl.FlattenMealBrandAggregation(aggregatedSummary.MealBrandEffectSummaries);
            var flattendedIngredientSummaryList = _foodDataTransformationBl.FlattenIngredientsAggregation(aggregatedSummary.IngredientEffectSummaries);

            return(_foodDataTransformationBl.CreateUserReport(flattendedMealBrandSummaryList, flattendedIngredientSummaryList));
        }