Beispiel #1
0
 protected BaseCalc(ARTSite site, MorbidityForecast forecast, BudgetPeriodInfo periodinfo, int target)
 {
     ArtSite = site;
     Forecast = forecast;
     PeriodInfo = periodinfo;
     TargetSelected = target;
     RTestAlgorithm = null;
 }
Beispiel #2
0
 public static void SaveOrUpdateARTSite(ARTSite artsite)
 {
     DaoFactory.GetDaoFactory().CreateARTSiteDao().SaveOrUpdate(artsite);
 }
Beispiel #3
0
 public static void DeleteARTSite(ARTSite artsite)
 {
     DaoFactory.GetDaoFactory().CreateARTSiteDao().Delete(artsite);
 }
 private void SetOnTreatmentAllocation(ARTSite site, double newvalue)
 {
     double total = SumOfOldDataPatientOnTreatment.Value;
     total = (total - site.EverSPatientOnTreatment) + newvalue;
     site.EverSPatientOnTreatment = newvalue;
     _sumofTimeZeroPatientOnTreatment = total;
     SetAllOnTreatmentAllocation();
 }
Beispiel #5
0
 public CalcRapidTest(ARTSite site, MorbidityForecast forecast, BudgetPeriodInfo periodinfo, int target, RapidTestAlgorithm rtestAlgorithm)
     : base(site, forecast, periodinfo, target,rtestAlgorithm)
 {
     _lstPrimaryQuanReagents = new ListOfPrimeryQR(ClassOfMorbidityTestEnum.RapidTest);
 }
        public CalcPatientNumber(ARTSite site, MorbidityForecast forecast, BudgetPeriodInfo periodinfo, int target)
            : base(site, forecast, periodinfo, target)
        {
            _calcPatientNos = new Dictionary<int, CalculatedSitePatientNumber>();

            if (site.NTTPercentOfChildren > 0)
            {
                ArtPedTargetOnMonth0 = site.GetNTTMonthValue(0) * (site.NTTPercentOfChildren / 100d);
                ArtAdulTargetOnMonth0 = site.GetNTTMonthValue(0) - ArtPedTargetOnMonth0;

                for (int i = 1; i <= 12; i++)
                {
                    CalculatedSitePatientNumber calcPatientNo = new CalculatedSitePatientNumber();
                    calcPatientNo.Month = i;
                    calcPatientNo.ArtPedMonthlyTarget = site.GetNTTMonthValue(i) * (site.NTTPercentOfChildren / 100d);
                    calcPatientNo.ArtAdultMonthlyTarget = site.GetNTTMonthValue(i) - calcPatientNo.ArtPedMonthlyTarget;
                    _calcPatientNos.Add(i, calcPatientNo);
                }
            }
            else
            {
                ArtPedTargetOnMonth0 = periodinfo.DefultMonthValue[0];
                ArtAdulTargetOnMonth0 = site.GetNTTMonthValue(0) - ArtPedTargetOnMonth0;

                for (int i = 1; i <= 12; i++)
                {
                    CalculatedSitePatientNumber calcPatientNo = new CalculatedSitePatientNumber();
                    calcPatientNo.Month = i;
                    calcPatientNo.ArtPedMonthlyTarget =periodinfo.DefultMonthValue[i];
                    calcPatientNo.ArtAdultMonthlyTarget = site.GetNTTMonthValue(i) - calcPatientNo.ArtPedMonthlyTarget;
                    _calcPatientNos.Add(i, calcPatientNo);
                }
            }

            //Pre-ART Target Breakdown (as entered by the user)
            if (site.NTPTPercentOfChildren > 0)
            {
                PreArtPedTargetOnMonth0 = site.GetNTPTMonthValue(0) * (site.NTPTPercentOfChildren / 100d);
                PreArtAdulTargetOnMonth0 = site.GetNTPTMonthValue(0) - PreArtPedTargetOnMonth0;

                for (int i = 1; i <= 12; i++)
                {
                    _calcPatientNos[i].PreArtPedMonthlyTarget = site.GetNTPTMonthValue(i) * (site.NTPTPercentOfChildren / 100d);
                    _calcPatientNos[i].PreArtAdultMonthlyTarget = site.GetNTPTMonthValue(i) - _calcPatientNos[i].PreArtPedMonthlyTarget;
                }
            }
            else
            {
                PreArtPedTargetOnMonth0 =periodinfo.DefultMonthValue[0];
                PreArtAdulTargetOnMonth0 = site.GetNTPTMonthValue(0) - PreArtPedTargetOnMonth0;

                for (int i = 1; i <= 12; i++)
                {
                    _calcPatientNos[i].PreArtPedMonthlyTarget = periodinfo.DefultMonthValue[i];
                    _calcPatientNos[i].PreArtAdultMonthlyTarget = site.GetNTPTMonthValue(i) - _calcPatientNos[i].PreArtPedMonthlyTarget;
                }
            }

            AdultsMonthlyAttritionRateInTreatment = Math.Round(1d - (Math.Pow(1d - (site.AITAnnualPatientAttrition / 100d), 1d / 12d)), 4, MidpointRounding.ToEven);
            AdultsMonthlyAttritionRateInPreART = Math.Round(1d - (Math.Pow(1d - (site.AIPAnualPatientAttrition / 100d), 1d / 12d)), 4, MidpointRounding.ToEven);

            AdultMonthlyMigrationtoTreatment = Math.Round(1d - (Math.Pow(1d - (site.AIPAnnualMigration / 100d), 1d / 12d)), 4, MidpointRounding.ToEven);
            AdultCombinedMonthlyRate = AdultsMonthlyAttritionRateInPreART + AdultMonthlyMigrationtoTreatment;

            PediatricsMonthlyAttritionRateinTreatment = Math.Round(1d - Math.Pow((1d - (site.PITAnnualPatientAttrition / 100d)), (1d / 12d)), 4, MidpointRounding.ToEven);
            PediatricsMonthlyAttritionRateinPreART =Math.Round( 1 - (Math.Pow(1d - (site.PIPAnualPatientAttrition / 100d), 1d / 12d)), 4, MidpointRounding.ToEven);
            PedMonthlyMigrationtoTreatment = Math.Round(1 - (Math.Pow(1d - (site.PIPAnnualMigration / 100d), 1d / 12d)), 4, MidpointRounding.ToEven);
            PedCombinedMonthlyRate = PediatricsMonthlyAttritionRateinPreART + PedMonthlyMigrationtoTreatment;

            //CurrentPatientsAtSiteInTreatment = site.TimeZeroPatientOnTreatment;
            //CurrentPatientsAtSiteInPreArt = site.TimeZeroPatientOnPreTreatment;
            CurrentAdultinTreatment = site.TimeZeroPatientOnTreatment * (1d - (site.NTTPercentOfChildren / 100d));
            CurrentPediatricinTreatment = site.TimeZeroPatientOnTreatment * (site.NTTPercentOfChildren / 100d);
            CurrentAdultinPreArt = site.TimeZeroPatientOnPreTreatment * (1d - (site.NTPTPercentOfChildren / 100d));
            CurrentPediatricinPreArt = site.TimeZeroPatientOnPreTreatment * (site.NTPTPercentOfChildren / 100d);

            TestingEfficiency = Math.Round((site.AdultTestingEfficiency / 100d), 4, MidpointRounding.ToEven);
            UseTestingE = forecast.PreTreatmentPatinetTargetEnum == Core.Util.OptPreTreatmentPatinetTargetEnum.TestingEfficiency;
        }
