Esempio n. 1
0
 public Disease(DiseaseType type, DiseasePriority priority, uint requiredTimeValue, RequiredTimeUnit requiredTimeUnit)
 {
     Type              = type;
     Priority          = priority;
     RequiredTimeValue = requiredTimeValue;
     RequiredTimeUnit  = requiredTimeUnit;
 }
Esempio n. 2
0
 public Disease(DiseaseType type, DiseasePriority priority, uint requiredTimeValue, RequiredTimeUnit requiredTimeUnit)
 {
     Type = type;
       Priority = priority;
       RequiredTimeValue = requiredTimeValue;
       RequiredTimeUnit = requiredTimeUnit;
 }
Esempio n. 3
0
 public DiseaseDistroCm CreateCm(DiseaseType disease)
 {
     DiseaseDistroCm dd = new DiseaseDistroCm();
     dd.Disease = GetDiseaseById((int)disease);
     GetIndicatorsForDisease(dd.Disease.Id, dd);
     return dd;
 }
        private void Add()
        {
            var diseaseTypes = new DiseaseType {
                Name = NewType, Description = NewDescription
            };

            MainDataSource.Instance.DiseaseTypes.Add(diseaseTypes);
            MainDataSource.Instance.Context.DiseaseTypes.Add(diseaseTypes);
            MainDataSource.Instance.Context.SaveChangesAsync();
        }
Esempio n. 5
0
        public List <DiseaseType> GetDiseasesType()
        {
            DataTable          table = this.medicalDAL.GetDiseaseTypes();
            List <DiseaseType> list  = new List <DiseaseType>();

            foreach (DataRow row in table.Rows)
            {
                DiseaseType d = new DiseaseType();
                d.ID   = Convert.ToInt32(row["DiseaseType_Id"]);
                d.Name = row["DiseaseType_Name"].ToString();
                d.Code = row["DiseaseType_Code"].ToString();
                list.Add(d);
            }
            return(list);
        }
Esempio n. 6
0
    public Disease(Disease disease)
    {
        DiseaseType          = disease.DiseaseType;
        DiseaseName          = disease.DiseaseName;
        LatinName            = disease.LatinName;
        Description          = disease.Description;
        AffectedBodyParts    = disease.AffectedBodyParts;
        AverageLength        = disease.AverageLength;
        ChanceToContract     = disease.ChanceToContract;
        IncreasedChanceToDie = disease.IncreasedChanceToDie;
        CanBeTreated         = disease.CanBeTreated;
        CanBeCured           = disease.CanBeCured;

        AgeContracted = -1;
    }
        public async Task SaveDiseaseAsync(DiseaseTypeDto diseaseTypeDto)
        {
            var diseaseType = new DiseaseType();

            diseaseType.DiseaseTypeId = diseaseTypeDto.DiseaseTypeId;
            diseaseType.TypeOfDisease = diseaseTypeDto.TypeOfDisease;
            diseaseType.Disease       = new List <Disease>();
            foreach (var item in diseaseTypeDto.Disease)
            {
                var disease = new Disease();
                disease.DiseaseId = item.DiseaseDtoId;
                disease.Name      = item.Name;
                diseaseType.Disease.Add(disease);
            }
            _context.DiseaseType.Add(diseaseType);
            await _context.SaveChangesAsync();
        }
Esempio n. 8
0
 private DiseaseType EntityToModel(HR_DISEASECATEGORY model)
 {
     if (model != null)
     {
         var entity = new DiseaseType()
         {
             Id           = model.CATEGORYID,
             CategoryCode = model.CATEGORYCODE,
             DiseaseName  = model.CATEGORYNAME,
             ParentId     = (model.PARENTID != null && model.PARENTID.HasValue)?model.PARENTID.Value:0,
             EndCode      = model.ENDCODE,
             StartCode    = model.STARTCODE
         };
         return(entity);
     }
     return(null);
 }
