/// <summary>
        ///
        /// </summary>
        /// <param name="typeMatch"></param>
        /// <returns></returns>
        protected IEnumerable <BreastQPoint> GetBreastQPointsByType(string typeMatch)
        {
            // i.e., "Breast Q: Implants" => ["Breast Q: Implants 2 weeks", "Breast Q: Implants 6 weeks", ...]
            var matches = engine.GetAllDefinitions().Where(s => s.SurveyType.StartsWith(typeMatch, StringComparison.OrdinalIgnoreCase));
            IEnumerable <BreastQPoint> pointsByType = matches.SelectMany(def => service.GetBreastQPointsByPatient(patientID, def.SurveyType, "", def.Definitions.SelectMany(d => d.Questions).ToArray()));

            return(pointsByType);
        }
Beispiel #2
0
        protected void ViewBreastQDefinitions(IEnumerable <string> surveyTypes)
        {
            bool doFilter = surveyTypes.Count() > 0;
            CaisisBreastQEngine engine = new CaisisBreastQEngine();
            var surveys = from survey in engine.GetAllDefinitions()
                          from scale in survey.Definitions
                          // optional filter by survey
                          where !doFilter || surveyTypes.Contains(survey.SurveyType, StringComparer.OrdinalIgnoreCase)
                          let def = new
            {
                Survey         = survey.SurveyType,
                ScaleName      = scale.Scale,
                ScaleTitle     = scale.Title,
                ScaleAlias     = scale.Alias,
                ScaleQuestions = string.Join(",", scale.Questions),
                ManualScoring  = engine.manualScaleLookup.ContainsKey(scale.Scale).ToString().ToUpper()
            }
            group def by survey.SurveyType into g
            orderby g.Key
                select new
            {
                Survey      = g.Key,
                Definitions = g
            };

            SurveysRptr.DataSource = surveys;
            SurveysRptr.DataBind();
            SurveysRptr.Visible = true;
        }
        private IEnumerable <string> BuildSurveyMappings()
        {
            typesToSurveys.Clear();
            CaisisBreastQEngine engine = new CaisisBreastQEngine();
            var definitions            = engine.GetAllDefinitions();

            foreach (string type in types)
            {
                var surveyTypes = definitions.Where(d => d.SurveyType.Contains(type)).Select(d => d.SurveyType);
                if (surveyTypes.Count() > 0 && !typesToSurveys.ContainsKey(type))
                {
                    typesToSurveys.Add(type, surveyTypes.ToArray());
                }
            }
            return(typesToSurveys.Keys);
        }