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 #65 from regulaforensics/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
aliaksandr-drozd authored Jun 11, 2024
2 parents 4d8299f + 9f92922 commit 97b497a
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 5 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.66",
"version": "0.0.67",
"author": "Regula Forensics, Inc.",
"name": "@regulaforensics/document-reader-recipes",
"description": "Document Reader Recipes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
AuthenticityOCRSecurityTextCheckResult,
AuthenticityPhotoIdentCheckResult,
AuthenticitySecurityFeatureCheckResult,
eAuthenticity,
eCheckDiagnose,
eCheckResult,
eLights,
Expand Down Expand Up @@ -124,13 +123,22 @@ export const getAuthenticityCheckList = (input: ProcessResponse): RAuthenticityC
}

current.groups[groupIndex].checks.push(RAuthenticityTextCheck.fromPlain({
reference: {
type: subItem.EtalonResultType,
reference: subItem.EtalonResultOCR,
result: subItem.SecurityTextResultOCR,
location: {
light: subItem.EtalonLightType,
rect: [subItem.EtalonFieldRect],
}
},
checkType: subItem.Type,
checkResult: subItem.ElementResult ?? eCheckResult.WAS_NOT_DONE,
type: subItem.EtalonFieldType,
diagnose: subItem.ElementDiagnose ?? eCheckDiagnose.UNKNOWN,
location: {
light: subItem.LightType,
rect: [subItem.EtalonFieldRect],
rect: [subItem.FieldRect],
}
}))
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import { IsDefined, IsEnum, IsIn, ValidateNested } from 'class-validator'
import { plainToInstance, Type } from 'class-transformer'

import {
AuthenticityOCRSecurityTextCheckResultTypes,
eCheckDiagnose,
eCheckResult,
eVisualFieldType,
type tAuthenticityOCRSecurityTextCheckResultType,
} from '@regulaforensics/document-reader-typings'

import { aAuthenticityCheck } from '../authenticity-check.abstract'
import { iRLocation, RLocation } from './children'
import { iRAuthenticityTextCheckReference, iRLocation, RAuthenticityTextCheckReference, RLocation } from './children'


/**
* Authenticity text check result type
*/
export interface iRAuthenticityTextCheck extends aAuthenticityCheck {
reference: iRAuthenticityTextCheckReference

/**
* Feature type
* @type {tAuthenticityOCRSecurityTextCheckResultType}
Expand Down Expand Up @@ -51,6 +53,11 @@ export interface iRAuthenticityTextCheck extends aAuthenticityCheck {
* Authenticity text check result type
*/
export class RAuthenticityTextCheck extends aAuthenticityCheck implements iRAuthenticityTextCheck {
@IsDefined()
@ValidateNested()
@Type(() => RAuthenticityTextCheckReference)
reference: RAuthenticityTextCheckReference

/**
* Feature type
* @type {tAuthenticityOCRSecurityTextCheckResultType}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { IsDefined, IsEnum, IsIn, IsString, ValidateNested } from 'class-validator'
import { Type } from 'class-transformer'

import { eResultType, } from '@regulaforensics/document-reader-typings'
import { iRLocation, RLocation } from '../location'


export type tAuthenticityTextCheckReferenceType = eResultType.MRZ_OCR_EXTENDED | eResultType.VISUAL_OCR_EXTENDED | eResultType.BARCODES_TEXT_DATA

export const AuthenticityTextCheckReferenceTypes: tAuthenticityTextCheckReferenceType[] = [
eResultType.MRZ_OCR_EXTENDED,
eResultType.VISUAL_OCR_EXTENDED,
eResultType.BARCODES_TEXT_DATA,
]

export interface iRAuthenticityTextCheckReference {
type: tAuthenticityTextCheckReferenceType

reference: string

result: string

location: iRLocation
}

export class RAuthenticityTextCheckReference implements iRAuthenticityTextCheckReference {
@IsDefined()
@IsEnum(eResultType)
@IsIn(AuthenticityTextCheckReferenceTypes)
type: tAuthenticityTextCheckReferenceType

@IsDefined()
@IsString()
reference: string

@IsDefined()
@IsString()
result: string

/**
* Area location
* @type {RLocation}
*/
@IsDefined()
@ValidateNested()
@Type(() => RLocation)
location: RLocation
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './authenticity-text-check-reference.model'
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './authenticity-text-check-reference'
export * from './location'

0 comments on commit 97b497a

Please sign in to comment.