Beispiel #7
0
 public CalcViralLoad(ARTSite site, MorbidityForecast forecast, BudgetPeriodInfo periodinfo, int target)
     : base(site, forecast, periodinfo, target)
 {
     _lstPrimaryQuanReagents = new ListOfPrimeryQR(ClassOfMorbidityTestEnum.ViralLoad);
 }
Beispiel #8
0
        private string IsValidRow(ARTSite site, ClassOfMorbidityTestEnum ctest)
        {
            if (ctest == ClassOfMorbidityTestEnum.RapidTest || ctest == ClassOfMorbidityTestEnum.Consumable)
                return null;

            if (site.TestWasSelected(ctest) && !site.TestWasReffered(ctest))
            {
                if (site.NoOfPlatform(ctest) == 0)
                    return "Site has not instrument listed under this test category.";
                return null;
            }

            if (site.TestWasSelected(ctest) && site.TestWasReffered(ctest))
            {
                if (site.NoOfPlatform(ctest) > 0)
                    return "Site has instrument listed under this test category but it refer it's samples to other.";

                int refId = site.TestRefferedSiteId(ctest);
                foreach (ARTSite s in _artSites)
                {
                    if (refId == s.Site.Id)
                    {
                        if (s.TestWasSelected(ctest))
                            return null;
                        return "Site listed to refer it's samples was not selected to do this test category.";
                    }
                }
                return "Site listed to refer it's samples was not included in this forecast.";
            }

            return null;
        }
