Пример #1
0
        private static void BupaLegacyGet2YearPrior(DocClass result)
        {
            var st2YPrior = new StaticTextRule("2YearsPrior", RuleBinding.Required);

            st2YPrior.TextToSearch = "Policy Year";
            st2YPrior.SearchArea   = new System.Windows.Rect(0, 0, 1000, 1000);
            result.AddDataRule(st2YPrior);

            var rgcsMonthlyClaims = new RepeatingCSRule("2YPrior_MonthlyClaim_0", RuleBinding.Required);

            rgcsMonthlyClaims.TextToSearch    = @"\d{3,7}";
            rgcsMonthlyClaims.DependencyRule  = st2YPrior;
            rgcsMonthlyClaims.InterlineSpaces = 30;
            result.AddDataRule(rgcsMonthlyClaims);
            var dargMonthlyClaims = new DependencyArea();

            dargMonthlyClaims.Below.Type    = RelationTypes.Bot;
            dargMonthlyClaims.Below.Offset  = 10;
            dargMonthlyClaims.LeftOf.Type   = RelationTypes.Right;
            dargMonthlyClaims.LeftOf.Offset = 50;
            dargMonthlyClaims.RightOf.Type  = RelationTypes.Left;
            //dargMonthlyClaims.RightOf.Offset = 250;
            dargMonthlyClaims.Above.Type     = RelationTypes.Bot;
            dargMonthlyClaims.Above.Offset   = 70;
            rgcsMonthlyClaims.DependencyArea = dargMonthlyClaims;

            var rgcsNumberOfLives = new RepeatingCSRule("2YPrior_NumberOfLives_0", RuleBinding.Required);

            rgcsNumberOfLives.TextToSearch    = @"[\da-zA-Z]{1,3}";
            rgcsNumberOfLives.DependencyRule  = st2YPrior;
            rgcsNumberOfLives.InterlineSpaces = 30;
            result.AddDataRule(rgcsNumberOfLives);
            var dargNumberOfLives = new DependencyArea();

            dargNumberOfLives.Below.Type     = RelationTypes.Bot;
            dargNumberOfLives.Below.Offset   = 10;
            dargNumberOfLives.LeftOf.Type    = RelationTypes.Right;
            dargNumberOfLives.LeftOf.Offset  = 320;
            dargNumberOfLives.RightOf.Type   = RelationTypes.Right;
            dargNumberOfLives.RightOf.Offset = 200;
            dargNumberOfLives.Above.Type     = RelationTypes.Bot;
            dargNumberOfLives.Above.Offset   = 70;
            rgcsNumberOfLives.DependencyArea = dargNumberOfLives;
        }
