Skip to content
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

Foundation of paper autofilling paper data with id card number #222

Merged
merged 7 commits into from
Jul 23, 2024

Conversation

zatteo
Copy link

@zatteo zatteo commented Jul 19, 2024

In this PR, I add the foundation of autofilling paper data when autofilling a contact by taking as example the id card number.

Screen.Recording.2024-07-19.at.17.33.45.mov

The paper data autofill expand the fillscript of a contact.

Tested :

  • contact autofill from popup fill the id card number
  • id card number field open the inline menu with contacts
  • contact autofill from inline menu fill the id card number

When we autofill a contact, we want to be able to autofill data
from papers of the contact.

The first candidate is id card number from national_id_card. So let's
add a new test form to have a goal to reach.
It will be needed soon to make CozyClient query
from AutofillService.
libs/cozy/mapping.ts Show resolved Hide resolved
libs/cozy/mapping.ts Outdated Show resolved Hide resolved
"Official identification number",
"Personal registration number",
];
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a huge list 😮 You did it yourself?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it is our awesome product owner.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, but I wonder if it's worth the effort to do it for every type of data. And also, I tend to think that we should do it with real-case examples, as:

  • it will avoid trying to imagine all possible cases
  • we should be careful with false positive: typically "Personal identifier" seems rather generic and not related to french ID card (also, it's worth questioning the need to support english keywords for very-french data such as this one).
    What do you think @BenjaminMty ?

We introduce :
- COZY_ATTRIBUTES_MAPPING, a mapping modelizing the link between
 a Bitwarden field type and what we need to get the corresponding data
 from Cozy doctypes
- getCozyValue, the main function that interpret the mapping and retrieve
 the corresponding data from Cozy doctypes

For the moment only id card number is added.
These constants are used by the autofill feature to know if a field
 should be filled by some data.

For the moment only id card number is added.
…d number

This new fillscript generation step enhances the fillscript already created for a contact. It will fill data from papers.

For the moment only id card number is added.
Bad compare of uppercase and lowercase

const papersFromContact = papers.filter((paper: any) => isReferencedByContact(paper, contactId));

return _.get(papersFromContact[0], cozyAttributeModel.path);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means that if I add my national id card but skip the contact part for any reason, it won't work? I wonder if we should try to fallback on myself by default?

Copy link
Collaborator

@paultranvan paultranvan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some open questions, but nothing blocking, thank you @zatteo!

Copy link
Member

@Merkur39 Merkur39 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!
Thanks @paultranvan, I'm going to merge so I can continue the development.

@Merkur39 Merkur39 merged commit c81e245 into feat/stream2-part2 Jul 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants