public PersonsTreatedCoverageOptions(SavedReport o) : base() { report = o; options = (PersonsTreatedCoverageReportOptions)o.StandardReportOptions; // Clear previous report results report.ReportOptions.Columns = new Dictionary<string, AggregateIndicator>(); report.ReportOptions.SelectedIndicators = new List<ReportIndicator>(); InitializeComponent(); }
protected override List<Disease> DetermineDiseases(PersonsTreatedCoverageReportOptions standardOpts) { throw new NotImplementedException(); }
/// <summary> /// Determines the diseases to report on given report options and a collection of intnerventions (uses the mapping between interventions and diseases) /// </summary> /// <param name="standardOpts"></param> /// <param name="interventions"></param> /// <returns></returns> protected abstract List<Disease> DetermineDiseases(PersonsTreatedCoverageReportOptions standardOpts, List<IntvBase> interventions);
protected override List<Disease> DetermineDiseases(PersonsTreatedCoverageReportOptions standardOpts, List<IntvBase> interventions) { // Will hold the diseases List<Disease> diseases = new List<Disease>(); // Iterate through the interventions and add the targeted diseases to the collection if they are selected foreach (IntvBase intv in interventions) { IndicatorValue indicatorVal = intv.IndicatorValues.Where(ind => ind.Indicator.DisplayName == "PcIntvDiseases").FirstOrDefault(); if (indicatorVal == null) continue; // See if any of the available diseases are selected foreach (Disease disease in standardOpts.AvailableDiseases) { if (indicatorVal.DynamicValue != null && indicatorVal.DynamicValue.Contains(disease.DisplayNameKey) && !diseases.Contains(disease)) diseases.Add(disease); } // No need to check any more interventions if all the diseases have been targeted if (diseases.Count >= standardOpts.AvailableDiseases.Count) { return diseases; } } return diseases; }
protected override List<IntvType> DetermineIntvTypes(PersonsTreatedCoverageReportOptions standardOpts) { List<IntvType> intvTypes = standardOpts.DrugPackages; HydrateIntvTypes(intvTypes); return intvTypes; }
protected override List<Disease> DetermineDiseases(PersonsTreatedCoverageReportOptions standardOpts) { return standardOpts.Diseases; }
/// <summary> /// Determines the intervention types given report options /// </summary> /// <param name="standardOpts"></param> /// <returns></returns> protected abstract List<IntvType> DetermineIntvTypes(PersonsTreatedCoverageReportOptions standardOpts);
protected ReportResult RunIntvReport(SavedReport report, PersonsTreatedCoverageReportOptions standardOpts, List<int> filteredIntvIds) { // Add all the relevant intervention indicators foreach (IntvType intvType in IntvTypes) { AddIndicators(intvType.Id, "PcIntvNumEligibleIndividualsTargeted", intvType, intvType.IntvTypeName, intvType.DisplayNameKey, report.ReportOptions); AddIndicators(intvType.Id, "PcIntvNumIndividualsTreated", intvType, intvType.IntvTypeName, intvType.DisplayNameKey, report.ReportOptions); AddIndicators(intvType.Id, "PcIntvPsacTreated", intvType, intvType.IntvTypeName, intvType.DisplayNameKey, report.ReportOptions); AddIndicators(intvType.Id, "PcIntvNumSacTreated", intvType, intvType.IntvTypeName, intvType.DisplayNameKey, report.ReportOptions); } // Report gen IntvReportGenerator gen = new IntvReportGenerator(); // Set the IDs of the filtererd interventions if (filteredIntvIds != null && filteredIntvIds.Count > 0) gen.CmdTextOverride = DetermineInterventionSql(filteredIntvIds, report.ReportOptions); // Recent distro static classs RecentDistro recentDistro = RecentDistro.GetInstance(true /* instantiate */); recentDistro.Run(report.ReportOptions); // Run the report ReportResult result = gen.Run(report); // Clear the RecentDistro from memory RecentDistro.ClearInstance(); return result; }
protected ReportResult RunDistributionReport(SavedReport report, PersonsTreatedCoverageReportOptions standardOpts) { // Add the disease indicators to the report foreach (var disease in Diseases) { DiseaseDistroPc dd = DiseaseRepo.Create((DiseaseType)disease.Id); switch (disease.Id) { case (int)DiseaseType.Lf: AddIndicators(disease.Id, "DDLFPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions); break; case (int)DiseaseType.Trachoma: AddIndicators(disease.Id, "DDTraPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions); break; case (int)DiseaseType.Oncho: AddIndicators(disease.Id, "DDOnchoPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions); break; case (int)DiseaseType.STH: AddIndicators(disease.Id, "DDSTHPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions); break; case (int)DiseaseType.Schisto: AddIndicators(disease.Id, "DDSchistoPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions); break; default: break; } } // Run the report DistributionReportGenerator gen = new DistributionReportGenerator(); ReportResult result = gen.Run(report); return result; }