Example #1
0
        public Group()
        {
            InstanceId = IDUtils.NewGuid();
            Id         = IDUtils.NewGuid();
            this.studyUnitRelPathNames = new List <string>();
            ConceptSchemeCompareTable  = new CompareTable()
            {
                CompareType = CompareTable.CompareTypes.ConceptScheme
            };
            ConceptCompareTable = new CompareTable()
            {
                CompareType = CompareTable.CompareTypes.Concept
            };
            VariableCompareTable = new CompareTable()
            {
                CompareType = CompareTable.CompareTypes.Variable
            };
            PurposeId       = IDUtils.NewGuid();
            ComparisonId    = IDUtils.NewGuid();
            SharedStudyUnit = new StudyUnit(); //Variables to be shared within the group
            SharedStudyUnit.Abstract.Title = SHARED_STUDY_UNIT_TITLE;
            Organization organization = new Organization();
            Member       member       = new Member();

            member.OrganizationId = organization.Id;
            SharedStudyUnit.AddMember(member);
            SharedStudyUnit.AddOrganization(organization);

            SharedStudyUnit.Samplings.Add(new Sampling());
            SharedStudyUnit.Samplings[0].MemberId  = member.Id;
            SharedStudyUnit.Samplings[0].DateRange = new DateRange(DateTime.Today, DateTime.Today);
        }
Example #2
0
        public static EDOModel createDefault(bool minimum = false)
        {
            EDOModel  data   = new EDOModel();
            StudyUnit study1 = StudyUnit.CreateDefault(minimum);

            data.StudyUnits.Add(study1);
            return(data);
        }
Example #3
0
        public static void CreateAbstract(XElement studyUnitElem, StudyUnit studyUnit)
        {
            ///// タイトル
            Abstract abstractModel = new Abstract();
            XElement citationElem = studyUnitElem.Element(r + TAG_CITATION);
            if (citationElem == null)
            {
                return;
            }
            XElement titleElement = citationElem.Element(r + TAG_TITLE);
            if (titleElement == null)
            {
                return;
            }
            abstractModel.Title = titleElement.Value;

            ///// 概要
            XElement abstractElem = studyUnitElem.Element(s + TAG_ABSTRACT);
            if (abstractElem == null)
            {
                return;
            }
            XAttribute summaryIdAttr = abstractElem.Attribute(ATTR_ID);
            if (summaryIdAttr == null)
            {
                return;
            }
            XElement contentElem = abstractElem.Element(r + TAG_CONTENT);
            if (contentElem == null)
            {
                return;
            }
            abstractModel.SummaryId = summaryIdAttr.Value;
            abstractModel.Summary = contentElem.Value;

            ///// 目的
            XElement purposeElem = studyUnitElem.Element(s + TAG_PURPOSE);
            if (purposeElem == null)
            {
                return;
            }
            XAttribute purposeIdAttr = purposeElem.Attribute(ATTR_ID);
            if (purposeIdAttr == null)
            {
                return;
            }
            contentElem = purposeElem.Element(r + TAG_CONTENT);
            if (contentElem == null)
            {
                return;
            }
            abstractModel.PurposeId = purposeIdAttr.Value;
            abstractModel.Purpose = contentElem.Value;
            studyUnit.Abstract = abstractModel;
        }
        public SelectStudyUnitWindowVM(EDOModel fromModel, EDOModel toModel, StudyUnit curStudyUnit, DDIImportOption importOption)
        {
            this.fromModel = fromModel;
            this.toModel = toModel;
            fromStudyUnits = new ObservableCollection<StudyUnit>(fromModel.StudyUnits);
            this.FromStudyUnit = fromModel.StudyUnits.FirstOrDefault();
            toStudyUnits = new ObservableCollection<StudyUnit>(toModel.StudyUnits);
            this.ToStudyUnit = curStudyUnit;

            this.importOption = importOption;
        }
Example #5
0
        public Group()
        {
            InstanceId = IDUtils.NewGuid();
            Id = IDUtils.NewGuid();
            this.studyUnitRelPathNames = new List<string>();
            ConceptSchemeCompareTable = new CompareTable() { CompareType = CompareTable.CompareTypes.ConceptScheme };
            ConceptCompareTable = new CompareTable() { CompareType = CompareTable.CompareTypes.Concept };
            VariableCompareTable = new CompareTable() { CompareType = CompareTable.CompareTypes.Variable };
            PurposeId = IDUtils.NewGuid();
            ComparisonId = IDUtils.NewGuid();
            SharedStudyUnit = new StudyUnit(); //グループ内で共有する変数など
            SharedStudyUnit.Abstract.Title = SHARED_STUDY_UNIT_TITLE;
            Organization organization = new Organization();
            Member member = new Member();
            member.OrganizationId = organization.Id;
            SharedStudyUnit.AddMember(member);
            SharedStudyUnit.AddOrganization(organization);

            SharedStudyUnit.Samplings.Add(new Sampling());
            SharedStudyUnit.Samplings[0].MemberId = member.Id;
            SharedStudyUnit.Samplings[0].DateRange = new DateRange(DateTime.Today, DateTime.Today);
        }
