Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

create mrz correction #29

Merged
merged 11 commits into from
Jan 23, 2023
Merged

create mrz correction #29

merged 11 commits into from
Jan 23, 2023

Conversation

wadjih-bencheikh18
Copy link
Member

closes #22

@wadjih-bencheikh18 wadjih-bencheikh18 linked an issue Jan 10, 2023 that may be closed by this pull request
@wadjih-bencheikh18 wadjih-bencheikh18 marked this pull request as draft January 10, 2023 12:44
@codecov
Copy link

codecov bot commented Jan 10, 2023

Codecov Report

Base: 85.32% // Head: 87.83% // Increases project coverage by +2.50% 🎉

Coverage data is based on head (6d0a0da) compared to base (33331d1).
Patch coverage: 97.93% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #29      +/-   ##
==========================================
+ Coverage   85.32%   87.83%   +2.50%     
==========================================
  Files          38       40       +2     
  Lines         327      378      +51     
  Branches       82       95      +13     
==========================================
+ Hits          279      332      +53     
+ Misses         48       46       -2     
Impacted Files Coverage Δ
src/parse/fieldTemplates.ts 100.00% <ø> (ø)
src/parse/autoCorrection.ts 92.85% <92.85%> (ø)
src/formats.ts 100.00% <100.00%> (ø)
src/parse/checkLines.ts 66.66% <100.00%> (ø)
src/parse/createFieldParser.ts 98.27% <100.00%> (+0.77%) ⬆️
src/parse/frenchNationalId.ts 75.00% <100.00%> (-2.78%) ⬇️
src/parse/getResult.ts 100.00% <100.00%> (ø)
src/parse/parse.ts 100.00% <100.00%> (+16.66%) ⬆️
src/parse/swissDrivingLicense.ts 63.63% <100.00%> (-3.04%) ⬇️
src/parse/td1.ts 75.00% <100.00%> (-2.78%) ⬇️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@wadjih-bencheikh18 wadjih-bencheikh18 changed the title feat: create correction of td1 and td2 create mrz correction Jan 10, 2023
@wadjih-bencheikh18 wadjih-bencheikh18 marked this pull request as ready for review January 10, 2023 20:28
@lpatiny
Copy link
Member

lpatiny commented Jan 11, 2023

@targos In the issue I asked:

For all the fields (and likely also at the level of fieldTemplates) we will probably need a property that specifies the allowed values (NUMERIC, CHARACTERS, BOTH)

But it was implemented as separate files like 'td1Correction'. I think this implementation is more difficult to maintain but maybe I missed something.

@targos
Copy link
Member

targos commented Jan 11, 2023

I agree.

@wadjih-bencheikh18
Copy link
Member Author

wadjih-bencheikh18 commented Jan 12, 2023

I refactored the code (correct each field before parsing), but there is one issue in the autocorrect
there's some fields that have a related ranges, the parse function is using it without correction

I see that the solution is to correct all the line then start to parse fields

@targos
Copy link
Member

targos commented Jan 12, 2023

I see that the solution is to correct all the line then start to parse fields

Sounds good to me. A first loop could create the initial "empty" detail object for each field and do the correction. Then another pass is done to parse.

@wadjih-bencheikh18
Copy link
Member Author

Sounds good to me.

Implemented.

@targos targos merged commit 2eb597c into main Jan 23, 2023
@targos targos deleted the 22-possibility-for-autocorrection branch January 23, 2023 08:10
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possibility for autoCorrection
4 participants