Esempio n. 9
0
    /// <summary>
    /// Initializes a new instance of the <see cref="Disease"/> class.
    /// </summary>
    /// <param name="diseaseName">Disease name.</param>
    /// <param name="latinName">Latin name.</param>
    /// <param name="description">Description.</param>
    /// <param name="affectedBodyParts">Affected body parts.</param>
    /// <param name="averageAgeToContract">Average age to contract.</param>
    /// <param name="averageLength">Average length.</param>
    /// <param name="chanceToContractPerMonth">Chance to contract per month, as a percentage.</param>
    /// <param name="increasedChanceToDie">Increased chance to die, as a percentage.</param>
    /// <param name="canBeTreated">If set to <c>true</c> can be treated.</param>
    /// <param name="canBeCured">If set to <c>true</c> can be cured.</param>
    public Disease(DiseaseType diseaseType, string diseaseName, string latinName, string description, string[] affectedBodyParts,
                   int averageLength,
                   float chanceToContract = 0.001f, float increasedChanceToDie = 0f,
                   bool canBeTreated      = true, bool canBeCured = true)
    {
        DiseaseType          = diseaseType;
        DiseaseName          = diseaseName;
        LatinName            = latinName;
        Description          = description;
        AffectedBodyParts    = affectedBodyParts;
        AverageLength        = averageLength;
        ChanceToContract     = chanceToContract;
        IncreasedChanceToDie = increasedChanceToDie;
        CanBeTreated         = canBeTreated;
        CanBeCured           = canBeCured;

        AgeContracted = -1;
    }
Esempio n. 10
0
        private void LoadDiseasesTypes()
        {
            #region Covid19 Disease

            DiseaseType covid19 = new DiseaseType()
            {
                IdentData = new DiseaseIdentData()
                {
                    id       = "1",
                    name     = "Covid-19",
                    desc     = "Scheiß Lungenkrankheit",
                    infoLink = "www.covid19.com"
                },
                propabilityAlgorithm = covid19Propability,
                GetRecommendation    = covid19Recommendation,
            };

            #endregion
        }
Esempio n. 11
0
    private bool Probability(DiseaseType disease)
    {
        float random = UnityEngine.Random.Range(0f, 100f);

        switch (disease)
        {
        case DiseaseType.VirusA:
            if (random <= virusAProb)
            {
                return(true);
            }
            else
            {
                return(false);
            }

        case DiseaseType.VirusS:
            if (random <= virusSProb)
            {
                return(true);
            }
            else
            {
                return(false);
            }

        case DiseaseType.BlackDeath:
            if (random <= blackDeathProb)
            {
                return(true);
            }
            else
            {
                return(false);
            }

        default:
            return(false);
        }
    }
Esempio n. 12
0
        private string TranslateEndemicity(DiseaseType t, string end)
        {
            var ends = end.Split(' ');
            if (ends.Count() > 0)
                end = ends[0].Trim().ToUpper();
            if (t == DiseaseType.Lf || t == DiseaseType.Oncho)
            {
                switch (end)
                {
                    case "M":
                        return "4";
                    case "NS":
                        return "4";
                    case "0":
                        return "0";
                    case "1":
                        return "1";
                    case "100":
                        return "99";
                    case "PENDING":
                        return "99";
                }
            }
            if (t == DiseaseType.Schisto || t == DiseaseType.STH)
            {
                switch (end)
                {
                    case "M":
                        return "4";
                    case "NS":
                        return "4";
                    case "0":
                        return "0";
                    case "1":
                        return "1";
                    case "2":
                        return "2";
                    case "2A":
                        return "2";
                    case "2B":
                        return "2";
                    case "3":
                        return "3";
                    case "3A":
                        return "3";
                    case "3B":
                        return "3";
                    case "10":
                        return "1";
                    case "20":
                        return "1";
                    case "30":
                        return "2";
                    case "40":
                        return "3";
                    case "100":
                        return "0";
                    case "PENDING":
                        return "0";
                }
            }

            return end;
        }
Esempio n. 13
0
    /// <summary>
    /// Spawns the given gameObject template at the given position with the given disease type
    /// </summary>
    /// <param name="_template">Template of the gameObject you want to spawn</param>
    /// <param name="_position">Vector3 with the position in where you want to spawn the object</param>
    /// <param name="_type">The type of disease that cures the vaccine</param>
    public void Fabricate(GameObject _template, Vector3 _position, DiseaseType _type)
    {
        GameObject result = Instantiate(_template, _position, Quaternion.identity);

        result.GetComponent <Vaccine>().TypeVaccine = _type;
    }