Example #6
0
        /// <summary>
        /// デフォルト設定を適用したStudyUnitを作成します。minimunをtrueにすると、最低限の設定のみを行ったStudyUnitを返します。
        /// </summary>
        /// <param name="minimum">設定を最低限にするかどうか</param>
        /// <returns>デフォルト設定を適用したStudyUnit</returns>
        public static StudyUnit CreateDefault(bool minimum = false)
        {
            StudyUnit studyUnit = new StudyUnit();
            int       i         = 1;

            if (!minimum)
            {
                foreach (Option option in Options.EventTypes)
                {
                    studyUnit.Events.Add(new Event()
                    {
                        Title = option.Label, No = i++
                    });
                }
                studyUnit.FundingInfos.Add(new FundingInfo());
                studyUnit.Samplings.Add(new Sampling());
                studyUnit.ConceptSchemes.Add(new ConceptScheme());
                ControlConstructScheme scheme = new ControlConstructScheme();
                studyUnit.ControlConstructSchemes.Add(scheme);
                studyUnit.DefaultControlConstructSchemeId = scheme.Id;
                DataSet dataSet = new DataSet();
                dataSet.Title = EDOConstants.LABEL_ALL;
                dataSet.Memo  = Resources.AllDataSet; //All variables
                studyUnit.DefaultDataSetId = dataSet.Id;
                studyUnit.DataSets.Add(dataSet);

                dataSet.IsCreatedDataFile = true;
                DataFile dataFile = DataFile.createDataFile();
                dataFile.DataSetId = dataSet.Id;
                studyUnit.DataFiles.Add(dataFile);

                studyUnit.CreateBinaryCodeScheme();
            }

            studyUnit.Coverage = Coverage.CreateDefault();

            return(studyUnit);
        }
Example #7
0
        public static void CreateBooks(XElement studyUnitElement, StudyUnit studyUnit)
        {
            List<Book> allBooks = new List<Book>();

            //概要と関連づいているもの(StudyUnit直下)
            List<Book> abstractBooks = CreateBooksFrom(studyUnitElement, studyUnit);
            allBooks.AddRange(abstractBooks);

            //変数のイメージと関連づいているもの(ConceptualComponentの下)
            XElement conceptualComponentElem = studyUnitElement.Element(c + TAG_CONCEPTUAL_COMPONENT);
            List<Book> conceptBooks = CreateBooksFrom(conceptualComponentElem, studyUnit);
            allBooks.AddRange(conceptBooks);

            //質問と関連づいているもの
            XElement dataCollectionElem = studyUnitElement.Element(d + TAG_DATA_COLLECTION);
            List<Book> questionBooks = CreateBooksFrom(dataCollectionElem, studyUnit);
            allBooks.AddRange(questionBooks);

            //変数と関連づいているもの
            XElement logicalProductElem = studyUnitElement.Element(l + TAG_LOGICAL_PRODUCT);
            List<Book> variableBooks = CreateBooksFrom(logicalProductElem, studyUnit);
            allBooks.AddRange(variableBooks);

            List<Book> uniqBooks = new List<Book>();
            foreach (Book book in allBooks)
            {
                Book existBook = Book.FindByTitle(uniqBooks, book.Title);
                if (existBook == null)
                {
                    uniqBooks.Add(book);
                }
            }

            if (uniqBooks.Count > 0)
            {
                studyUnit.Books = uniqBooks;
            }
        }
Example #8
0
 public static void CreateEvents(XElement studyUnitElem, StudyUnit studyUnit)
 {
     //イベントの読み込み
     XElement lifeInfoElem = studyUnitElem.Descendants(r + TAG_LIFECYCLE_INFORMATION).FirstOrDefault();
     if (lifeInfoElem == null)
     {
         return;
     }
     List<Event> eventModels = new List<Event>();
     IEnumerable<XElement> elements = lifeInfoElem.Elements(r + TAG_LIFECYCLE_EVENT);
     foreach (XElement lifeEventElem in elements)
     {
         Event eventModel = CreateEvent(lifeEventElem);
         if (eventModel != null)
         {
             ////タイトルで検索して同じものは削除しておく(DefaultStudyUnitで作られているものを想定)。
             //Event.RemoveByTitle(studyUnit.Events, eventModel.Title);
             eventModels.Add(eventModel);
         }
     }
     if (eventModels.Count > 0)
     {
         studyUnit.Events = eventModels;
     }
 }
Example #9
0
 public static void CreateDataSets(XElement studyUnitElem, StudyUnit studyUnit)
 {
     XElement logicalProductElem = studyUnitElem.Element(l + TAG_LOGICAL_PRODUCT);
     if (logicalProductElem == null)
     {
         return;
     }
     string logicalProductId = (string)logicalProductElem.Attribute(ATTR_ID);
     if (logicalProductId == null)
     {
         return;
     }
     XElement dataRelationshipElem = logicalProductElem.Element(l + TAG_DATA_RELATIONSHIP);
     if (dataRelationshipElem == null)
     {
         return;
     }
     string dataRelationShipId = (string)dataRelationshipElem.Attribute(ATTR_ID);
     if (dataRelationShipId == null)
     {
         return;
     }
     List<DataSet> dataSetModels = new List<DataSet>();
     IEnumerable<XElement> elements = dataRelationshipElem.Elements(l + TAG_LOGICAL_RECORD);
     foreach (XElement logicalRecordElem in elements)
     {
         DataSet dataSetModel = CreateDataSet(logicalRecordElem);
         if (dataSetModel != null)
         {
             dataSetModels.Add(dataSetModel);
         }
     }
     studyUnit.LogicalProductId = logicalProductId;
     studyUnit.DataCollectionId = dataRelationShipId;
     if (dataSetModels.Count > 0)
     {
         studyUnit.DataSets = dataSetModels;
     }
 }
