Ejemplo n.º 1
0
        GroupDefinition GetGroupDefinition()
        {
            var result = new GroupDefinition();
            //possible slicers
            var jobFamily = new DataColumnMetadata {ColumnName = "Job_Family"};
            var jobFamilyValue = new FilterValue {Key = "Health Care", Value="Health Care"};
            var jobTrack = new DataColumnMetadata {ColumnName = "Job_Track" };
            //slicer remains constant when selected
            var yearColumn = new DataColumnMetadata {ColumnName = "Year"};

            //measure

            var basePayColumn = new DataColumnMetadata {ColumnName = "Base_Pay"};
            var basePayMeasure = new MeasureDefinition
            {
                Operation = AggregateOperations.Average,
                Column = basePayColumn,
                IsDefault=true
            };
            //TODO no Selected Value thats a filter
            result.Dimensions.Add(new DimensionDefinition { Column = yearColumn, IsDefault=true });
            result.Dimensions.Add(new DimensionDefinition
            {
                Column = jobFamily
            });

            result.Measures.Add(basePayMeasure);

            return result;
        }
Ejemplo n.º 2
0
        public void PutMetaDataTest()
        {
            var client = new MongoClient("mongodb://localhost:27017");
            var db = client.GetDatabase("hra");
            BsonClassMap.RegisterClassMap<DataCollectionMetadata>(cm =>
            {
                cm.AutoMap();
                cm.MapIdMember(c => c.CollectionName);

            });

            //db.CreateCollectionAsync("collectionMetadata").Wait();
            //t.Start();
            //t.Wait();

            var items = db.GetCollection<DataCollectionMetadata>("collectionMetadata");

            var s = new DataCollectionMetadata();
            s.CollectionName = "incumbent";
            s.DataSourceName = "hra";
            s.DisplayName = "Incumbent";
            //Dimensions are slicers
            var yearColumnDimension = new DimensionColumnMetadata();
            yearColumnDimension.ColumnIndex = 22;
            yearColumnDimension.ColumnName = "Year";
            yearColumnDimension.DataType = ColumnDataTypes.Int32;
            yearColumnDimension.DisplayName = "Year";
            yearColumnDimension.IsDefault = true;

            var jobFamilyDimension = new DimensionColumnMetadata();
            jobFamilyDimension.ColumnIndex = 12;
            jobFamilyDimension.ColumnName = "Job_Family";
            jobFamilyDimension.DisplayName = "Job Family";
            jobFamilyDimension.DataType = ColumnDataTypes.String;

            var jobTrackDimension = new DimensionColumnMetadata();
            jobTrackDimension.ColumnIndex = 14;
            jobTrackDimension.ColumnName = "Job_Track";
            jobTrackDimension.DisplayName = "Job Track";
            jobTrackDimension.DataType = ColumnDataTypes.String;

            var jobLevelDimension = new DimensionColumnMetadata();
            jobLevelDimension.ColumnIndex = 16;
            jobLevelDimension.ColumnName = "Job_Level";
            jobLevelDimension.DisplayName = "Job Level";
            jobLevelDimension.DataType = ColumnDataTypes.String;

            var orgTypeDimension = new DimensionColumnMetadata();
            orgTypeDimension.ColumnIndex = 7;
            orgTypeDimension.ColumnName = "org_type";
            orgTypeDimension.DisplayName = "Organization Type";
            orgTypeDimension.DataType = ColumnDataTypes.String;

            var orgType = new DimensionColumnMetadata();
            orgType.ColumnIndex = 7;
            orgType.ColumnName = "org_type";
            orgType.DataType = ColumnDataTypes.String;
            orgType.DisplayName = "Organization Type";

            var basePay = new MeasureDataColumnMetadata();
            basePay.ColumnIndex = 23;
            basePay.ColumnName = "Base_Pay";
            basePay.DataType = ColumnDataTypes.Double;
            basePay.DisplayName = "Base Pay";
            basePay.IsDefault = true;

            var yearColumn = new DataColumnMetadata();
            yearColumn.ColumnIndex = 22;
            yearColumn.ColumnName = "Year";
            yearColumn.DataType = ColumnDataTypes.Int32;
            yearColumn.DisplayName = "Year";

            var jobFamily = new FilterDataColumnMetadata();
            jobFamily.ColumnIndex = 12;
            jobFamily.ColumnName = "Job_Family";
            jobFamily.DisplayName = "Job Family";
            basePay.DataType = ColumnDataTypes.String;

            var jobTrack = new FilterDataColumnMetadata();
            jobTrack.ColumnIndex = 14;
            jobTrack.ColumnName = "Job_Track";
            jobTrack.DisplayName = "Job Track";
            jobTrack.FilterDependencyColumns.Add(jobFamily);
            basePay.DataType = ColumnDataTypes.String;

            var jobLevel = new FilterDataColumnMetadata();
            jobLevel.ColumnIndex = 16;
            jobLevel.ColumnName = "Job_Level";
            jobLevel.DisplayName = "Job Level";
            basePay.DataType = ColumnDataTypes.String;

            s.Columns.Add(yearColumn);
            s.Columns.Add(orgType);
            s.Columns.Add(basePay);
            s.Columns.Add(jobFamily);
            s.Columns.Add(jobTrack);
            s.Columns.Add(jobLevel);

            s.Dimensions.Add(yearColumnDimension);
            s.Dimensions.Add(jobFamilyDimension);
            s.Dimensions.Add(jobTrackDimension);
            s.Dimensions.Add(jobLevelDimension);
            s.Dimensions.Add(orgTypeDimension);

            s.Measures.Add(basePay);

            //do filters
            s.Filters.Add(jobFamily);
            s.Filters.Add(jobTrack);
            s.Filters.Add(jobLevel);

            items.InsertOneAsync(s).Wait();
        }