Esempio n. 14
0
 private string transformDiseaseTypeToCSV(DiseaseType diseaseType)
 => string.Join(_listDelimiter, diseaseType.Infectious, diseaseType.Genetic, diseaseType.Type);
Esempio n. 15
0
 public static MonsterHitEffect Disease(DiseaseType diseaseType) => new MonsterHitEffect(IPOnMonsterHit.Disease, (int)diseaseType);
Esempio n. 16
0
 public static MonsterHitEffect Disease(DiseaseType diseaseType)
 {
     return(new MonsterHitEffect(IPOnMonsterHit.Disease, (int)diseaseType));
 }
Esempio n. 17
0
 public Disease(string name, DiseaseType type)
 {
     this.Name = name;
     this.Type = type;
 }
Esempio n. 18
0
 /// <summary>
 /// Creates an effect that applies a disease to a creature.
 /// </summary>
 /// <param name="diseaseType">The type of disease to apply.</param>
 public static Effect Disease(DiseaseType diseaseType)
 {
     return(NWScript.EffectDisease((int)diseaseType) !);
 }
Esempio n. 19
0
        /// <summary>
        /// Given a set of parameters, can find previously calculated disease distriubtion values
        /// </summary>
        /// <param name="adminLevelId">The ID of the admin unnit</param>
        /// <param name="indicatorName">The name of the indicator to retrieve a value for</param>
        /// <param name="diseaseType">The disease type</param>
        /// <param name="start">The start date of the original report that ran the disease distro calculations</param>
        /// <param name="end">The end date of the original report that ran the disease distro calculations</param>
        /// <param name="errors">Reference to a string of report errors that is managed by the ReportGenerator</param>
        /// <returns>Previously calculated disease distro value</returns>
        public string GetRecentDistroIndicator(int adminLevelId, string indicatorName, DiseaseType diseaseType, DateTime start, DateTime end, ref string errors)
        {
            // Get the corresponding disease
            Disease disease = null;
            if (!Diseases.ContainsKey((int)diseaseType))
            {
                disease = DiseaseRepo.GetDiseaseById((int)diseaseType);
                Diseases.Add((int)diseaseType, disease);
            }
            else
            {
                disease = Diseases[(int)diseaseType];
            }
            if (disease == null)
                return "";

            string colName = string.Format("{0} - {1}", TranslationLookup.GetValue(indicatorName), disease.DisplayName);
            // Make sure the column exists
            if (!Result.DataTableResults.Columns.Contains(colName))
                return "";

            // Get the corresponding AdminLevel
            AdminLevel adminLevel = Report.ReportOptions.SelectedAdminLevels.Where(a => a.Id == adminLevelId).FirstOrDefault();

            if (adminLevel == null)
                return "";

            // Find the corresponding row
            foreach (DataRow row in Result.DataTableResults.Rows)
            {
                // Get the row's admin level name and date range
                string rowAdminLevelName = row[NameOfReportingAdminLevel].ToString();
                string rowDateRange = row[Translations.Year].ToString();

                // Determine the date range that was passed in
                string requestedDateRange = string.Format("{0}-{1}", start.ToString("MMM yyyy"), end.ToString("MMM yyyy"));

                // The row matches if the admin level and date match
                if (rowAdminLevelName != adminLevel.Name || rowDateRange != requestedDateRange)
                    continue;
                else
                {
                    return row[colName].ToString();
                }
            }

            return "";
        }
Esempio n. 20
0
 public IEnumerable <Disease> GetDiseasesByType(DiseaseType type)
 => diseaseService.GetDiseasesByType(type);
