예제 #1
0
 public void StoreAggregationSummary(AggregationSummary asm)
 {
     using (var conn = new NpgsqlConnection(connString))
     {
         conn.Insert <AggregationSummary>(asm);
     }
 }
        public void GetSummaryStatistics()
        {
            // Obtains figures for aggrgeate tables
            string             conn_string = logging_repo.FetchConnString("mdr");
            AggregationSummary sm          = new AggregationSummary(agg_event_id);

            logging_repo.LogHeader("Statistics for core tables");
            logging_repo.DeleteSameEventSummaryStats(agg_event_id);

            sm.study_recs               = logging_repo.GetAggregateRecNum("studies", "st", conn_string);
            sm.study_identifiers_recs   = logging_repo.GetAggregateRecNum("study_identifiers", "st", conn_string);
            sm.study_titles_recs        = logging_repo.GetAggregateRecNum("study_titles", "st", conn_string);
            sm.study_contributors_recs  = logging_repo.GetAggregateRecNum("study_contributors", "st", conn_string);
            sm.study_topics_recs        = logging_repo.GetAggregateRecNum("study_topics", "st", conn_string);
            sm.study_features_recs      = logging_repo.GetAggregateRecNum("study_features", "st", conn_string);
            sm.study_relationships_recs = logging_repo.GetAggregateRecNum("study_relationships", "st", conn_string);

            sm.data_object_recs          = logging_repo.GetAggregateRecNum("data_objects", "ob", conn_string);
            sm.object_datasets_recs      = logging_repo.GetAggregateRecNum("object_datasets", "ob", conn_string);
            sm.object_instances_recs     = logging_repo.GetAggregateRecNum("object_instances", "ob", conn_string);
            sm.object_titles_recs        = logging_repo.GetAggregateRecNum("object_titles", "ob", conn_string);
            sm.object_dates_recs         = logging_repo.GetAggregateRecNum("object_dates", "ob", conn_string);
            sm.object_contributors_recs  = logging_repo.GetAggregateRecNum("object_contributors", "ob", conn_string);
            sm.object_topics_recs        = logging_repo.GetAggregateRecNum("object_topics", "ob", conn_string);
            sm.object_identifiers_recs   = logging_repo.GetAggregateRecNum("object_identifiers", "ob", conn_string);
            sm.object_descriptions_recs  = logging_repo.GetAggregateRecNum("object_descriptions", "ob", conn_string);
            sm.object_rights_recs        = logging_repo.GetAggregateRecNum("object_rights", "ob", conn_string);
            sm.object_relationships_recs = logging_repo.GetAggregateRecNum("object_relationships", "ob", conn_string);
            sm.study_object_link_recs    = logging_repo.GetAggregateRecNum("all_ids_data_objects", "nk", conn_string);
            logging_repo.StoreAggregationSummary(sm);
            logging_repo.LogLine("Statistics done for mdr central schemas");

            logging_repo.LogHeader("Summary object and study stats");

            // get and store data object types
            logging_repo.DeleteSameEventObjectStats(agg_event_id);
            List <AggregationObjectNum> object_numbers = logging_repo.GetObjectTypes(agg_event_id);

            logging_repo.StoreObjectNumbers(CopyHelpers.object_numbers_helper, object_numbers);
            logging_repo.LogLine("Statistics done for different data objects");

            // get study-study linkage
            logging_repo.RecreateStudyStudyLinksTable();
            List <StudyStudyLinkData> study_link_numbers = logging_repo.GetStudyStudyLinkData(agg_event_id);

            logging_repo.StoreStudyLinkNumbers(CopyHelpers.study_link_numbers_helper, study_link_numbers);
            study_link_numbers = logging_repo.GetStudyStudyLinkData2(agg_event_id);
            logging_repo.StoreStudyLinkNumbers(CopyHelpers.study_link_numbers_helper, study_link_numbers);
            logging_repo.LogLine("Statistics done for study-study links");
        }