-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/Add latest national ID card version in OCR process #2353
Conversation
The rotated file is saved in the "formData" state only once we move on to the next step, and not at each rotation. The state of the "formData" is therefore not up to date if the last file added has been rotated.
777f598
to
c7f49e7
Compare
In view of future developments, it is preferable to separate the responsibilities of each helper. It was also discussed with @paultranvan to change the type of the `ocrAttributes` attribute in the config file, for more flexibility.
This modal comes after the animated OCR processing modal, to ask the user to confirm the recognized version.
This introduces a new 'stripChars' method in validationRules, useful to remove extra characters from the regex. Those characters are useful for detection, but should be removed afterwards.
This is the french identity card format, created in march 21. By @paultranvan
This introduces the possibility to detect a paper version, based on the 2 sides OCR + reference rules. Those rules can be applied on front and/or back side. All the rules must be respected in order to detect a version. For now, the rules are simple regex, evaluated against the OCR. By @paultranvan
56e2350
to
a977bba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bien le découpage des commits 👍
packages/cozy-mespapiers-lib/src/components/ModelSteps/helpers.js
Outdated
Show resolved
Hide resolved
packages/cozy-mespapiers-lib/src/components/ModelSteps/ScanResult/OcrProcessingDialog.jsx
Show resolved
Hide resolved
packages/cozy-mespapiers-lib/src/components/ModelSteps/ScanResult/SelectPaperFormat.jsx
Outdated
Show resolved
Hide resolved
@@ -6,6 +6,17 @@ import log from 'cozy-logger' | |||
const MAX_TEXT_SHIFT_THRESHOLD = 5 // in % | |||
const MAX_LINE_SHIFT_THRESHOLD = 5 // in px | |||
|
|||
const normalizeText = text => { | |||
// TODO: more normalization might be necessary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
y'a t-il un todo à faire, ou faut-il modifier le commentaire pour être plus explicite ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Le TODO est pour là pour plus tard justement, il pourrait il y avoir des besoins supplémentaires de normalisation, mais je préfère les ajouter au fil de l'eau plutôt qu'en faire trop et tomber sur des effets de bords non maîtrisés
packages/cozy-mespapiers-lib/src/components/ModelSteps/ScanResult/SelectPaperFormat.jsx
Outdated
Show resolved
Hide resolved
By being too strict on the validation rules, we were sometimes missing the recognition, typically because of a '0' interpreted as a 'O'.
We are now more flexible on the date post-validation format, by using date-fns parse method. We also try/catch the method to avoid crashes when the date format is wrong.
Those additional regex rules are quite useful for number and expiration date attributes, as the passport is hard to correctly scan, leading to detection failures for boxes detection.
Cette PR ajoute lors de l'OCR la possibilité de gérer plusieurs versions d'un même document.
Ce changement à mené à repenser, avec @paultranvan, à certaines implémentations, autant dans la configuration du fichier
papersDefinitions.json
, que dans quelques fonctions existantes.Côté UI/UX, nous ajoutons un nouvel écran à la suite de l'écran du traitement OCR, pour demander à l'utilisateur de confirmer la version reconnue.
Et c'est à la suite de cette confirmation que nous extrayons les bonnes données, et affichons la suite du process.