Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #52 from regulaforensics/develop
Browse files Browse the repository at this point in the history
Added rect for text-data
  • Loading branch information
aliaksandr-drozd authored Apr 25, 2024
2 parents 47f0fb1 + 3cadde7 commit e3b71f0
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.0.52",
"version": "0.0.53",
"author": "Regula Forensics, Inc.",
"name": "@regulaforensics/document-reader-recipes",
"description": "Document Reader Recipes",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { IsDefined, IsEnum, IsNumber, IsOptional, ValidateNested } from 'class-validator'
import { IsDefined, IsEnum, IsOptional, ValidateNested } from 'class-validator'
import { Expose, Type } from 'class-transformer'
import { eLights } from '@regulaforensics/document-reader-typings'

import { iRRect, RRect } from './children'
import { iRRect, RRect } from '@/common-models'


/**
Expand Down
2 changes: 2 additions & 0 deletions src/recipes/text/text-data/get-text-data.recipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const getTextData = (input: ProcessResponse): RTextData[] => {
current.value = field.value
current.lcid = field.lcid
current.checkResult = field.status

current.comparisonList = field.comparisonList?.map((i) => {
const current = new RTextDataComparison()

Expand All @@ -40,6 +41,7 @@ export const getTextData = (input: ProcessResponse): RTextData[] => {

currentSource.checkResult = validity?.status ?? eCheckResult.WAS_NOT_DONE
currentSource.source = source
currentSource.rect = currentSourceValue?.fieldRect
currentSource.value = currentSourceValue?.value ?? ''
currentSource.pageIndex = currentSourceValue?.pageIndex ?? 0
currentSource.probability = currentSourceValue?.probability ?? 0
Expand Down
28 changes: 23 additions & 5 deletions src/recipes/text/text-data/models/text-data-source.model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { IsDefined, IsEnum, IsString } from 'class-validator'
import { IsDefined, IsEnum, IsOptional, IsString, ValidateNested } from 'class-validator'
import { eCheckResult, eSource } from '@regulaforensics/document-reader-typings'

import { Default } from '@/decorators'
import { iRRect, RRect } from '@/common-models'
import { Expose, Type } from 'class-transformer'


/**
Expand Down Expand Up @@ -30,13 +32,19 @@ export interface iRTextDataSource {
* Field recognition probability
* @type {number}
*/
probability: number;
probability: number

/**
* Page index
* @type {number}
*/
pageIndex: number;
pageIndex: number

/**
* Rect
* @type {RRect|undefined}
*/
rect?: iRRect
}

/**
Expand Down Expand Up @@ -74,13 +82,23 @@ export class RTextDataSource implements iRTextDataSource {
*/
@IsDefined()
@Default(0)
probability: number;
probability: number

/**
* Page index
* @type {number}
*/
@IsDefined()
@Default(0)
pageIndex: number;
pageIndex: number

/**
* Rect
* @type {RRect|undefined}
*/
@Expose()
@IsOptional()
@Type(() => RRect)
@ValidateNested()
rect?: RRect
}

0 comments on commit e3b71f0

Please sign in to comment.