Exemple #1
0
        public async Task <IHttpActionResult> Get(string patientId, string uid = null, string code = null)
        {
            DSSModel item = null;

            if (!string.IsNullOrEmpty(uid))
            {
                int key = int.Parse(uid);
                item = _context.Set <DSSModel>().Find(key);
                if (item == null)
                {
                    return(NotFound());
                }
            }
            else if (!string.IsNullOrEmpty(code))
            {
                item = _context.Set <DSSModel>().FirstOrDefault(e => e.Code == code);
                if (item == null)
                {
                    return(NotFound());
                }
            }
            else
            {
                return(NotFound());
            }

            //Run DSS
            var res = await _dssRunner.Run(patientId, item.Config);

            //_dssRunner.Run(id)
            return(Ok(res));
        }
Exemple #2
0
        private void AddDummyDSS(Context.DSSContext context)
        {
            string config = string.Empty;

            try
            {
                config = System.IO.File.ReadAllText("modelyesno.json");
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Load Config file");
            }
            try
            {
                context.Set <DSSModel>().Add(new DSSModel()
                {
                    Name         = "YesNo",
                    Code         = "MedicationChange",
                    Description  = "YesNo Model",
                    Config       = config,
                    CreatedBy    = "admin",
                    ModifiedBy   = "admin",
                    ModifiedDate = DateTime.Now,
                    CreatedDate  = DateTime.Now,
                    Id           = 1
                });

                context.SaveChanges();
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Add Test Data");
            }
        }
Exemple #3
0
        private void AddDummyAlerts(Context.DSSContext context)
        {
            string config = string.Empty;

            try
            {
                context.Set <AlertModel>().Add(new AlertModel()
                {
                    Name               = "Fluctuations",
                    Description        = "Fluctuations",
                    TargetValueCode    = "STFLUCT",
                    IsSystem           = true,
                    TargetValueNumeric = true,
                    Message            = "Patient has severe fluctuations",
                    TargetValueSource  = "metaobservation",
                    HighPriorityValue  = "8",
                    CreatedBy          = "admin",
                    ModifiedBy         = "admin",
                    ModifiedDate       = DateTime.Now,
                    CreatedDate        = DateTime.Now,
                    Id = 1
                });
                context.Set <AlertModel>().Add(new AlertModel()
                {
                    Name               = "Medication Change",
                    Description        = "Medication Change",
                    TargetValueCode    = "MedicationChange",
                    IsSystem           = true,
                    TargetValueNumeric = false,
                    Message            = "Patient should change medication",
                    TargetValueSource  = "dss",
                    LowPriorityValue   = "maybe",
                    HighPriorityValue  = "change",
                    CreatedBy          = "admin",
                    ModifiedBy         = "admin",
                    ModifiedDate       = DateTime.Now,
                    CreatedDate        = DateTime.Now,
                    Id = 2
                });

                context.SaveChanges();
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Add Test Data");
            }
        }
        /// <summary>
        /// Get Config in JSON format from meta-observation code
        /// </summary>
        /// <param name="code">Meta-observation code</param>
        /// <returns></returns>
        public string GetJsonConfigFromCode(string code)
        {
            if (code == null)
            {
                throw new ArgumentNullException(nameof(code));
            }


            var model = _context.Set <DSSModel>().FirstOrDefault(e => e.Code == code);

            if (model == null)
            {
                throw new DSSDefinitionNotFoundException(code);
            }


            return(model.Config);
        }
Exemple #5
0
        /// <summary>
        /// Get DSS Config
        /// </summary>
        /// <param name="id"></param>
        /// <param name="patientId"></param>
        /// <returns></returns>


        public async Task <IHttpActionResult> Get(string id, string patientId)
        {
            var model = _context.Set <AlertModel>().Find(int.Parse(id));

            if (model == null)
            {
                return(NotFound());
            }

            var ret = await this._alertEvaluator.GetAlertLevel(model, patientId);



            return(Ok(new {
                Message = model.Message,
                Level = ret,
                Color = GetColor(ret)
            }));
        }
Exemple #6
0
        public IActionResult Get()
        {
            var list = _context.Set <AggrModel>().ToList();

            return(Ok(list));
        }