Beispiel #9
0
        private Color CheckForAttritionAndMigration(ARTSite site, int columnIndex, Color defColor)
        {
            if (columnIndex == 1)
            {
                if (site.AITAnnualPatientAttrition > _maxAttrition)
                    return _colorMaxAttrition;
            }
            else if (columnIndex == 2)
            {
                if (site.AIPAnualPatientAttrition > _maxAttrition)
                    return _colorMaxAttrition;
            }
            else if (columnIndex == 3)
            {
                if(site.AIPAnnualMigration < _minMigration)
                    return _colorMinMigration;
            }

            return defColor;
        }
 private void SetOnTreatmentAllocation(ARTSite site, int newvalue)
 {
     double total = SumOfTimeZeroPatientOnTreatment.Value;
     total = (total - site.EverSTimeZeroPatientOnTreatment) + newvalue;
     site.EverSTimeZeroPatientOnTreatment = newvalue;
     _sumofTimeZeroPatientOnTreatment = total;
     _forecast.EverSTimeZeroPatientOnTreatment = _sumofTimeZeroPatientOnTreatment.Value;
 }
Beispiel #11
0
        public bool AddSitesToCategory()
        {
            FrmSelectSite frm;
            if (_forecast.UseRegionAsCat)
                frm = new FrmSelectSite(GetSelectedSiteId(), _sites, _activeCategory.RegionId);
            else
                frm = new FrmSelectSite(GetSelectedSiteId(), _sites);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                foreach (ForlabSite site in frm.SelectedSites)
                {
                    ARTSite artsite = new ARTSite();
                    artsite.Site = site;
                    artsite.MorbidityCategory= _activeCategory;

                    //_activeCategory.ARTSites.Add(site);
                    _artSites.Add(artsite);
                }

                //OnForecastInfoDataChanged();
                return true;
            }
            return false;
        }
Beispiel #12
0
        private void butSave_Click(object sender, EventArgs e)
        {
            var count = 0;
            try
            {
                foreach (var ims in _rdata.Where(ims => !ims.HasError))
                {
                    count++;
                    var artsite = new ARTSite
                    {
                        Site = ims.Site,
                        MorbidityCategory = ims.MCategory,
                        ForecastCD4 = ims.CD4 > 0,
                        ForecastChemistry = ims.Chemistry > 0,
                        ForecastHematology = ims.Hematology > 0,
                        ForecastViralLoad = ims.ViralLoad > 0,
                        ForecastOtherTest = ims.OtherTest > 0,
                        ForecastConsumable = ims.Consumable > 0,
                        ForecastVCT = ims.Vct > 0,
                        TimeZeroPatientOnTreatment = ims.PatientOnTreatment,
                        TimeZeroPatientOnPreTreatment = ims.PatientOnPreTreatment,
                        EverSTimeZeroPatientOnTreatment = ims.EverStartedPonT,
                        EverSTimeZeroPatientOnPreTreatment = ims.EverStartedPonPreT
                    };

                    _artSites.Add(artsite);
                }

                PerformAddition();
                _forecast.TimeZeroPatientOnTreatment = _sumofTimeZeroPatientOnTreatment;
                _forecast.TimeZeroPatientOnPreTreatment = _sumofTimeZeroPatientOnPreTreatment;

                DataRepository.BatchSaveARTSite(_artSites);

                MessageBox.Show(count + " ART sites are imported and saved successfully.", "Importing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
                Close();
            }
            catch
            {
                MessageBox.Show("Error: Unable to import and save ART sites data.", "Importing", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                DataRepository.CloseSession();
            }
        }