Example #10
0
        public static void CreateDataFiles(XElement studyUnitElem, StudyUnit studyUnit)
        {
            XElement physicalDataProductElem = studyUnitElem.Element(p + TAG_PHYSICAL_DATA_PRODUCT);
            if (physicalDataProductElem == null)
            {
                return;
            }
            string physicalDataProductId = (string)physicalDataProductElem.Attribute(ATTR_ID);
            if (physicalDataProductId == null)
            {
                return;
            }
            XElement physicalStructureSchemeElem = physicalDataProductElem.Element(p + TAG_PHYSICAL_STRUCTURE_SCHEME);
            if (physicalStructureSchemeElem == null)
            {
                return;
            }
            string physicalStructureSchemeId = (string)physicalStructureSchemeElem.Attribute(ATTR_ID);
            if (physicalStructureSchemeId == null)
            {
                return;
            }
            XElement recordLayoutSchemeElem = physicalDataProductElem.Element(p + TAG_RECORD_LAYOUT_SCHEME);
            if (recordLayoutSchemeElem == null)
            {
                return;
            }
            string recordLayoutSchemeId = (string)recordLayoutSchemeElem.Attribute(ATTR_ID);
            if (recordLayoutSchemeId == null)
            {
                return;
            }

            List<DataFile> dataFileModels = new List<DataFile>();
            IEnumerable<XElement> physicalStructureElems = physicalStructureSchemeElem.Elements(p + TAG_PHYSICAL_STRUCTURE);
            IEnumerable<XElement> recordLayoutElems = recordLayoutSchemeElem.Descendants(p + TAG_RECORD_LAYOUT);
            IEnumerable<XElement> physicalInstanceElems = studyUnitElem.Descendants(pi + TAG_PHYSICAL_INSTANCE);
            foreach (XElement physicalStructureElem in physicalStructureElems)
            {
                DataFile dataFileModel = CreateDataFile(physicalStructureElem, recordLayoutElems, physicalInstanceElems);
                if (dataFileModel != null)
                {
                    dataFileModels.Add(dataFileModel);
                }
            }

            studyUnit.PhysicalDataProductId = physicalDataProductId;
            studyUnit.PhysicalStructureSchemeId = physicalStructureSchemeId;
            studyUnit.RecordLayoutSchemeId = recordLayoutSchemeId;
            if (dataFileModels.Count > 0)
            {
                studyUnit.DataFiles = dataFileModels;
            }
        }
Example #11
0
 private void MergeFundingInfo(StudyUnit newStudyUnit, StudyUnit curStudyUnit)
 {
     curStudyUnit.FundingInfos.AddRange(newStudyUnit.FundingInfos);
 }
Example #12
0
 private StudyUnitVM createStudyUnit(StudyUnit studyUnitModel)
 {
     StudyUnitVM studyUnit = new StudyUnitVM(this, studyUnitModel) {
         OrderNo = EDOUtils.GetMaxOrderNo<StudyUnitVM>(StudyUnits) + 1,
         OrderPrefix = "StudyUnit"
     };
     studyUnit.InitTitle();
     studyUnit.PropertyChanged += new PropertyChangedEventHandler(StudyUnitPropertyChangedEventHandler);
     return studyUnit;
 }
Example #13
0
 public static void CreateQuestions(XElement studyUnitElem, StudyUnit studyUnit)
 {
     XElement questionSchemeElem = studyUnitElem.Descendants(d + TAG_QUESTION_SCHEME).FirstOrDefault();
     if (questionSchemeElem == null)
     {
         return;
     }
     string questionSchemeId = (string)questionSchemeElem.Attribute(ATTR_ID);
     List<Question> questionModels = new List<Question>();
     IEnumerable<XElement> elements = questionSchemeElem.Elements(d + TAG_QUESTION_ITEM);
     foreach (XElement questionItem in elements)
     {
         Question questionModel = CreateQuestion(questionItem);
         if (questionModel != null)
         {
             questionModels.Add(questionModel);
         }
     }
     List<QuestionGroup> questionGroupModels = new List<QuestionGroup>();
     elements = questionSchemeElem.Elements(d + TAG_MULTIPLE_QUESTION_ITEM);
     foreach (XElement questionGroupElem in elements)
     {
         List<Question> questionModelsInGroup = new List<Question>();
         QuestionGroup questionGroupModel = CreateQuestionGroup(questionGroupElem, questionModelsInGroup);
         if (questionModelsInGroup != null)
         {
             questionGroupModels.Add(questionGroupModel);
             questionModels.AddRange(questionModelsInGroup);
         }
     }
     studyUnit.QuestionSchemeId = questionSchemeId;
     if (questionModels.Count > 0)
     {
         studyUnit.Questions = questionModels;
     }
     if (questionGroupModels.Count > 0)
     {
         studyUnit.QuestionGroups = questionGroupModels;
     }
 }
