private static void LoadDomains(XmlElement root, ref ProInstrument pro) { foreach (XmlElement d in root.GetElementsByTagName("Domain")) { ProDomain dom = new ProDomain(); dom.Name = GetNodeValue(d, "Name"); dom.Description = GetNodeValue(d, "Description"); dom.ScoreFormula = GetNodeValue(d, "ScoreFormula"); dom.ScoringNote = GetNodeValue(d, "ScoringNote"); if (GetNodeValue(d, "BestScore") == "Highest") { dom.HigherIsBetter = true; } else { dom.HigherIsBetter = false; } switch (GetNodeValue(d, "Audience")) { case "Patient": dom.Audience = UserTypes.Patient; break; case "Patient,Physician": dom.Audience = UserTypes.Patient | UserTypes.Physician; break; case "Patient,Researcher": dom.Audience = UserTypes.Patient | UserTypes.Researcher; break; case "Patient,Physician,Researcher": dom.Audience = UserTypes.Patient | UserTypes.Physician | UserTypes.Researcher; break; case "Physician": dom.Audience = UserTypes.Physician; break; case "Physician,Researcher": dom.Audience = UserTypes.Physician | UserTypes.Researcher; break; case "Researcher": dom.Audience = UserTypes.Researcher; break; default: break; } ProDomainResultRange result = new ProDomainResultRange(); result.Start = double.Parse(GetNodeValue(d, "Start")); result.End = double.Parse(GetNodeValue(d, "End")); result.Meaning = GetNodeValue(d, "Meaning"); dom.ResultRanges.Add(result); pro.Domains.Add(dom); } }
public void AddFullProInstrumentTest() { ProInstrument pro = new ProInstrument(); pro.Name = "OES2"; pro.Status = QuestionnaireStatus.Indevelopment; pro.IsActive = true; pro.Tags.Add(new Tag() { TagName = "Gender", Value = "Male" }); pro.Tags.Add(new Tag() { TagName = "Gender", Value = "Female" }); { ProDomain d1 = new ProDomain(); d1.Name = "Total Domain"; d1.Audience = PCHI.Model.Users.UserTypes.Patient; d1.Description = "Hello"; d1.ScoreFormula = "{OES.1} + {OES.2}"; { ProDomainResultRange r1 = new ProDomainResultRange(); r1.Start = 0; r1.End = 10; r1.Meaning = "Great"; d1.ResultRanges.Add(r1); } { ProDomainResultRange r2 = new ProDomainResultRange(); r2.Start = 11; r2.End = 20; r2.Meaning = "Oops"; d1.ResultRanges.Add(r2); } pro.Domains.Add(d1); } { ProDomain d2 = new ProDomain(); d2.Name = "Sleep Domain"; d2.Audience = PCHI.Model.Users.UserTypes.Patient; d2.Description = "Hello"; d2.ScoreFormula = "{OES.1} + {OES.2}"; { ProDomainResultRange r1 = new ProDomainResultRange(); r1.Start = 0; r1.End = 10; r1.Meaning = "Great"; d2.ResultRanges.Add(r1); } { ProDomainResultRange r2 = new ProDomainResultRange(); r2.Start = 11; r2.End = 20; r2.Meaning = "Oops"; d2.ResultRanges.Add(r2); } pro.Domains.Add(d2); } pro.Concept = new QuestionnaireConcept() { Name = "Elbow", Description = "Tests Elbow Condition" }; { QuestionnaireSection section = new QuestionnaireSection() { OrderInInstrument = 1, Questionnaire = pro }; pro.Sections.Add(section); AddTextToSection(section, "Intro1", @"", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); AddTextToSection(section, "Intro2", @"Please make sure you answer all the questions that follow by ticking one option for every question.", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); } { //Dictionary<int, string> options = null; //var options;// = new MyDictionary(); QuestionnaireSection section = new QuestionnaireSection() { OrderInInstrument = 2, Questionnaire = pro }; pro.Sections.Add(section); { // same options apply to items 1 to 4 MyDictionary options = new MyDictionary() { { 4, new ValuesOption() { Action = "", Text = "No difficulty" } }, { 3, new ValuesOption() { Action = "", Text = "A little bit of difficulty" } }, { 2, new ValuesOption() { Action = "", Text = "Moderate difficulty" } }, { 1, new ValuesOption() { Action = "", Text = "Extreme difficulty" } }, { 0, new ValuesOption() { Action = "", Text = "Impossible to do" } } }; QuestionnaireItem qi = AddItemToSection(section, "OES.1", "1.", @"<strong>During the past 4 weeks</strong>, have you had difficulty lifting things in your home, such as putting out the rubbish, <u>because of your elbow problem</u>?", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); AddOptionGroupToItem(qi, options, 0, QuestionnaireResponseType.List); qi = AddItemToSection(section, "OES.2", "2.", @"<strong>During the past 4 weeks</strong>, have you had difficulty lifting things in your home, such as putting out the rubbish, <u>because of your elbow problem</u>?", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); AddOptionGroupToItem(qi, options, 0, QuestionnaireResponseType.List); qi = AddItemToSection(section, "OES.3", "3.", @"<strong>During the past 4 weeks</strong>, have you had difficulty washing yourself all over, <u>because of your elbow problem</u>?", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); AddOptionGroupToItem(qi, options, 0, QuestionnaireResponseType.List); qi = AddItemToSection(section, "OES.4", "4.", @"<strong>During the past 4 weeks</strong>, have you had difficulty dressing yourself, <u>because of your elbow problem</u>?", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); AddOptionGroupToItem(qi, options, 0, QuestionnaireResponseType.List); qi = AddItemToSection(section, "OES.5", "5.", @"How difficult is for you to get up and down off the floor/gound?", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); options = new MyDictionary() { { 0, new ValuesOption() { Action = "", Text = "Extreme difficulty" } }, { 100, new ValuesOption() { Action = "", Text = "No difficulty at all" } } }; AddOptionGroupToItem(qi, options, 10, QuestionnaireResponseType.Range); qi = AddItemToSection(section, "OES.6", "6.", @"How much trouble do you have with sexual activity because of your hip?", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); options = new MyDictionary() { { 0, new ValuesOption() { Action = "MakeItemNotApplicable", Text = "This is not relevant to me" } } }; AddOptionGroupToItem(qi, options, 0, QuestionnaireResponseType.ConditionalItem); options = new MyDictionary() { { 0, new ValuesOption() { Action = "", Text = "Several trouble" } }, { 100, new ValuesOption() { Action = "", Text = "No trouble at all" } } }; AddOptionGroupToItem(qi, options, 10, QuestionnaireResponseType.Range); qi = AddItemToSection(section, "OES.7", "7.", @"How much trouble do you have pushing, pulling, lifting or carrying heavy objects at work?", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); options = new MyDictionary() { { 0, new ValuesOption() { Action = "MakeItemNotApplicable", Text = "I do not do these actions in my activities" } } }; AddOptionGroupToItem(qi, options, 0, QuestionnaireResponseType.ConditionalItem); options = new MyDictionary() { { 0, new ValuesOption() { Action = "", Text = "Several trouble" } }, { 100, new ValuesOption() { Action = "", Text = "No trouble at all" } } }; AddOptionGroupToItem(qi, options, 10, QuestionnaireResponseType.Range); qi = AddItemToSection(section, "OES.8", "8.", @"How concern are you about cutting/changing directions during your sport or recreational activities?", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); options = new MyDictionary() { { 0, new ValuesOption() { Action = "MakeItemNotApplicable", Text = "I do not do this action in my activities" } } }; AddOptionGroupToItem(qi, options, 0, QuestionnaireResponseType.ConditionalItem); options = new MyDictionary() { { 0, new ValuesOption() { Action = "", Text = "Extremly concerned" } }, { 100, new ValuesOption() { Action = "", Text = "Not concerned at all" } } }; AddOptionGroupToItem(qi, options, 10, QuestionnaireResponseType.Range); qi = AddItemToSection(section, "OES.9", "9.", @"Please indicate the sport or instrument which is most important to you:", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); options = new MyDictionary() { { 0, new ValuesOption() { Action = "", Text = "" } } }; AddOptionGroupToItem(qi, options, 0, QuestionnaireResponseType.Text); qi = AddItemToSection(section, "OES.10", "10.", @"Enter your comments below:", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); AddOptionGroupToItem(qi, options, 0, QuestionnaireResponseType.Text); //Part to add the definition for the body control qi = AddItemToSection(section, "OES.11", "11.", @"Select the parts of your body with some kind of mal functioning:", Platform.Classic | Platform.Chat, Instance.Baseline | Instance.Followup); options = new MyDictionary() { { 0, new ValuesOption() { Action = "", Text = "Burning" } }, { 1, new ValuesOption() { Action = "", Text = "Numbness" } }, { 2, new ValuesOption() { Action = "", Text = "Pins-Needles" } }, { 3, new ValuesOption() { Action = "", Text = "Stabbing" } }, { 4, new ValuesOption() { Action = "", Text = "Ache" } } }; AddOptionGroupToItem(qi, options, 0, QuestionnaireResponseType.MultiSelect); //Optiongroup for each body part /* * qiog1.OrderInItem = 1; * { * qiog1.Options.Add(new QuestionnaireItemOption() { Text = "None", Value = 0, Group = qiog1 }); * qiog1.Options.Add(new QuestionnaireItemOption() { Text = "Mild", Value = 1, Group = qiog1 }); * qiog1.Options.Add(new QuestionnaireItemOption() { Text = "Moderate", Value = 2, Group = qiog1 }); * qiog1.Options.Add(new QuestionnaireItemOption() { Text = "Severe", Value = 3, Group = qiog1 }); * qiog1.Options.Add(new QuestionnaireItemOption() { Text = "Unbearable", Value = 4, Group = qiog1 }); * qiog1.Item = q1; * } * * q1.OptionGroups.Add(qiog1); * section.Elements.Add(q1); * q1.Section = section; * */ } } { QuestionnaireSection section = new QuestionnaireSection() { OrderInInstrument = 3, Questionnaire = pro }; pro.Sections.Add(section); AddTextToSection(section, "Footer1", @"Thank you for answering. You are done now and the results will be reported to your physician.", Platform.Classic, Instance.Baseline | Instance.Followup); AddTextToSection(section, "Footer1", @"Thank you for answering. You are done now and I will evaluate the results as soon as possible.", Platform.Chat, Instance.Baseline | Instance.Followup); } new AccessHandlerManager().QuestionnaireAccessHandler.AddFullQuestionnaire(pro); }