Esempio n. 1
0
 private ReportsFilter MapToReportFilters(int projectId, FiltersRequestDto filtersDto) =>
 new ReportsFilter
 {
     StartDate    = filtersDto.StartDate,
     EndDate      = filtersDto.EndDate.AddDays(1),
     HealthRiskId = filtersDto.HealthRiskId,
     Area         = filtersDto.Area == null
             ? null
             : new Area
     {
         AreaType = filtersDto.Area.Type,
         AreaId   = filtersDto.Area.Id
     },
     ProjectId         = projectId,
     DataCollectorType = MapToDataCollectorType(filtersDto.ReportsType),
     IsTraining        = filtersDto.IsTraining
 };
Esempio n. 2
0
        public async Task <Result <IEnumerable <ReportsSummaryHealthRiskResponseDto> > > GetProjectReportHealthRisks(int projectId, double latitude, double longitude, FiltersRequestDto filtersDto)
        {
            var filters = MapToReportFilters(projectId, filtersDto);
            var data    = await _reportsDashboardMapService.GetProjectReportHealthRisks(filters, latitude, longitude);

            return(Success(data));
        }
Esempio n. 3
0
        public async Task <Result <ProjectDashboardResponseDto> > GetData(int projectId, FiltersRequestDto filtersDto)
        {
            if (filtersDto.EndDate < filtersDto.StartDate)
            {
                return(Success(new ProjectDashboardResponseDto()));
            }

            var filters = MapToReportFilters(projectId, filtersDto);
            var reportsByFeaturesAndDate = await _reportsDashboardByFeatureService.GetReportsGroupedByFeaturesAndDate(filters, filtersDto.GroupingType);

            var dashboardDataDto = new ProjectDashboardResponseDto
            {
                Summary = await _projectDashboardSummaryService.GetData(filters),
                ReportsGroupedByHealthRiskAndDate       = await _reportsDashboardByHealthRiskService.GetReportsGroupedByHealthRiskAndDate(filters, filtersDto.GroupingType),
                ReportsGroupedByFeaturesAndDate         = reportsByFeaturesAndDate,
                ReportsGroupedByVillageAndDate          = await _reportsDashboardByVillageService.GetReportsGroupedByVillageAndDate(filters, filtersDto.GroupingType),
                ReportsGroupedByLocation                = await _reportsDashboardMapService.GetProjectSummaryMap(filters),
                ReportsGroupedByFeatures                = GetReportsGroupedByFeatures(reportsByFeaturesAndDate),
                DataCollectionPointReportsGroupedByDate = filtersDto.ReportsType == FiltersRequestDto.ReportsTypeDto.DataCollectionPoint
                    ? await _reportsDashboardByDataCollectionPointService.GetDataCollectionPointReports(filters, filtersDto.GroupingType)
                    : Enumerable.Empty <DataCollectionPointsReportsByDateDto>()
            };

            return(Success(dashboardDataDto));
        }
Esempio n. 4
0
 public async Task <Result <IEnumerable <ReportsSummaryHealthRiskResponseDto> > > GetReportHealthRisks(int projectId, double latitude, double longitude, [FromBody] FiltersRequestDto filters) =>
 await _projectDashboardService.GetProjectReportHealthRisks(projectId, latitude, longitude, filters);
Esempio n. 5
0
 public Task <Result <ProjectDashboardResponseDto> > Data(int projectId, [FromBody] FiltersRequestDto dto) =>
 _projectDashboardService.GetData(projectId, dto);