Example #14
0
 public static void CreateMembers(XElement studyUnitElem, StudyUnit studyUnit)
 {
     List<Member> members = new List<Member>();
     IEnumerable<XElement> elements = studyUnitElem.Descendants(a + TAG_INDIVIDUAL);
     foreach (XElement individualElem in elements)
     {
         Member memberModel = CreateMember(individualElem);
         if (memberModel != null && studyUnit.FindOrganization(memberModel.OrganizationId) != null)
         {
             members.Add(memberModel);
         }
     }
     if (members.Count > 0)
     {
         studyUnit.Members = members;
     }
 }
Example #15
0
 private void MergeVariable(StudyUnit newStudyUnit, StudyUnit curStudyUnit)
 {
     curStudyUnit.Variables.AddRange(newStudyUnit.Variables);
 }
Example #16
0
 private void MergeDataSet(StudyUnit newStudyUnit, StudyUnit curStudyUnit)
 {
     if (newStudyUnit.DataSets.Count > 0 && newStudyUnit.DataSets[0].Title == EDOConstants.LABEL_ALL)
     {
         newStudyUnit.DataSets.RemoveAt(0);
     }
     curStudyUnit.DataSets.AddRange(newStudyUnit.DataSets);
 }
Example #17
0
        private void MergeStudyUnit(StudyUnit newStudyUnit, StudyUnit curStudyUnit, DDIImportOption importOption)
        {
            DDIUtils.RenameIds(curStudyUnit, newStudyUnit);
            //イベント
            if (importOption.ImportEvent)
            {
                MergeEvent(newStudyUnit, curStudyUnit);
            }

            //調査メンバー
            if (importOption.ImportMember)
            {
                MergeMember(newStudyUnit, curStudyUnit);
            }

            //調査の概要
            if (importOption.ImportAbstract)
            {
                MergeAbstract(newStudyUnit, curStudyUnit);
            }

            //調査の範囲
            if (importOption.ImportCoverage)
            {
                MergeCoverage(newStudyUnit, curStudyUnit);
            }

            //研究資金
            if (importOption.ImportFundingInfo)
            {
                MergeFundingInfo(newStudyUnit, curStudyUnit);
            }

            //データの収集法法
            if (importOption.ImportSampling)
            {
                MergeSampling(newStudyUnit, curStudyUnit);
            }

            //変数のイメージ
            if (importOption.ImportConcept)
            {
                MergeConcept(newStudyUnit, curStudyUnit);
            }

            //質問
            if (importOption.ImportQuestion)
            {
                MergeQuestion(newStudyUnit, curStudyUnit);
            }

            //選択肢
            if (importOption.ImportCategory)
            {
                MergeCategory(newStudyUnit, curStudyUnit);
            }

            //コード
            if (importOption.ImportCode)
            {
                MergeCode(newStudyUnit, curStudyUnit);
            }

            //順序
            if (importOption.ImportQuestion)
            {
                MergeSequence(newStudyUnit, curStudyUnit);
            }

            if (importOption.ImportQuestionGroup)
            {
                MergeQuestionGroup(newStudyUnit, curStudyUnit);
            }

            //変数
            if (importOption.ImportVariable)
            {
                MergeVariable(newStudyUnit, curStudyUnit);
            }

            //データセット
            if (importOption.ImportDataSet)
            {
                MergeDataSet(newStudyUnit, curStudyUnit);
            }

            //データファイル
            if (importOption.ImportDataFile)
            {
                MergeDataFile(newStudyUnit, curStudyUnit);
            }

            //関連文献
            if (importOption.ImportBook)
            {
                MergeBook(newStudyUnit, curStudyUnit);
            }
        }
Example #18
0
 private void MergeSequence(StudyUnit newStudyUnit, StudyUnit curStudyUnit)
 {
     curStudyUnit.ControlConstructSchemes.AddRange(newStudyUnit.ControlConstructSchemes);
 }
Example #19
0
 private void MergeSampling(StudyUnit newStudyUnit, StudyUnit curStudyUnit)
 {
     curStudyUnit.Samplings.AddRange(newStudyUnit.Samplings);
 }
Example #20
0
 private void MergeQuestionGroup(StudyUnit newStudyUnit, StudyUnit curStudyUnit)
 {
     curStudyUnit.QuestionGroups.AddRange(newStudyUnit.QuestionGroups);
 }
Example #21
0
 private void MergeMember(StudyUnit newStudyUnit, StudyUnit curStudyUnit)
 {
     //メンバーを追加
     if (curStudyUnit.Members.Count > 0)
     {
         //既にメンバーが存在する場合インポートするメンバーの中の調査代表者をその他に変更する。
         //(調査代表者はメンバーの中に一人に限定されているため)
         newStudyUnit.DisableDaihyosha();
     }
     curStudyUnit.Members.AddRange(newStudyUnit.Members);
     //組織を追加(メンバーフォームでは組織名をつかって検索するのでユニークにしないとまずい
     foreach (Organization organization in newStudyUnit.Organizations)
     {
         List<string> existNames = Organization.GetOrganizationNames(curStudyUnit.Organizations);
         organization.OrganizationName = EDOUtils.UniqueLabel(existNames, organization.OrganizationName);
         curStudyUnit.Organizations.Add(organization);
     }
 }