Esempio n. 21
0
 public static HitEffect Disease(DiseaseType diseaseType)
 {
     return(new HitEffect(IPOnHit.Disease, (int)diseaseType));
 }
 private void GetDdForDisease(DateTime start, DateTime end, List<AdminLevel> demography, out DiseaseDistroPc ddType, out Dictionary<int, DataRow> dd, DiseaseType dType)
 {
     ReportOptions options = new ReportOptions
     {
         MonthYearStarts = start.Month,
         StartDate = start,
         EndDate = end,
         IsCountryAggregation = false,
         IsByLevelAggregation = true,
         IsAllLocations = false,
         IsNoAggregation = false
     };
     options.SelectedAdminLevels = demography;
     DistributionReportGenerator gen = new DistributionReportGenerator();
     ddType = diseaseRepo.Create(dType);
     foreach (var indicator in ddType.Indicators.Where(i => i.Value.DataTypeId != (int)IndicatorDataType.Calculated))
         options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator(ddType.Id, indicator));
     ReportResult ddResult = gen.Run(new SavedReport { ReportOptions = options });
     dd = new Dictionary<int, DataRow>();
     foreach (DataRow dr in ddResult.DataTableResults.Rows)
     {
         int id = 0;
         if (int.TryParse(dr["ID"].ToString(), out id))
         {
             if (dd.ContainsKey(id))
                 dd[id] = dr;
             else
                 dd.Add(id, dr);
         }
     }
 }
Esempio n. 23
0
        => GetAllEager().Where(disease => !disease.Symptoms.Except(symptoms).Any());     //Performs check if disease.Symptoms contains ALL of symptoms.

        public IEnumerable <Disease> GetDiseasesByType(DiseaseType type)
        => GetAllEager().Where(disease => disease.DiseaseType == type);
Esempio n. 24
0
        protected string GetRecentDistroIndicator(int adminLevelId, string indicatorName, DiseaseType diseaseType, DateTime start, DateTime end, ref string errors)
        {
            // If there is a RecentDistro instance, look for the value there
            RecentDistro recentDistro = RecentDistro.GetInstance(false /* don't instantiate */);
            if (recentDistro != null)
            {
                string storedVal = recentDistro.GetRecentDistroIndicator(adminLevelId, indicatorName, diseaseType, start, end, ref errors);
                if (storedVal != null)
                {
                    return storedVal;
                }
            }

            AdminLevelIndicators levelInds = null;
            string key = adminLevelId + start.ToShortDateString() + end.ToShortDateString() + diseaseType.ToString();
            if (distroDict.ContainsKey(key))
                levelInds = distroDict[key];
            else
            {
                ReportOptions options = new ReportOptions();
                DistributionReportGenerator gen = new DistributionReportGenerator();
                DiseaseRepository repo = new DiseaseRepository();
                DemoRepository demo = new DemoRepository();
                var disease = repo.GetDiseaseById((int)diseaseType);
                DiseaseDistroPc dd = repo.Create(diseaseType);
                if (diseaseType == DiseaseType.STH)
                {
                    options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)diseaseType,
                        new KeyValuePair<string, Indicator>(indicatorName, new Indicator { Id = 141, DisplayName = "DDSTHPopulationRequiringPc" })));
                    options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)diseaseType,
                        new KeyValuePair<string, Indicator>(indicatorName, new Indicator { Id = 142, DisplayName = "DDSTHPsacAtRisk" })));
                    options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)diseaseType,
                        new KeyValuePair<string, Indicator>(indicatorName, new Indicator { Id = 143, DisplayName = "DDSTHSacAtRisk" })));
                    options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)diseaseType,
                        new KeyValuePair<string, Indicator>(indicatorName, new Indicator { Id = 140, DisplayName = "DDSTHPopulationAtRisk" })));
                }
                else if (diseaseType == DiseaseType.Lf)
                {
                    options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)diseaseType,
                    new KeyValuePair<string, Indicator>(indicatorName, new Indicator { Id = 98, DisplayName = "DDLFPopulationAtRisk" })));
                    options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)diseaseType,
                        new KeyValuePair<string, Indicator>(indicatorName, new Indicator { Id = 99, DisplayName = "DDLFPopulationRequiringPc" })));
                }
                else if (diseaseType == DiseaseType.Oncho)
                {
                    options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)diseaseType,
                    new KeyValuePair<string, Indicator>(indicatorName, new Indicator { Id = 111, DisplayName = "DDOnchoPopulationAtRisk" })));
                    options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)diseaseType,
                        new KeyValuePair<string, Indicator>(indicatorName, new Indicator { Id = 112, DisplayName = "DDOnchoPopulationRequiringPc" })));
                }
                else if (diseaseType == DiseaseType.Schisto)
                {
                    options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)diseaseType,
                        new KeyValuePair<string, Indicator>(indicatorName, new Indicator { Id = 125, DisplayName = "DDSchistoPopulationAtRisk" })));
                    options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)diseaseType,
                        new KeyValuePair<string, Indicator>(indicatorName, new Indicator { Id = 126, DisplayName = "DDSchistoPopulationRequiringPc" })));
                    options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)diseaseType,
                        new KeyValuePair<string, Indicator>(indicatorName, new Indicator { Id = 127, DisplayName = "DDSchistoSacAtRisk" })));
                }
                else if (diseaseType == DiseaseType.Trachoma)
                options.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)diseaseType,
                    new KeyValuePair<string, Indicator>(indicatorName, new Indicator { Id = 161, DisplayName = "DDTraPopulationAtRisk" })));

                options.StartDate = start;
                options.EndDate = end;
                options.MonthYearStarts = start.Month;
                var adminlevel = demo.GetAdminLevelById(adminLevelId);
                options.SelectedAdminLevels = new List<AdminLevel> { adminlevel };
                options.IsNoAggregation = false;
                options.IsByLevelAggregation = true;
                options.IsAllLocations = false;

                levelInds = gen.GetRecentDiseaseDistribution(options);
                levelInds.StartDate = start;
                levelInds.EndDate = end;
                levelInds.DiseaseName = disease.DisplayName;
            }
            if (levelInds.Indicators.ContainsKey(indicatorName) )
            {
                if(!string.IsNullOrEmpty(levelInds.Indicators[indicatorName].Value))
                    return levelInds.Indicators[indicatorName].Value.ToString();
                else
                    return "";
            }
            string error = string.Format(Translations.ReportsNoDdInDateRange, levelInds.Name, start.ToShortDateString(), end.ToShortDateString(), levelInds.DiseaseName) + Environment.NewLine;
            if (!errors.Contains(error))
                errors += error;
            return Translations.NA;
        }
