private List GetNextValueLines()

in packages/ekyc-api/src/ekyc-api/DocumentDefinitions/ID-KTP/ID_KTP_DocumentDefinition.cs [270:298]


        private List<Block> GetNextValueLines(List<Block> lines, Block currentValueLine, string ExpectedHeaderName)
        {
            var currentLineBottom = currentValueLine.Geometry.BoundingBox.Top +
                                    currentValueLine.Geometry.BoundingBox.Height;

            var nextLine = lines.Where(x =>
                    x.Geometry.BoundingBox.Top > currentLineBottom &&
                    x.Geometry.BoundingBox.Left < HeaderLeftThreshold &&
                    x.Text.ToLower().Trim().StartsWith(ExpectedHeaderName.ToLower().Trim()))
                .OrderBy(x => x.Geometry.BoundingBox.Top)
                .ThenBy(x => x.Geometry.BoundingBox.Left)
                .FirstOrDefault();

            if (nextLine == null) // Can't find the next header name
                return new List<Block>();
            // Let's look for a value line 

            var values = lines.Where(x => x.Geometry.BoundingBox.Top > currentLineBottom
                                          && x.Geometry.BoundingBox.Top + x.Geometry.BoundingBox.Height <
                                          nextLine.Geometry.BoundingBox.Top
                                          && Math.Abs(x.Geometry.BoundingBox.Left -
                                                      currentValueLine.Geometry.BoundingBox.Left) <=
                                          FieldLeftDiffThreshold
                                          && !string.IsNullOrEmpty(x.Text))
                .OrderBy(x => x.Geometry.BoundingBox.Top)
                .ThenBy(x => x.Geometry.BoundingBox.Left).ToList();

            return values;
        }