Example #22
0
 public static void CreateFundingInfos(XElement studyUnitElem, StudyUnit studyUnit)
 {
     List<FundingInfo> fundingInfoModels = new List<FundingInfo>();
     IEnumerable<XElement> elements = studyUnitElem.Elements(r + TAG_FUNDING_INFORMATION);
     foreach (XElement fundingInfoElem in elements)
     {
         FundingInfo fundingInfoModel = CreateFundingInfo(fundingInfoElem, studyUnit.Organizations);
         if (fundingInfoModel != null)
         {
             fundingInfoModels.Add(fundingInfoModel);
         }
     }
     if (fundingInfoModels.Count > 0)
     {
         studyUnit.FundingInfos = fundingInfoModels;
     }
 }
Example #23
0
        public static void CreateConceptSchemes(XElement studyUnitElem, StudyUnit studyUnit)
        {
            XElement conceptualComponentElem = studyUnitElem.Element(c + TAG_CONCEPTUAL_COMPONENT);
            if (conceptualComponentElem == null)
            {
                return;
            }
            string conceptualComponentId = (string)conceptualComponentElem.Attribute(ATTR_ID);
            if (conceptualComponentId == null)
            {
                return;
            }
            List<ConceptScheme> conceptSchemeModels = new List<ConceptScheme>();
            IEnumerable<XElement> elements = conceptualComponentElem.Elements(c + TAG_CONCEPT_SCHEME);
            foreach (XElement conceptSchemeElem in elements)
            {
                ConceptScheme conceptSchemeModel = CreateConceptScheme(conceptSchemeElem);
                if (conceptSchemeModel != null)
                {
                    conceptSchemeModels.Add(conceptSchemeModel);
                }
            }
            studyUnit.ConceptualComponentId = conceptualComponentId;
            if (conceptSchemeModels.Count > 0)
            {
                studyUnit.ConceptSchemes = conceptSchemeModels;
            }

            XElement geographicStructureSchemeElem = conceptualComponentElem.Element(c + TAG_GEOGRAPHIC_STRUCTURE_SCHEME);
            if (geographicStructureSchemeElem != null)
            {
                studyUnit.GeographicStructureSchemeId = (string)geographicStructureSchemeElem.Attribute(ATTR_ID);
            }
        }
Example #24
0
        private static readonly string SHARED_STUDY_UNIT_TITLE = Resources.CommonItem; //Common Item

        public static bool IsSharedStudyUnit(StudyUnit studyUnit)
        {
            return(studyUnit.Abstract.Title == SHARED_STUDY_UNIT_TITLE);
        }
Example #25
0
        public static void CreateOrganizations(XElement studyUnitElem, StudyUnit studyUnit)
        {
            XElement archiveElem = studyUnitElem.Element(a + TAG_ARCHIVE);
            if (archiveElem == null)
            {
                return;
            }
            string archiveId = (string)archiveElem.Attribute(ATTR_ID);
            if (archiveId == null)
            {
                return;
            }
            XElement organizationSchemeElem = archiveElem.Element(a + TAG_ORGANIZATION_SCHEME);
            if (organizationSchemeElem == null)
            {
                return;
            }
            string organizationSchemeId = (string)organizationSchemeElem.Attribute(ATTR_ID);
            if (organizationSchemeId == null)
            {
                return;
            }

            List<Organization> organizationModels = new List<Organization>();
            IEnumerable<XElement> elements = organizationSchemeElem.Elements(a + TAG_ORGANIZATION);
            foreach (XElement organizationElem in elements)
            {
                Organization organizationModel = CreateOrganization(organizationElem);
                if (organizationModel != null)
                {
                    organizationModels.Add(organizationModel);
                }
            }
            studyUnit.ArchiveId = archiveId;
            studyUnit.OrganizationSchemeId = organizationSchemeId;
            if (organizationModels.Count > 0)
            {
                studyUnit.Organizations = organizationModels;
            }
        }
Example #26
0
        private void MergeCoverage(StudyUnit newStudyUnit, StudyUnit curStudyUnit)
        {
            //調査範囲のマージは部分ごとに異なる
            Coverage newCoverage = newStudyUnit.Coverage;
            Coverage curCoverage = curStudyUnit.Coverage;

            //1.調査のトピック
            CheckOption.Merge(newCoverage.Topics, curCoverage.Topics);

            //2.キーワード
            curCoverage.Keywords.AddRange(newCoverage.Keywords);

            //3.カバーする時期
            curCoverage.DateRange = newCoverage.DateRange;

            //4.カバーする地域のレベル
            CheckOption.Merge(newCoverage.Areas, curCoverage.Areas);

            //5.メモ
            curCoverage.Memo = newCoverage.Memo;
        }
