/// <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); }
private XElement CreatePhysicalInstance(DataFile dataFileModel) { //d:PhysicalInstance DataSet dataSetModel = studyUnit.FindDataSetModel(dataFileModel.DataSetId); XElement physicalInstance = new XElement(pi + TAG_PHYSICAL_INSTANCE, CreateIDAttribute(dataFileModel.PhysicalInstanceId), CreateVersionAttribute(), CreateAgencyAttribute(), CreateReferenceID(pi + TAG_RECORD_LAYOUT_REFERENCE, dataFileModel.RecordLayoutId, RecordLayoutSchemeId()), //RecordLayoutReference+ new XElement(pi + TAG_DATA_FILE_IDENTIFICATION, //DataFileIdentification+ CreateIDAttribute(dataFileModel.DataFileIdentificationId), new XElement(pi + TAG_URI, dataFileModel.Uri)),//URI+ new XElement(pi + TAG_GROSS_FILE_STRUCTURE, //GrossFileStructure? CreateIDAttribute(dataFileModel.GrossFileStructureId), new XElement(pi + TAG_CASE_QUANTITY, "0"), //CaseQuantity? new XElement(pi + TAG_OVERALL_RECORD_COUNT, dataSetModel.VariableGuids.Count))); //OverallRecordCount? return physicalInstance; }
public DataFileVM(DataFile dataFile, DataSetVM dataSet) { this.dataFile = dataFile; this.dataSet = dataSet; }
public static DataFile createDataFile() { DataFile dataFile = new DataFile(); dataFile.Charset = "UTF-8"; dataFile.Format = "Delimited"; dataFile.DelimiterCode = "1"; return dataFile; }
private DataFileVM createDataFile(DataFile dataFileModel, DataSetVM dataSet) { DataFileVM dataFile = new DataFileVM(dataFileModel, dataSet); dataFile.Parent = this; dataFile.Delimiters = Options.Delimiters; return dataFile; }
public static DataFile CreateDataFile(XElement physicalStructureElem, IEnumerable<XElement> recordLayoutElems, IEnumerable<XElement> physicalInstanceElems) { string id = (string)physicalStructureElem.Attribute(ATTR_ID); if (id == null) { return null; } DataFile dataFileModel = new DataFile(); dataFileModel.Id = id; dataFileModel.Format = (string)physicalStructureElem.Element(p + TAG_FORMAT); string delimiterLabel = (string)physicalStructureElem.Element(p + TAG_DEFAULT_DELIMITER); dataFileModel.DelimiterCode = Options.FindCodeByLabel(Options.Delimiters, delimiterLabel); dataFileModel.DataSetId = ReadReferenceID(physicalStructureElem, p + TAG_LOGICAL_RECORD_REFERENCE); XElement recordLayoutElem = FindRecordLayoutElem(recordLayoutElems, dataFileModel.Id); if (recordLayoutElem != null) { string recordLayoutId = (string)recordLayoutElem.Attribute(ATTR_ID); XElement physicalInstanceElem = FindPhysicalInstanceElem(physicalInstanceElems, recordLayoutId); if (physicalInstanceElem != null) { XElement dataFileIdentificationElem = physicalInstanceElem.Element(pi + TAG_DATA_FILE_IDENTIFICATION); if (dataFileIdentificationElem != null) { dataFileModel.Uri = (string)dataFileIdentificationElem.Element(pi + TAG_URI); } } } return dataFileModel; }
private static DataSetItem CreateDataSetItem(XElement fileDscrElem) { string id = (string)fileDscrElem.Attribute(ATTR_ID); if (string.IsNullOrEmpty(id)) { return null; } string uri = (string)fileDscrElem.Attribute(ATTR_URI); XElement fileTxtElem = fileDscrElem.Element(cb + TAG_FILE_TXT); if (fileTxtElem == null) { return null; } string title = (string)fileTxtElem.Element(cb + TAG_FILE_NAME); string memo = (string)fileTxtElem.Element(cb + TAG_FILE_CONT); string format = (string)fileTxtElem.Element(cb + TAG_FORMAT); DataSet dataSet = new DataSet() { Id = id, Title = title, Memo = memo }; DataFile dataFile = new DataFile() { Uri = uri, Format = format }; dataFile.DataSetId = dataSet.Id; return new DataSetItem(dataSet, dataFile); }
public DataSetItem(DataSet dataSet, DataFile dataFile) { DataSet = dataSet; DataFile = dataFile; }