Esempio n. 25
0
 /// <summary>
 /// Creates an effect that applies a disease to a creature.
 /// </summary>
 /// <param name="diseaseType">The type of disease to apply.</param>
 public static Effect Disease(DiseaseType diseaseType) => NWScript.EffectDisease((int)diseaseType);
Esempio n. 26
0
 public IEnumerable <Disease> GetDiseasesByType(DiseaseType type)
 => _diseaseRepository.GetDiseasesByType(type);
Esempio n. 27
0
    public void SetDisease(DiseaseType dType)
    {
        Normalize();
        switch (dType)
        {
        // Visual Cases
        case DiseaseType.RedFood:
            RedFood();
            break;

        case DiseaseType.RedDrug:
            RedDrug();
            break;

        case DiseaseType.OrangeFood:
            OrangeFood();
            break;

        case DiseaseType.OrangeDrug:
            OrangeDrug();
            break;

        case DiseaseType.GreenFood:
            GreenFood();
            break;

        case DiseaseType.GreenDrug:
            GreenDrug();
            break;

        case DiseaseType.BlueDrug:
            BlueDrug();
            break;

        case DiseaseType.BrownFood:
            BrownFood();
            break;

        case DiseaseType.BrownDrug:
            BrownDrug();
            break;

        case DiseaseType.WhiteDrug:
            WhiteDrug();
            break;

        // Chemical Cases
        case DiseaseType.Type1Diabetes:
            Type1Diabetes();
            break;

        case DiseaseType.Type2Diabetes:
            Type2Diabetes();
            break;

        case DiseaseType.Proteinuria:
            Proteinuria();
            break;

        // Microbial Cases
        case DiseaseType.KidneyInfection:
            KidneyInfection();
            break;

        case DiseaseType.UTI:
            UTI();
            break;

        case DiseaseType.Gout:
            Gout();
            break;

        case DiseaseType.KidneyStones:
            KidneyStones();
            break;
        }
    }
Esempio n. 28
0
 public static HitEffect Disease(DiseaseType diseaseType) => new HitEffect(IPOnHit.Disease, (int)diseaseType);