Example #27
0
 private void MergeDataFile(StudyUnit newStudyUnit, StudyUnit curStudyUnit)
 {
     int upper = newStudyUnit.DataFiles.Count - 1;
     for (int i = upper; i >= 0; i--)
     {
         DataFile dataFile = newStudyUnit.DataFiles[i];
         if (newStudyUnit.FindDataSet(dataFile.DataSetId) == null)
         {
             newStudyUnit.DataFiles.RemoveAt(i);
         }
     }
     curStudyUnit.DataFiles.AddRange(newStudyUnit.DataFiles);
 }
Example #28
0
        public static void CreateCoverage(XElement studyUnitElem, StudyUnit studyUnit)
        {
            XElement coverageElem = studyUnitElem.Element(r + TAG_COVERAGE);
            if (coverageElem == null)
            {
                return;
            }
            Coverage coverageModel = Coverage.CreateDefault();
            XElement topicElem = coverageElem.Element(r + TAG_TOPICAL_COVERAGE);
            if (topicElem != null)
            {
                //調査のトピック
                IEnumerable<XElement> elements = topicElem.Elements(r + TAG_SUBJECT);
                List<string> labels = new List<string>();
                foreach (XElement subjectElem in elements)
                {
                    labels.Add(subjectElem.Value);
                }
                coverageModel.CheckTopics(labels);

                //キーワード
                elements = topicElem.Elements(r + TAG_KEYWORD);
                foreach (XElement keywordElem in elements)
                {
                    Keyword keyword = new Keyword()
                    {
                        Content = keywordElem.Value
                    };
                    coverageModel.Keywords.Add(keyword);
                }
            }

            //調査の日付
            XElement temporalElem = coverageElem.Element(r + TAG_TEMPORAL_COVERAGE);
            if (temporalElem != null)
            {
                coverageModel.DateRange = ReadDateRange(temporalElem, r + TAG_REFERENCE_DATE);
            }

            //メモ
            XElement spatialElem = coverageElem.Element(r + TAG_SPATIAL_COVERAGE);
            if (spatialElem != null)
            {
                //カバーする地域のレベル
                Dictionary<string, string> labelDict = ReadGeographicStructureElems(studyUnitElem);

                List<string> checkLabels = new List<string>();
                IEnumerable<XElement> elements = spatialElem.Elements(r + TAG_GEOGRAPHIC_STRUCTURE_REFERENCE);
                foreach (XElement refElem in elements)
                {
                    string refId = (string)refElem.Element(r + TAG_ID);
                    if (refId == null)
                    {
                        continue;
                    }
                    string code = IDUtils.ToCode(refId);
                    if (code == null)
                    {
                        continue;
                    }
                    if (!labelDict.ContainsKey(refId))
                    {
                        continue;
                    }
                    string label = labelDict[refId];
                    checkLabels.Add(label);
                }
                coverageModel.CheckAreas(checkLabels);

                //メモ
                string memo = (string)spatialElem.Element(r + TAG_DESCRIPTION);
                coverageModel.Memo = memo;
            }

            studyUnit.Coverage = coverageModel;
        }
Example #29
0
 private StudyUnitVM AddStudyUnit(StudyUnit studyUnitModel)
 {
     edoModel.StudyUnits.Add(studyUnitModel);
     StudyUnitVM studyUnit = createStudyUnit(studyUnitModel);
     edoUnits.Add(studyUnit);
     Memorize();
     return studyUnit;
 }
Example #30
0
 private void MergeEvent(StudyUnit newStudyUnit, StudyUnit curStudyUnit)
 {
     //イベントを単純に追加
     curStudyUnit.Events.AddRange(newStudyUnit.Events);
 }
