State machine scanning - matching a document
Description
The goal of the following state machine is to match a scanned document see scanning - analyze document with relevant person(s) and/or part(s). Once matched, the document is :
- accessible in the database from a person and/or part display page ;
- ready to be treated, that is to be used for creating a generic contract, e.g. in case of ID card
Most of the time, documents will be used to created contracts. Reason why the following sections refer to "from" and "to" persons. But it might also be that the document relates to only one person, or only to part(s), w/o pointing towards any person(s).
For more information about person and part, see here in abstract person and parts chapter
The process starts with an INITIAL state, and throughout its creation process, the document could have the following state :
UNMATCHED:Starting point with incoming parameters : resultingObject.
Represents the payload given as a result of the state machine scanning - analyze document (see just above). The object must be in
ANALYZEDstate.MATCHED: based of the already identified person(s) and/or part(s) in the payload "resultingObject", the system tries to find in database matching abstractPerson(s) and or/part(s). 2 scenarii are possible :happy path : the system can find all related targets ( person(s) and/or part(s) ) => automatic action COMPLETE MATCH => going to
MATCHEDstatethe system find zero, some or multiple targets => automatic action INCOMPLETE MATCH => going to
PENDING MATCHEDstate. In that case, the action UI INCOMPLETE MATCH allows user to manually find and/or create required person(s) and/or part(s) => and then going toMATCHEDstate
NOTE : the elements of the payload can vary according to the type of the document défined in the original payload (incoming parameter)
Once all person and/or part have been correctly matched, the document is on final state. Then the next step should be to encode this information, in principle ( but not necessarily - via contracts. For more information see encoding a document