public SobekCM_Stats_DataSet()
{
// Create the dictionaries for quick lookups;
collection_rows = new Dictionary<string, DataRow>();
institution_rows = new Dictionary<string, DataRow>();
bib_rows = new Dictionary<string, DataRow>();
item_rows = new Dictionary<int, DataRow>();
ip_rows = new Dictionary<string, DataRow>();
portal_rows = new Dictionary<string, DataRow>();
webcontent_rows = new Dictionary<string, DataRow>();
// Create the new session dictionary objects
collection_sessions = new Dictionary<string, List<int>>();
institution_sessions = new Dictionary<string, List<int>>();
bib_sessions = new Dictionary<string, List<int>>();
item_sessions = new Dictionary<string, List<int>>();
ip_hits = new Dictionary<string, int>();
ip_to_agent = new Dictionary<string, string>();
// Create the dataset
stats = new DataSet {DataSetName = "SobekCM_Stats"};
// Create the table to hold the collection hits
sobekcm_stats = new DataTable("SobekCM_Hits");
sobekcm_stats.Columns.Add("sessions", typeof(Int32));
sobekcm_stats.Columns.Add("hits", typeof(Int32));
sobekcm_stats.Columns.Add("xml", typeof(Int32));
sobekcm_stats.Columns.Add("oai", typeof(Int32));
sobekcm_stats.Columns.Add("json", typeof(Int32));
sobekcm_stats.Columns.Add("robot_hits", typeof(Int32));
stats.Tables.Add(sobekcm_stats);
// Add an empty row here
DataRow newRow = sobekcm_stats.NewRow();
newRow[0] = 0;
newRow[1] = 0;
newRow[2] = 0;
newRow[3] = 0;
newRow[4] = 0;
newRow[5] = 0;
sobekcm_stats.Rows.Add(newRow);
// Create the table to hold the collection hits
collection_stats = new DataTable("Collection_Hits");
collection_stats.Columns.Add("code");
collection_stats.Columns.Add("sessions", typeof(Int32));
collection_stats.Columns.Add("home_page_hits", typeof(Int32));
collection_stats.Columns.Add("browse_hits", typeof(Int32));
collection_stats.Columns.Add("advanced_search_hits", typeof(Int32));
collection_stats.Columns.Add("results_hits", typeof(Int32));
stats.Tables.Add(collection_stats);
// Create the table to hold the institutional hits
institution_stats = new DataTable("Institution_Hits");
institution_stats.Columns.Add("code");
institution_stats.Columns.Add("sessions", typeof(Int32));
institution_stats.Columns.Add("home_page_hits", typeof(Int32));
institution_stats.Columns.Add("browse_hits", typeof(Int32));
institution_stats.Columns.Add("advanced_search_hits", typeof(Int32));
institution_stats.Columns.Add("results_hits", typeof(Int32));
stats.Tables.Add(institution_stats);
// Create the table to hold the bib-level hits
bib_stats = new DataTable("Bib_Hits");
bib_stats.Columns.Add("bibid");
bib_stats.Columns.Add("sessions", typeof(Int32));
bib_stats.Columns.Add("hits", typeof(Int32));
stats.Tables.Add(bib_stats);
// Create the table to hold the item hits
item_stats = new DataTable("Item_Hits");
item_stats.Columns.Add("bibid");
item_stats.Columns.Add("vid");
item_stats.Columns.Add("itemid", typeof(Int32));
item_stats.Columns.Add("sessions", typeof(Int32));
item_stats.Columns.Add("default_hits", typeof(Int32));
item_stats.Columns.Add("jpeg_hits", typeof(Int32));
item_stats.Columns.Add("zoomable_hits", typeof(Int32));
item_stats.Columns.Add("citation_hits", typeof(Int32));
item_stats.Columns.Add("thumbnail_hits", typeof(Int32));
item_stats.Columns.Add("text_search_hits", typeof(Int32));
item_stats.Columns.Add("flash_hits", typeof(Int32));
item_stats.Columns.Add("google_map_hits", typeof(Int32));
item_stats.Columns.Add("download_hits", typeof(Int32));
item_stats.Columns.Add("other_hits", typeof(Int32));
item_stats.Columns.Add("static_hits", typeof(Int32));
stats.Tables.Add(item_stats);
// Create the table to hold most common IP addresses
ip_addresses = new DataTable("IP_Addresses");
ip_addresses.Columns.Add("IP");
ip_addresses.Columns.Add("UserAgent");
ip_addresses.Columns.Add("hits", typeof(Int32));
stats.Tables.Add(ip_addresses);
// Create the table to hold the portal hits
portal_stats = new DataTable("Portal_Hits");
portal_stats.Columns.Add("Base_URL");
portal_stats.Columns.Add("hits", typeof(Int32));
stats.Tables.Add(portal_stats);
// Create the table to hold the static webcontent hits
webcontent_stats = new DataTable("WebContent_Hits");
webcontent_stats.Columns.Add("Complete_Mode");
webcontent_stats.Columns.Add("hits", typeof(Int32));
webcontent_stats.Columns.Add("Level1");
webcontent_stats.Columns.Add("Level2");
webcontent_stats.Columns.Add("Level3");
webcontent_stats.Columns.Add("Level4");
webcontent_stats.Columns.Add("Level5");
webcontent_stats.Columns.Add("Level6");
webcontent_stats.Columns.Add("Level7");
webcontent_stats.Columns.Add("Level8");
stats.Tables.Add(webcontent_stats);
// Set the default cut off
hit_ip_cutoff = 50;
}