Example #31
0
        public static ControlConstructScheme CreateControlConstructScheme(XElement controlConstructSchemeElem, StudyUnit studyUnit)
        {
            string id = (string)controlConstructSchemeElem.Attribute(ATTR_ID);
            if (id == null)
            {
                return null;
            }
            ControlConstructScheme controlConstructSchemeModel = new ControlConstructScheme();
            controlConstructSchemeModel.Title = (string)controlConstructSchemeElem.Element(d + TAG_CONTROL_CONSTRUCT_SCHEME_NAME);
            IEnumerable<XElement> questionConstructElems = controlConstructSchemeElem.Elements(d + TAG_QUESTION_CONSTRUCT);
            foreach (XElement questionConstructElem in questionConstructElems)
            {
                string questionConstructId = (string)questionConstructElem.Attribute(ATTR_ID);
                if (questionConstructId == null)
                {
                    continue;
                }
                string questionId = ReadReferenceID(questionConstructElem, d + TAG_QUESTION_REFERENCE);
                if (questionId == null)
                {
                    continue;
                }
                string no = (string)questionConstructElem.Element(r + TAG_LABEL);
                if (no == null)
                {
                    continue;
                }
                if (studyUnit.FindQuestion(questionId) != null)
                {
                    QuestionConstruct questionConstruct = new QuestionConstruct();
                    questionConstruct.Id = questionConstructId;
                    questionConstruct.No = no;
                    questionConstruct.QuestionId = questionId;
                    controlConstructSchemeModel.QuestionConstructs.Add(questionConstruct);

                }
                else if (studyUnit.FindQuestionGroup(questionId) != null)
                {
                    QuestionGroupConstruct questionGroupConstruct = new QuestionGroupConstruct();
                    questionGroupConstruct.Id = questionConstructId;
                    questionGroupConstruct.No = no;
                    questionGroupConstruct.QuestionGroupId = questionId;
                    controlConstructSchemeModel.QuestionGroupConstructs.Add(questionGroupConstruct);
                }

            }

            IEnumerable<XElement> statementItemElems = controlConstructSchemeElem.Elements(d + TAG_STATEMENT_ITEM);
            foreach (XElement statementItemElem in statementItemElems)
            {
                string statementId = (string)statementItemElem.Attribute(ATTR_ID);
                if (statementId == null)
                {
                    continue;
                }
                string no = (string)statementItemElem.Attribute(r + TAG_LABEL);
                if (no == null)
                {
                    continue;
                }
                Statement statement = new Statement();
                statement.Id = statementId;
                statement.No = no;
                XElement textElem = statementItemElem.Descendants(d + TAG_TEXT).FirstOrDefault();
                if (textElem != null)
                {
                    statement.Text = textElem.Value;
                }
                controlConstructSchemeModel.Statements.Add(statement);
            }

            IEnumerable<XElement> ifThenElseElems = controlConstructSchemeElem.Elements(d + TAG_IF_THEN_ELSE);
            foreach (XElement ifThenElseElem in ifThenElseElems)
            {
                string ifThenElseId = (string)ifThenElseElem.Attribute(ATTR_ID);
                if (ifThenElseId == null)
                {
                    continue;
                }
                XElement ifConditionElem = ifThenElseElem.Element(d + TAG_IF_CONDITION);
                if (ifConditionElem == null)
                {
                    continue;
                }
                string thenConstructId = ReadReferenceID(ifThenElseElem, d + TAG_THEN_CONSTRUCT_REFERENCE);
                if (thenConstructId == null)
                {
                    continue;
                }

                IfThenElse ifThenElse = new IfThenElse();
                ifThenElse.Id = ifThenElseId;
                ifThenElse.No = ControlConstructScheme.IFTHENELSE_NO;
                ifThenElse.IfCondition.Code = (string)ifConditionElem.Element(r + TAG_CODE);
                ifThenElse.IfCondition.QuestionId = ReadReferenceID(ifConditionElem, r + TAG_SOURCE_QUESTION_REFERENCE);
                ifThenElse.ThenConstructId = thenConstructId;
                controlConstructSchemeModel.IfThenElses.Add(ifThenElse);

                IEnumerable<XElement> elseIfElems = ifThenElseElem.Elements(d + TAG_ELSE_IF);
                foreach (XElement elseIfElem in elseIfElems)
                {
                    XElement ifConditionElem2 = elseIfElem.Element(d + TAG_IF_CONDITION);
                    if (ifConditionElem2 == null)
                    {
                        continue;
                    }
                    string thenConstructId2 = ReadReferenceID(elseIfElem, d + TAG_THEN_CONSTRUCT_REFERENCE);
                    if (thenConstructId2 == null)
                    {
                        continue;
                    }
                    ElseIf elseIf = new ElseIf();
                    elseIf.IfCondition.Code = (string)ifConditionElem2.Element(r + TAG_CODE);
                    elseIf.IfCondition.QuestionId = ReadReferenceID(ifConditionElem2, r + TAG_SOURCE_QUESTION_REFERENCE);
                    elseIf.ThenConstructId = thenConstructId2;
                    ifThenElse.ElseIfs.Add(elseIf);
                }
            }

            XElement sequenceElem = controlConstructSchemeElem.Element(d + TAG_SEQUENCE);
            if (sequenceElem != null)
            {
                controlConstructSchemeModel.Sequence.Id = (string)sequenceElem.Attribute(ATTR_ID);
                IEnumerable<XElement> controlConstructReferenceElems = sequenceElem.Elements(d + TAG_CONTROL_CONSTRUCT_REFERENCE);
                foreach (XElement controlConstructReferenceElem in controlConstructReferenceElems)
                {
                    string controlConstructId = (string)controlConstructReferenceElem.Element(r + TAG_ID);
                    if (controlConstructId != null)
                    {
                        controlConstructSchemeModel.Sequence.ControlConstructIds.Add(controlConstructId);
                    }
                }
            }
            return controlConstructSchemeModel;
        }
Example #32
0
 private void MergeConcept(StudyUnit newStudyUnit, StudyUnit curStudyUnit)
 {
     curStudyUnit.ConceptSchemes.AddRange(newStudyUnit.ConceptSchemes);
 }