Пример #2
0
        private static void TawuniaLegacyAddDataRules(DocClass result)
        {
            var crNumInit = new StaticTextRule("CrNum", RuleBinding.Optional);

            result.AddDataRule(crNumInit);
            crNumInit.TextToSearch = "CR number";
            crNumInit.SearchArea   = new System.Windows.Rect(0, 0, 1000, 1000);

            var InterceptInit = new StaticTextRule("Inception", RuleBinding.Required);

            result.AddDataRule(InterceptInit);
            InterceptInit.DependencyRule = crNumInit;
            var depArinter = new DependencyArea();

            InterceptInit.DependencyArea = depArinter;
            depArinter.Below.Type        = RelationTypes.Bot;
            depArinter.RightOf.Type      = RelationTypes.Left;
            depArinter.RightOf.Offset    = -100;
            depArinter.LeftOf.Type       = RelationTypes.Right;
            depArinter.LeftOf.Offset     = 100;
            depArinter.Above.Type        = RelationTypes.Right;
            depArinter.Above.Offset      = 150;
            InterceptInit.TextToSearch   = "Inception";
            InterceptInit.SearchArea     = new System.Windows.Rect(0, 0, 1000, 1000);

            var PolicyHold = new StaticTextRule("PolicyHold", RuleBinding.Required);

            result.AddDataRule(PolicyHold);
            PolicyHold.DependencyRule = crNumInit;
            var policyDepAr = new DependencyArea();

            PolicyHold.DependencyArea  = policyDepAr;
            policyDepAr.Below.Type     = RelationTypes.Top;
            policyDepAr.Below.Offset   = -150;
            policyDepAr.RightOf.Type   = RelationTypes.Left;
            policyDepAr.RightOf.Offset = -100;
            policyDepAr.LeftOf.Type    = RelationTypes.Right;
            policyDepAr.LeftOf.Offset  = 100;
            policyDepAr.Above.Type     = RelationTypes.Top;
            PolicyHold.TextToSearch    = "Policy holder";
            PolicyHold.SearchArea      = new System.Windows.Rect(0, 0, 1000, 1000);

            var Expiry = new StaticTextRule("Expiry", RuleBinding.Required);

            result.AddDataRule(Expiry);
            Expiry.DependencyRule = InterceptInit;
            var ExpiryDepAr = new DependencyArea();

            Expiry.DependencyArea      = ExpiryDepAr;
            ExpiryDepAr.Below.Type     = RelationTypes.Bot;
            ExpiryDepAr.RightOf.Type   = RelationTypes.Left;
            ExpiryDepAr.RightOf.Offset = -100;
            ExpiryDepAr.LeftOf.Type    = RelationTypes.Right;
            ExpiryDepAr.LeftOf.Offset  = 100;
            ExpiryDepAr.Above.Type     = RelationTypes.Bot;
            ExpiryDepAr.Above.Offset   = 150;
            Expiry.TextToSearch        = "Expiry";
            Expiry.SearchArea          = new System.Windows.Rect(0, 0, 1000, 1000);

            var crNumData = new CharacterStringRule("CrNumberData", RuleBinding.Required);

            result.AddDataRule(crNumData);
            crNumData.DependencyRule = crNumInit;
            var crNumDataDR = new DependencyArea();

            crNumData.DependencyArea   = crNumDataDR;
            crNumDataDR.Below.Type     = RelationTypes.Top;
            crNumDataDR.Below.Offset   = -10;
            crNumDataDR.RightOf.Type   = RelationTypes.Right;
            crNumDataDR.RightOf.Offset = 100;
            crNumDataDR.LeftOf.Type    = RelationTypes.Right;
            crNumDataDR.LeftOf.Offset  = 700;
            crNumDataDR.Above.Type     = RelationTypes.Bot;
            crNumDataDR.Above.Offset   = 10;
            crNumData.TextToSearch     = @"\d{6,12}";
            crNumData.SearchArea       = new System.Windows.Rect(0, 0, 1000, 1000);

            var InceptionData = new CharacterStringRule("InceptionDate", RuleBinding.Required);

            result.AddDataRule(InceptionData);
            InceptionData.DependencyRule = InterceptInit;
            var InceptionDataDR = new DependencyArea();

            InceptionData.DependencyArea   = InceptionDataDR;
            InceptionDataDR.Below.Type     = RelationTypes.Top;
            InceptionDataDR.Below.Offset   = -10;
            InceptionDataDR.RightOf.Type   = RelationTypes.Right;
            InceptionDataDR.RightOf.Offset = 100;
            InceptionDataDR.LeftOf.Type    = RelationTypes.Right;
            InceptionDataDR.LeftOf.Offset  = 700;
            InceptionDataDR.Above.Type     = RelationTypes.Bot;
            InceptionDataDR.Above.Offset   = 10;
            InceptionData.TextToSearch     = @"\d{2,4}-\d{2}-\d{2,4}";
            InceptionData.SearchArea       = new System.Windows.Rect(0, 0, 1000, 1000);

            var ExpiryData = new CharacterStringRule("ExpiryDate", RuleBinding.Required);

            result.AddDataRule(ExpiryData);
            ExpiryData.DependencyRule = Expiry;
            var EpiryDataDR = new DependencyArea();

            ExpiryData.DependencyArea  = EpiryDataDR;
            EpiryDataDR.Below.Type     = RelationTypes.Top;
            EpiryDataDR.Below.Offset   = -10;
            EpiryDataDR.RightOf.Type   = RelationTypes.Right;
            EpiryDataDR.RightOf.Offset = 100;
            EpiryDataDR.LeftOf.Type    = RelationTypes.Right;
            EpiryDataDR.LeftOf.Offset  = 700;
            EpiryDataDR.Above.Type     = RelationTypes.Bot;
            EpiryDataDR.Above.Offset   = 10;
            ExpiryData.TextToSearch    = @"\d{2,4}-\d{2}-\d{2,4}";
            ExpiryData.SearchArea      = new System.Windows.Rect(0, 0, 1, 1);

            //-----------------------------------TABLE
            var stPeriod = new StaticTextRule("Period", RuleBinding.Required);

            stPeriod.TextToSearch = "Period";
            result.AddDataRule(stPeriod);
            stPeriod.DependencyRule = Expiry;
            var daPeriod = new DependencyArea();

            stPeriod.DependencyArea = daPeriod;
            daPeriod.Below.Type     = RelationTypes.Bot;
            daPeriod.Below.Offset   = 100;
            daPeriod.RightOf.Type   = RelationTypes.Left;
            daPeriod.LeftOf.Type    = RelationTypes.Right;
            daPeriod.LeftOf.Offset  = 200;
            daPeriod.Above.Type     = RelationTypes.Bot;
            daPeriod.Above.Offset   = 500;

            var csPeriod = new CharacterStringRule("PeriodData", RuleBinding.Required);

            csPeriod.TextToSearch = @"[a-zA-Z\s\d]+";
            result.AddDataRule(csPeriod);
            csPeriod.DependencyRule = stPeriod;
            var daPeriodData = new DependencyArea();

            csPeriod.DependencyArea     = daPeriodData;
            daPeriodData.Below.Type     = RelationTypes.Bot;
            daPeriodData.Above.Type     = RelationTypes.Bot;
            daPeriodData.Above.Offset   = 100;
            daPeriodData.LeftOf.Type    = RelationTypes.Right;
            daPeriodData.LeftOf.Offset  = 150;
            daPeriodData.RightOf.Type   = RelationTypes.Left;
            daPeriodData.RightOf.Offset = -100;

            var rgPeriodData = new RepeatingCSRule("LastYear_MonthlyClaim_0", RuleBinding.Required);

            rgPeriodData.TextToSearch = @"\d{2}\/\d{4}";
            result.AddDataRule(rgPeriodData);
            rgPeriodData.DependencyRule = stPeriod;
            var daRgPeriodData = new DependencyArea();

            daRgPeriodData.Below.Type     = RelationTypes.Bot;
            daRgPeriodData.Below.Offset   = 20;
            daRgPeriodData.LeftOf.Type    = RelationTypes.Right;
            daRgPeriodData.LeftOf.Offset  = 200;
            daRgPeriodData.RightOf.Type   = RelationTypes.Right;
            daRgPeriodData.RightOf.Offset = 100;
            daRgPeriodData.Above.Type     = RelationTypes.Bot;
            daRgPeriodData.Above.Offset   = 70;
            rgPeriodData.DependencyArea   = daRgPeriodData;

            var rgPeriodNumOfLives = new RepeatingCSRule("LastYear_NumberOfLives_0", RuleBinding.Required);

            rgPeriodNumOfLives.TextToSearch = @"\d{1,4}";
            result.AddDataRule(rgPeriodNumOfLives);
            rgPeriodNumOfLives.DependencyRule = stPeriod;
            var dargPeriodNumOfLives = new DependencyArea();

            dargPeriodNumOfLives.Below.Type     = RelationTypes.Bot;
            dargPeriodNumOfLives.Below.Offset   = 20;
            dargPeriodNumOfLives.LeftOf.Type    = RelationTypes.Right;
            dargPeriodNumOfLives.LeftOf.Offset  = 350;
            dargPeriodNumOfLives.RightOf.Type   = RelationTypes.Right;
            dargPeriodNumOfLives.RightOf.Offset = 250;
            dargPeriodNumOfLives.Above.Type     = RelationTypes.Bot;
            dargPeriodNumOfLives.Above.Offset   = 70;
            rgPeriodNumOfLives.DependencyArea   = dargPeriodNumOfLives;
        }