Overview
This document can used to acquire scripts for Archiving Data from advanced reports manually. This can be done to improve performance of ETL scripts when huge amount of data is accumulated in database tables.
Configurations Required
There are 2 scripts provided below based on whether customer database is SQL Server/MariaDB. In both cases, user needs to replace the following placeholders with values from their Database:
- @@ARCHIVE_REPORT_DB_NAME@@: Name of the Archive Database that will be created when script is run
- @@REPORT_DB_NAME@@: Name of the current Reports database that is used by Ephesoft
These scripts will need root/administrator access to as new Database needs to be created.
Archival Scripts
MariaDB
CREATE DATABASE IF NOT EXISTS `@@ARCHIVE_REPORT_DB_NAME@@` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `@@ARCHIVE_REPORT_DB_NAME@@`;
—
— Table structure for table `global_data`
—
CREATE TABLE if not exists global_data (
id bigint(20) NOT NULL ,
batch_class_id varchar(255) NOT NULL,
batch_class_name varchar(255) NULL,
batch_id varchar(255) NOT NULL,
batch_start_date datetime NULL,
start_date date NOT NULL,
document_id varchar(255) NOT NULL,
is_reviewed bit(1) NOT NULL,
old_doc_type varchar(255) NULL,
new_doc_type varchar(255) NULL,
document_type_label varchar(280) NULL,
is_doc_type_change bit(1) NULL,
confidence decimal(10,2) NULL,
confidence_threshold decimal(10,2) NULL,
old_page_count int NULL,
new_page_count int NULL,
page_count_change int NULL,
is_doc_type_change_text varchar(20) NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
—
— Table structure for table `field_details`
—
CREATE TABLE if not exists field_details (
id bigint(20) NOT NULL ,
batch_class_id varchar(255) NOT NULL,
batch_class_name varchar(255) NULL,
batch_id varchar(255) NOT NULL,
batch_start_date datetime NULL,
start_date date NOT NULL,
document_id varchar(255) NOT NULL,
document_type varchar(255) NULL,
document_type_label varchar(280) NULL,
field_type_label varchar(550) NULL,
field_name varchar (255) NULL,
field_old_value varchar(700) NULL,
field_new_value varchar(700) NULL,
confidence decimal(10,2) NULL,
isFieldChange bit(1) NULL,
is_field_change_text varchar(20) NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
—
— Table structure for table `field_correction_details`
—
CREATE TABLE if not exists field_correction_details (
id bigint(20) NOT NULL ,
batch_class_id varchar(255) NOT NULL,
batch_class_name varchar(255) NULL,
batch_id varchar(255) NOT NULL,
batch_start_date datetime NULL,
start_date date NOT NULL,
document_id varchar(255) NOT NULL,
document_type varchar(255) NULL,
field_name varchar (255) NULL,
field_old_value varchar (700) NULL,
field_new_value varchar (700) NULL,
confidence decimal (10,2) NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
—
— Table structure for table `field_correction`
—
CREATE TABLE if not exists field_correction(
id bigint(20) NOT NULL ,
batch_class_id varchar(255) NOT NULL,
batch_class_name varchar(255) NULL,
batch_id varchar(255) NOT NULL,
batch_start_date datetime NULL,
start_date date NOT NULL,
document_type varchar(255) NULL,
field_type_label varchar(550) NULL,
field_name varchar (255) NULL,
number_of_documents int NULL,
average_confidence decimal (10,2) NULL,
weighted_confidence decimal (10,2) NULL,
field_change_count int NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
—
— Table structure for table `extraction_correction`
—
CREATE TABLE if not exists extraction_correction(
id bigint(20) NOT NULL ,
batch_class_id varchar(255) NOT NULL,
batch_class_name varchar(255) NULL,
batch_id varchar(255) NOT NULL,
batch_start_date datetime NULL,
start_date date NOT NULL,
document_type varchar(255) NULL,
document_type_label varchar(280) NULL,
number_of_fields int NULL,
average_confidence decimal (10,2) NULL,
weighted_confidence decimal (10,2) NULL,
field_change_count int NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
—
— Table structure for table `classification_correction`
—
CREATE TABLE if not exists classification_correction(
id bigint(20) NOT NULL ,
batch_class_id varchar(255) NOT NULL,
batch_class_name varchar(255) NULL,
batch_id varchar(255) NOT NULL,
batch_start_date datetime NULL,
start_date date NOT NULL,
document_id varchar(255) NOT NULL,
old_doc_type varchar(255) NULL,
new_doc_type varchar(255) NULL,
confidence decimal (10,2) NULL,
confidence_threshold decimal (10,2) NULL,
page_count int NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
—
— Table structure for table `classification_correction_accuracy`
—
CREATE TABLE if not exists classification_correction_accuracy(
id bigint(20) NOT NULL ,
batch_class_id varchar(255) NOT NULL,
batch_class_name varchar(255) NULL,
batch_id varchar(255) NOT NULL,
batch_start_date datetime NULL,
start_date date NOT NULL,
document_type varchar(255) NULL,
document_type_label varchar(280) NULL,
page_count int NULL,
correction_page_count int NULL,
correct_classification_page_count int NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
—
— Table structure for table `seperation_correction`
—
CREATE TABLE if not exists seperation_correction(
id bigint(20) NOT NULL ,
batch_class_id varchar(255) NOT NULL,
batch_class_name varchar(255) NULL,
batch_id varchar(255) NOT NULL,
batch_start_date datetime NULL,
start_date date NOT NULL,
document_id varchar(255) NOT NULL,
document_type varchar(255) NULL,
old_page_count int NULL,
new_page_count int NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
—
— Table structure for table `seperation_correction_accuracy`
—
CREATE TABLE if not exists seperation_correction_accuracy(
id bigint(20) NOT NULL ,
batch_class_id varchar(255) NOT NULL,
batch_class_name varchar(255) NULL,
batch_id varchar(255) NOT NULL,
batch_start_date datetime NULL,
start_date date NOT NULL,
document_type varchar(255) NULL,
document_type_label varchar(280) NULL,
page_count int NULL,
correction_page_count int NULL,
correct_seperation_page_count int NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
—
— Table structure for table `unnecessary_review`
—
CREATE TABLE if not exists unnecessary_review(
id bigint(20) NOT NULL ,
batch_class_id varchar(255) NOT NULL,
batch_class_name varchar(255) NULL,
batch_id varchar(255) NOT NULL,
batch_start_date datetime NULL,
start_date date NULL,
document_id varchar(255) NOT NULL,
document_type varchar(255) NULL,
document_type_label varchar(280) NULL,
confidence decimal (10,2) NULL,
confidence_threshold decimal (10,2) NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
—
— Table structure for table `false_positive`
—
CREATE TABLE if not exists false_positive(
id bigint(20) NOT NULL ,
batch_class_id varchar(255) NOT NULL,
batch_class_name varchar(255) NULL,
batch_id varchar(255) NOT NULL,
batch_start_date datetime NULL,
start_date date NOT NULL,
document_id varchar(255) NOT NULL,
old_doc_type varchar(255) NULL,
new_doc_type varchar(255) NULL,
document_type_label varchar(280) NULL,
confidence decimal (10,2) NULL,
confidence_threshold decimal (10,2) NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
—
— Table structure for table `document_correction`
—
CREATE TABLE if not exists document_correction(
id bigint(20) NOT NULL ,
batch_class_id varchar(255) NOT NULL,
batch_class_name varchar(255) NULL,
batch_id varchar(255) NOT NULL,
batch_start_date datetime NULL,
start_date date NOT NULL,
document_type varchar (255) NULL,
document_type_label varchar(280) NULL,
classification_correction_count bigint NULL DEFAULT 0,
seperation_correction_count bigint NULL DEFAULT 0,
unnecessary_review_count bigint NULL DEFAULT 0,
false_positive_count bigint NULL DEFAULT 0,
total_correction_count bigint NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into @@ARCHIVE_REPORT_DB_NAME@@.document_correction select * from @@REPORT_DB_NAME@@.document_correction;
insert into @@ARCHIVE_REPORT_DB_NAME@@.false_positive select * from @@REPORT_DB_NAME@@.false_positive;
insert into @@ARCHIVE_REPORT_DB_NAME@@.unnecessary_review select * from @@REPORT_DB_NAME@@.unnecessary_review;
insert into @@ARCHIVE_REPORT_DB_NAME@@.seperation_correction_accuracy select * from @@REPORT_DB_NAME@@.seperation_correction_accuracy;
insert into @@ARCHIVE_REPORT_DB_NAME@@.seperation_correction select * from @@REPORT_DB_NAME@@.seperation_correction;
insert into @@ARCHIVE_REPORT_DB_NAME@@.classification_correction_accuracy select * from @@REPORT_DB_NAME@@.classification_correction_accuracy;
insert into @@ARCHIVE_REPORT_DB_NAME@@.classification_correction select * from @@REPORT_DB_NAME@@.classification_correction;
insert into @@ARCHIVE_REPORT_DB_NAME@@.extraction_correction select * from @@REPORT_DB_NAME@@.extraction_correction;
insert into @@ARCHIVE_REPORT_DB_NAME@@.field_correction select * from @@REPORT_DB_NAME@@.field_correction;
insert into @@ARCHIVE_REPORT_DB_NAME@@.field_correction_details select * from @@REPORT_DB_NAME@@.field_correction_details;
insert into @@ARCHIVE_REPORT_DB_NAME@@.field_details select * from @@REPORT_DB_NAME@@.field_details;
insert into @@ARCHIVE_REPORT_DB_NAME@@.global_data select * from @@REPORT_DB_NAME@@.global_data;
truncate table @@REPORT_DB_NAME@@.document_correction;
truncate table @@REPORT_DB_NAME@@.false_positive;
truncate table @@REPORT_DB_NAME@@.unnecessary_review;
truncate table @@REPORT_DB_NAME@@.seperation_correction_accuracy;
truncate table @@REPORT_DB_NAME@@.seperation_correction;
truncate table @@REPORT_DB_NAME@@.classification_correction_accuracy;
truncate table @@REPORT_DB_NAME@@.classification_correction;
truncate table @@REPORT_DB_NAME@@.extraction_correction;
truncate table @@REPORT_DB_NAME@@.field_correction;
truncate table @@REPORT_DB_NAME@@.field_correction_details;
truncate table @@REPORT_DB_NAME@@.field_details;
truncate table @@REPORT_DB_NAME@@.global_data;
MSSQL Server
IF NOT EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = ‘@@ARCHIVE_REPORT_DB_NAME@@’)
Begin
CREATE Database [@@ARCHIVE_REPORT_DB_NAME@@];
End
GO
USE [@@ARCHIVE_REPORT_DB_NAME@@]
GO
/****** Object: Table [dbo].[global_data] Script Date: 01/13/2015 14:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[global_data]’) AND type in (N’U’))
BEGIN
CREATE TABLE [dbo].[global_data](
[id] [bigint] NOT NULL,
[batch_class_id] [varchar](255) NOT NULL,
[batch_class_name] [varchar](255) NULL,
[batch_id] [varchar](255) NOT NULL,
[batch_start_date] [datetime] NULL,
[start_date] [date] NOT NULL,
[document_id] [varchar](255) NOT NULL,
[is_reviewed] [bit] NOT NULL,
[old_doc_type] [varchar](255) NULL,
[new_doc_type] [varchar](255) NULL,
[document_type_label] [varchar](280) NULL,
[is_doc_type_change] [bit] NULL,
[confidence] [decimal] (10,2) NULL,
[confidence_threshold] [decimal] (10,2) NULL,
[old_page_count] [int] NULL,
[new_page_count] [int] NULL,
[page_count_change] [int] NULL,
is_doc_type_change_text varchar(20) NULL)
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N’MS_SSMA_SOURCE’ , N’SCHEMA’,N’dbo’, N’TABLE’,N’global_data’, NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N’MS_SSMA_SOURCE’, @value=N’reporting.global_data’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N’global_data’
GO
/****** Object: Table [dbo].[field_details] Script Date: 01/13/2015 14:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[field_details]’) AND type in (N’U’))
BEGIN
CREATE TABLE [dbo].[field_details](
[id] [bigint] NOT NULL,
[batch_class_id] [varchar](255) NOT NULL,
[batch_class_name] [varchar](255) NULL,
[batch_id] [varchar](255) NOT NULL,
[batch_start_date] [datetime] NULL,
[start_date] [date] NOT NULL,
[document_id] [varchar](255) NOT NULL,
[document_type] [varchar](255) NULL,
[document_type_label] [varchar](280) NULL,
[field_type_label] [varchar](550) NULL,
[field_name] [varchar] (255) NULL,
[field_old_value] [varchar] (700) NULL,
[field_new_value] [varchar] (700) NULL,
[confidence] [decimal] (10,2) NULL,
[isFieldChange] [bit] NULL,
[is_field_change_text] [varchar] (20) NULL)
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N’MS_SSMA_SOURCE’ , N’SCHEMA’,N’dbo’, N’TABLE’,N’field_details’, NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N’MS_SSMA_SOURCE’, @value=N’reporting.field_details’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N’field_details’
GO
/****** Object: Table [dbo].[field_correction_details] Script Date: 01/13/2015 14:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[field_correction_details]’) AND type in (N’U’))
BEGIN
CREATE TABLE [dbo].[field_correction_details](
[id] [bigint] NOT NULL,
[batch_class_id] [varchar](255) NOT NULL,
[batch_class_name] [varchar](255) NULL,
[batch_id] [varchar](255) NOT NULL,
[batch_start_date] [datetime] NULL,
[start_date] [date] NOT NULL,
[document_id] [varchar](255) NOT NULL,
[document_type] [varchar](255) NULL,
[field_name] [varchar] (255) NULL,
[field_old_value] [varchar] (700) NULL,
[field_new_value] [varchar] (700) NULL,
[confidence] [decimal] (10,2) NULL)
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N’MS_SSMA_SOURCE’ , N’SCHEMA’,N’dbo’, N’TABLE’,N’field_correction_details’, NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N’MS_SSMA_SOURCE’, @value=N’reporting.field_correction_details’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N’field_correction_details’
GO
/****** Object: Table [dbo].[field_correction] Script Date: 01/13/2015 14:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[field_correction]’) AND type in (N’U’))
BEGIN
CREATE TABLE [dbo].[field_correction](
[id] [bigint] NOT NULL,
[batch_class_id] [varchar](255) NOT NULL,
[batch_class_name] [varchar](255) NULL,
[batch_id] [varchar](255) NOT NULL,
[batch_start_date] [datetime] NULL,
[start_date] [date] NOT NULL,
[document_type] [varchar](255) NULL,
[field_type_label] [varchar](550) NULL,
[field_name] [varchar] (255) NULL,
[number_of_documents] [int] NULL,
[average_confidence] [decimal] (10,2) NULL,
[weighted_confidence] [decimal] (10,2) NULL,
[field_change_count] [int] NULL)
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N’MS_SSMA_SOURCE’ , N’SCHEMA’,N’dbo’, N’TABLE’,N’field_correction’, NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N’MS_SSMA_SOURCE’, @value=N’reporting.field_correction’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N’field_correction’
GO
/****** Object: Table [dbo].[extraction_correction] Script Date: 01/13/2015 14:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[extraction_correction]’) AND type in (N’U’))
BEGIN
CREATE TABLE [dbo].[extraction_correction](
[id] [bigint] NOT NULL,
[batch_class_id] [varchar](255) NOT NULL,
[batch_class_name] [varchar](255) NULL,
[batch_id] [varchar](255) NOT NULL,
[batch_start_date] [datetime] NULL,
[start_date] [date] NOT NULL,
[document_type] [varchar](255) NULL,
[document_type_label] [varchar](280) NULL,
[number_of_fields] [int] NULL,
[average_confidence] [decimal] (10,2) NULL,
[weighted_confidence] [decimal] (10,2) NULL,
[field_change_count] [int] NULL)
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N’MS_SSMA_SOURCE’ , N’SCHEMA’,N’dbo’, N’TABLE’,N’extraction_correction’, NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N’MS_SSMA_SOURCE’, @value=N’reporting.extraction_correction’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N’extraction_correction’
GO
/****** Object: Table [dbo].[classification_correction] Script Date: 01/13/2015 14:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[classification_correction]’) AND type in (N’U’))
BEGIN
CREATE TABLE [dbo].[classification_correction](
[id] [bigint] NOT NULL,
[batch_class_id] [varchar](255) NOT NULL,
[batch_class_name] [varchar](255) NULL,
[batch_id] [varchar](255) NOT NULL,
[batch_start_date] [datetime] NULL,
[start_date] [date] NOT NULL,
[document_id] [varchar](255) NOT NULL,
[old_doc_type] [varchar](255) NULL,
[new_doc_type] [varchar](255) NULL,
[confidence] [decimal] (10,2) NULL,
[confidence_threshold] [decimal] (10,2) NULL,
[page_count] [int] NULL)
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N’MS_SSMA_SOURCE’ , N’SCHEMA’,N’dbo’, N’TABLE’,N’classification_correction’, NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N’MS_SSMA_SOURCE’, @value=N’reporting.classification_correction’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N’classification_correction’
GO
/****** Object: Table [dbo].[classification_correction_accuracy] Script Date: 01/13/2015 14:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[classification_correction_accuracy]’) AND type in (N’U’))
BEGIN
CREATE TABLE [dbo].[classification_correction_accuracy](
[id] [bigint] NOT NULL,
[batch_class_id] [varchar](255) NOT NULL,
[batch_class_name] [varchar](255) NULL,
[batch_id] [varchar](255) NOT NULL,
[batch_start_date] [datetime] NULL,
[start_date] [date] NOT NULL,
[document_type] [varchar](255) NULL,
[document_type_label] [varchar](280) NULL,
[page_count] [int] NULL,
[correction_page_count] [int] NULL,
[correct_classification_page_count] [int] NULL)
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N’MS_SSMA_SOURCE’ , N’SCHEMA’,N’dbo’, N’TABLE’,N’classification_correction_accuracy’, NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N’MS_SSMA_SOURCE’, @value=N’reporting.classification_correction_accuracy’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N’classification_correction_accuracy’
GO
/****** Object: Table [dbo].[seperation_correction] Script Date: 01/13/2015 14:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[seperation_correction]’) AND type in (N’U’))
BEGIN
CREATE TABLE [dbo].[seperation_correction](
[id] [bigint] NOT NULL,
[batch_class_id] [varchar](255) NOT NULL,
[batch_class_name] [varchar](255) NULL,
[batch_id] [varchar](255) NOT NULL,
[batch_start_date] [datetime] NULL,
[start_date] [date] NOT NULL,
[document_id] [varchar](255) NULL,
[document_type] [varchar](255) NULL,
[old_page_count] [int] NULL,
[new_page_count] [int] NULL)
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N’MS_SSMA_SOURCE’ , N’SCHEMA’,N’dbo’, N’TABLE’,N’seperation_correction’, NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N’MS_SSMA_SOURCE’, @value=N’reporting.seperation_correction’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N’seperation_correction’
GO
/****** Object: Table [dbo].[seperation_correction_accuracy] Script Date: 01/13/2015 14:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[seperation_correction_accuracy]’) AND type in (N’U’))
BEGIN
CREATE TABLE [dbo].[seperation_correction_accuracy](
[id] [bigint] NOT NULL,
[batch_class_id] [varchar](255) NOT NULL,
[batch_class_name] [varchar](255) NULL,
[batch_id] [varchar](255) NOT NULL,
[batch_start_date] [datetime] NULL,
[start_date] [date] NOT NULL,
[document_type] [varchar](255) NULL,
[document_type_label] [varchar](280) NULL,
[page_count] [int] NULL,
[correction_page_count] [int] NULL,
[correct_seperation_page_count] [int] NULL)
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N’MS_SSMA_SOURCE’ , N’SCHEMA’,N’dbo’, N’TABLE’,N’seperation_correction_accuracy’, NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N’MS_SSMA_SOURCE’, @value=N’reporting.seperation_correction_accuracy’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N’seperation_correction_accuracy’
GO
/****** Object: Table [dbo].[unnecessary_review] Script Date: 01/13/2015 14:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[unnecessary_review]’) AND type in (N’U’))
BEGIN
CREATE TABLE [dbo].[unnecessary_review](
[id] [bigint] NOT NULL,
[batch_class_id] [varchar](255) NOT NULL,
[batch_class_name] [varchar](255) NULL,
[batch_id] [varchar](255) NOT NULL,
[batch_start_date] [datetime] NULL,
[start_date] [date] NOT NULL,
[document_id] [varchar](255) NOT NULL,
[document_type] [varchar](255) NULL,
[document_type_label] [varchar](280) NULL,
[confidence] [decimal] (10,2) NULL,
[confidence_threshold] [decimal] (10,2) NULL)
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N’MS_SSMA_SOURCE’ , N’SCHEMA’,N’dbo’, N’TABLE’,N’unnecessary_review’, NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N’MS_SSMA_SOURCE’, @value=N’reporting.unnecessary_review’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N’unnecessary_review’
GO
/****** Object: Table [dbo].[false_positive] Script Date: 01/13/2015 14:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[false_positive]’) AND type in (N’U’))
BEGIN
CREATE TABLE [dbo].[false_positive](
[id] [bigint] NOT NULL,
[batch_class_id] [varchar](255) NOT NULL,
[batch_class_name] [varchar](255) NULL,
[batch_id] [varchar](255) NOT NULL,
[batch_start_date] [datetime] NULL,
[start_date] [date] NOT NULL,
[document_id] [varchar](255) NOT NULL,
[old_doc_type] [varchar](255) NULL,
[new_doc_type] [varchar](255) NULL,
[document_type_label] [varchar](280) NULL,
[confidence] [decimal] (10,2) NULL,
[confidence_threshold] [decimal] (10,2) NULL)
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N’MS_SSMA_SOURCE’ , N’SCHEMA’,N’dbo’, N’TABLE’,N’false_positive’, NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N’MS_SSMA_SOURCE’, @value=N’reporting.false_positive’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N’false_positive’
GO
/****** Object: Table [dbo].[document_correction] Script Date: 01/13/2015 14:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[document_correction]’) AND type in (N’U’))
BEGIN
CREATE TABLE [dbo].[document_correction](
[id] [bigint] NOT NULL,
[batch_class_id] [varchar](255) NOT NULL,
[batch_class_name] [varchar](255) NULL,
[batch_id] [varchar](255) NOT NULL,
[batch_start_date] [datetime] NULL,
[start_date] [date] NOT NULL,
[document_type] [varchar] (255) NOT NULL,
[document_type_label] [varchar](280) NULL,
[classification_correction_count] [bigint] NULL DEFAULT 0,
[seperation_correction_count] [bigint] NULL DEFAULT 0,
[unnecessary_review_count] [bigint] NULL DEFAULT 0,
[false_positive_count] [bigint] NULL DEFAULT 0,
[total_correction_count] [bigint] NULL DEFAULT 0)
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N’MS_SSMA_SOURCE’ , N’SCHEMA’,N’dbo’, N’TABLE’,N’document_correction’, NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N’MS_SSMA_SOURCE’, @value=N’reporting.document_correction’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N’document_correction’
GO
insert into [@@ARCHIVE_REPORT_DB_NAME@@].[dbo].[document_correction] select * from [@@REPORT_DB_NAME@@].[dbo].[document_correction];
insert into [@@ARCHIVE_REPORT_DB_NAME@@].[dbo].[false_positive] select * from [@@REPORT_DB_NAME@@].[dbo].[false_positive];
insert into [@@ARCHIVE_REPORT_DB_NAME@@].[dbo].[unnecessary_review] select * from [@@REPORT_DB_NAME@@].[dbo].[unnecessary_review];
insert into [@@ARCHIVE_REPORT_DB_NAME@@].[dbo].[seperation_correction_accuracy] select * from [@@REPORT_DB_NAME@@].[dbo].[seperation_correction_accuracy];
insert into [@@ARCHIVE_REPORT_DB_NAME@@].[dbo].[seperation_correction] select * from [@@REPORT_DB_NAME@@].[dbo].[seperation_correction];
insert into [@@ARCHIVE_REPORT_DB_NAME@@].[dbo].[classification_correction_accuracy] select * from [@@REPORT_DB_NAME@@].[dbo].[classification_correction_accuracy];
insert into [@@ARCHIVE_REPORT_DB_NAME@@].[dbo].[classification_correction] select * from [@@REPORT_DB_NAME@@].[dbo].[classification_correction];
insert into [@@ARCHIVE_REPORT_DB_NAME@@].[dbo].[extraction_correction] select * from [@@REPORT_DB_NAME@@].[dbo].[extraction_correction];
insert into [@@ARCHIVE_REPORT_DB_NAME@@].[dbo].[field_correction] select * from [@@REPORT_DB_NAME@@].[dbo].[field_correction];
insert into [@@ARCHIVE_REPORT_DB_NAME@@].[dbo].[field_correction_details] select * from [@@REPORT_DB_NAME@@].[dbo].[field_correction_details];
insert into [@@ARCHIVE_REPORT_DB_NAME@@].[dbo].[field_details] select * from [@@REPORT_DB_NAME@@].[dbo].[field_details];
insert into [@@ARCHIVE_REPORT_DB_NAME@@].[dbo].[global_data] select * from [@@REPORT_DB_NAME@@].[dbo].[global_data];
truncate table [@@REPORT_DB_NAME@@].[dbo].[document_correction];
truncate table [@@REPORT_DB_NAME@@].[dbo].[false_positive];
truncate table [@@REPORT_DB_NAME@@].[dbo].[unnecessary_review];
truncate table [@@REPORT_DB_NAME@@].[dbo].[seperation_correction_accuracy];
truncate table [@@REPORT_DB_NAME@@].[dbo].[seperation_correction];
truncate table [@@REPORT_DB_NAME@@].[dbo].[classification_correction_accuracy];
truncate table [@@REPORT_DB_NAME@@].[dbo].[classification_correction];
truncate table [@@REPORT_DB_NAME@@].[dbo].[extraction_correction];
truncate table [@@REPORT_DB_NAME@@].[dbo].[field_correction];
truncate table [@@REPORT_DB_NAME@@].[dbo].[field_correction_details];
truncate table [@@REPORT_DB_NAME@@].[dbo].[field_details];
truncate table [@@REPORT_DB_NAME@@].[dbo].[global_data];