Example #33
0
        public StudyUnitVM(MainWindowVM mainWindowVM, StudyUnit studyUnit)
            : base(mainWindowVM, studyUnit)
        {
            this.studyUnit = studyUnit;

            EventFormVM eventFormViewModel = new EventFormVM(this);
            MenuItemVM categoryEvent = new MenuItemVM(MenuElem.C_EVENT, eventFormViewModel); //1
            MenuItemVM menuEvent = new MenuItemVM(MenuElem.M_EVENT, eventFormViewModel); //2
            menuEvent.IsSelected = true;
            categoryEvent.Add(menuEvent);
            this.MenuItems.Add(categoryEvent);

            memberForm = new MemberFormVM(this);
            abstractForm = new AbstractFormVM(this);
            coverageForm = new CoverageFormVM(this);
            fundingInfoForm = new FundingInfoFormVM(this);

            MenuItemVM categoryStudy = new MenuItemVM(MenuElem.C_STUDY, memberForm); //3
            MenuItemVM menuStudyMember = new MenuItemVM(MenuElem.M_MEMBER, memberForm); //4
            MenuItemVM menuStudyAbstract = new MenuItemVM(MenuElem.M_ABSTRACT, abstractForm); //5
            MenuItemVM menuStudyRange = new MenuItemVM(MenuElem.M_COVERAGE, coverageForm); //6
            MenuItemVM menuFund = new MenuItemVM(MenuElem.M_FUNDING_INFO, fundingInfoForm); //7
            categoryStudy.Add(menuStudyMember);
            categoryStudy.Add(menuStudyAbstract);
            categoryStudy.Add(menuStudyRange);
            categoryStudy.Add(menuFund);
            this.MenuItems.Add(categoryStudy);

            samplingForm = new SamplingFormVM(this);

            MenuItemVM categoryScheme = new MenuItemVM(MenuElem.C_SAMPLING, samplingForm); //8
            MenuItemVM menuScheme = new MenuItemVM(MenuElem.M_SAMPLING, samplingForm); //9
            categoryScheme.Add(menuScheme);
            this.MenuItems.Add(categoryScheme);

            conceptForm = new ConceptFormVM(this);
            categoryForm = new CategoryFormVM(this);
            codeForm = new CodeFormVM(this);
            questionForm = new QuestionFormVM(this); //QuestionFormはconcept、category、codeよりあとに生成する必要あり
            questionGroupForm = new QuestionGroupFormVM(this); // QuestionGroupFormは、SequenceFormより先に生成する必要あり
            sequenceForm = new SequenceFormVM(this);

            MenuItemVM categoryQuestion = new MenuItemVM(MenuElem.C_QUESTION, conceptForm); //10
            MenuItemVM menuConcept = new MenuItemVM(MenuElem.M_CONCEPT, conceptForm); //11
            MenuItemVM menuQuestion = new MenuItemVM(MenuElem.M_QUESTION, questionForm); //12
            MenuItemVM menuCategory = new MenuItemVM(MenuElem.M_CATEGORY, categoryForm); //13
            MenuItemVM menuCode = new MenuItemVM(MenuElem.M_CODE, codeForm); //14
            MenuItemVM menuSequence = new MenuItemVM(MenuElem.M_SEQUENCE, sequenceForm); //15
            MenuItemVM menuQuestionGroup = new MenuItemVM(MenuElem.M_QUESTION_GROUP, questionGroupForm);
            categoryQuestion.Add(menuConcept);
            categoryQuestion.Add(menuQuestion);
            categoryQuestion.Add(menuCategory);
            categoryQuestion.Add(menuCode);
            categoryQuestion.Add(menuSequence);
            categoryQuestion.Add(menuQuestionGroup);
            this.MenuItems.Add(categoryQuestion);

            variableForm = new VariableFormVM(this);
            MenuItemVM categoryVariable = new MenuItemVM(MenuElem.C_VARIABLE, variableForm); //16
            MenuItemVM menuVariable = new MenuItemVM(MenuElem.M_VARIABLE, variableForm); //17
            categoryVariable.Add(menuVariable);
            this.MenuItems.Add(categoryVariable);

            dataSetForm = new DataSetFormVM(this);
            dataFileForm = new DataFileFormVM(this);
            bookForm = new BookFormVM(this);
            MenuItemVM categoryData = new MenuItemVM(MenuElem.C_DATA, dataSetForm); //18
            MenuItemVM menuDataRelation = new MenuItemVM(MenuElem.M_DATA_SET, dataSetForm); //19
            MenuItemVM menuPhysicalStructure = new MenuItemVM(MenuElem.M_DATA_FILE, dataFileForm); //20
            MenuItemVM menuBooks = new MenuItemVM(MenuElem.M_BOOKS, bookForm);
            categoryData.Add(menuDataRelation);
            categoryData.Add(menuPhysicalStructure);
            categoryData.Add(menuBooks);
            this.MenuItems.Add(categoryData);
            this.SelectedMenuItem = categoryEvent;

            OnRemoveBooks();
        }
Example #34
0
 public static void CreateControlConstructSchemes(XElement studyUnitElem, StudyUnit studyUnit)
 {
     List<ControlConstructScheme> controlConstructSchemeModels = new List<ControlConstructScheme>();
     IEnumerable<XElement> elements = studyUnitElem.Descendants(d + TAG_CONTROL_CONSTRUCT_SCHEME);
     foreach (XElement controlConstructSchemeElem in elements)
     {
         ControlConstructScheme controlConstructSchemeModel = CreateControlConstructScheme(controlConstructSchemeElem, studyUnit);
         if (controlConstructSchemeModel != null)
         {
             controlConstructSchemeModels.Add(controlConstructSchemeModel);
         }
     }
     if (controlConstructSchemeModels.Count > 0)
     {
         studyUnit.ControlConstructSchemes = controlConstructSchemeModels;
     }
 }