Outils pour utilisateurs

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
documentation_technique_scripts [2025/05/19 16:59] ctisseranddocumentation_technique_scripts [2025/05/20 16:38] (Version actuelle) ctisserand
Ligne 1: Ligne 1:
-Demonstration+====== Documentation pour écrire un script custom (LUA) ====== 
 + 
 +<markdown> 
 +Squelette du script
 ``` ```
 -- script title -- script title
Ligne 19: Ligne 22:
 return true or false return true or false
 ``` ```
-# Titre+# Titre du script
 ``` ```
 --- country_alpha2 = title --- country_alpha2 = title
Ligne 35: Ligne 38:
 Si la langue cible n'est pas disponible, EN est utilisé, sinon le premier disponible est utilisé Si la langue cible n'est pas disponible, EN est utilisé, sinon le premier disponible est utilisé
  
-Paramètre+Paramètres
 ``` ```
 --% module | country_alpha2 = name | country_alpha2 = name --% module | country_alpha2 = name | country_alpha2 = name
Ligne 48: Ligne 51:
 Il ne sert pas a définir les tests (cf. Module), ils servent a définir le comportement du code Il ne sert pas a définir les tests (cf. Module), ils servent a définir le comportement du code
  
-Module+Modules (référence pour les script)
 ``` ```
  
Ligne 59: Ligne 62:
 Il définissent les tests qui seront enregistrés dans le rapport archivé Il définissent les tests qui seront enregistrés dans le rapport archivé
  
-Une référence peut être utilisé plusieur fois dans le script, le résultat final sera un OU logique entre tout les retour de la référence+Une référence peut être utilisée plusieurs fois dans le script, le résultat final sera un OU logique entre tous les retours de la référence
  
-Le nom final d'une référence est consitué de tous ces composant nécéssaire + le nom de la référence+Le nom final d'une référence est consitué de tous ces composants nécéssaires + le nom de la référence
  
 exemple exemple
Ligne 70: Ligne 73:
  
 # Services # Services
-Un service fournit des fonctions additionnelles pour certain traitement particulier+Un service permet l'appel à des compsants externes pour certains traitements particuliers 
 + 
 +Ci-dessous la liste des services disponibles ainsi que leur documentation extraite automatiquement
  
 Exemple:  Exemple: 
Ligne 77: Ligne 82:
 services.email.verify(input.data.email[0], false, false) services.email.verify(input.data.email[0], false, false)
 ``` ```
-## country+## email
 ``` ```
-country_exists(country: Any)+services.email.verify(email: Any, check_mx: Any = True, check_server_respond: Any = False)
 ``` ```
-From the name of a country, find all the real country that match the name+Verify the regex and domain of an email
  
-countryName of the country to search+email: the email address 
 +- check_mx: Check if an MX entry exist for this domain. True by default 
 +- check_server_respond: if check_mx is True, check if the server respond. False by default
  
 ## inpi ## inpi
 ``` ```
-by_siret(siret: str)+services.inpi.by_siret(siret: str)
 ``` ```
 Get the information on a company from INPI Get the information on a company from INPI
Ligne 94: Ligne 101:
  
 ``` ```
-by_siren(siren: str)+services.inpi.by_siren(siren: str)
 ``` ```
 Get the information on a company from INPI Get the information on a company from INPI
Ligne 100: Ligne 107:
 - siren: the SIREN number of the company - siren: the SIREN number of the company
  
-## email+## country
 ``` ```
-verify(email: Any, check_mx: Any = True, check_server_respond: Any = False)+services.country.country_exists(country: Any)
 ``` ```
-Verify the regex and domain of an email+From the name of a country, find all the real country that match the name
  
-email: the email address +countryName of the country to search
-- check_mx: Check if an MX entry exist for this domain. True by default +
-- check_server_respond: if check_mx is True, check if the server respond. False by default+
  
-# Données fournis en entré du script +# Données fournies en entrée du script 
-Les données fournit par le moteur sont dans le champ `input`+Les données fournies par le moteur sont dans le champ `input`
  
 - data: dict[field_name, list[str]] - data: dict[field_name, list[str]]
Ligne 120: Ligne 125:
 local name = input.data.name local name = input.data.name
 ``` ```
-# Données pouvant etre fournis en sortie du script +# Données pouvant être fournies en sortie du script 
-Les données fournit au moteur sont dans le champ `output`+Les données fournies au moteur sont dans le champ `output`
  
 - identity: PersonalDetails - identity: PersonalDetails
Ligne 132: Ligne 137:
 output.valid[doc.name] = true output.valid[doc.name] = true
 ``` ```
-# Functions+# Functions utilisables dans le script 
 +## check 
 +``` 
 +check( 
 + doc: PersonalDetails | MRZDocument | DocumentWrapper 
 + field: str | list[str] 
 + fn: bool (list[str] | Any) 
 + ref: str 
 + parse: bool = False 
 + hide: bool = False 
 + all_values: bool = False 
 +
 +``` 
 +Verify the validity of a field with the function given 
 +- doc: a DocumentWrapper, PersonalDetails or MRZDocument to get the value from 
 +- field: standardize field name or a list of standardize field name to get from the document 
 +- fn: the function to verify the validity of the data 
 +- ref: a description to indicate the verification done for the report 
 +- parse: True to try to parse the data before giving it to the function, False to have a string. If a PersonalDetails is or MRZDocument is given the value is already parsed 
 +- hide: True to hide this verification from the report 
 +- all_values: If False, the first value to return true is used, else every value must return true 
 + 
 +## check_concat 
 +``` 
 +check_concat( 
 + doc: DocumentWrapper 
 + field: str | list[str] 
 + fn: bool (list[str] | Any) 
 + ref: str 
 + hide: bool = False 
 + parse: bool = False 
 + allow_missing_field: bool = False 
 +
 +``` 
 +Verify the validity of the concatenation of multiple field with the function given 
 +- doc: a DocumentWrapper to get the value from 
 +- field: standardize field name or a list of standardize field name to get from the document 
 +- fn: the function to verify the validity of the data 
 +- ref: a description to indicate the verification done for the report 
 +- hide: True to hide this verification from the report 
 +- parse: True to try to parse the data before giving it to the function, False to have a string 
 +- allow_missing_field: True to allow the fields to not be found, else an error will be raised if a field is not found in the document 
 ## compare ## compare
 ``` ```
Ligne 158: Ligne 205:
 - hide: True if the verification is valid - hide: True if the verification is valid
  
-## save_error+## contains
 ``` ```
-save_error+contains
- codes: list[tuple[EnrollmentStatusCodeEnum | str] | ErrorCodeException | EnrollmentStatusCode]+ _list: list[Any] 
 + item: Any
 ) )
 ``` ```
- +Test if is contains in 
-- codes: save an instance of EnrollmentStatusCode or ErrorCodeException or (EnrollmentStatusCodeEnum, text) +_list: Any list 
- +item: the item to find
-## create_date_mask +
-``` +
-create_date_mask( +
- d: str +
- date_format: Any = "%y%m%d" +
-+
-``` +
-Create a valid mask for the date given (ex: 1990 -> YYYY, 901212 -> YYMMDD) +
-- d: the date as a string +
-- date_format: the format of the date to parse +
- +
-## error_type +
-``` +
-error_type( +
- error: Exception +
-+
-``` +
-Get the name of a python exception +
-- error: The exception to have the name from +
- +
-## to_lua +
-``` +
-to_lua( +
- x: Any +
-+
-``` +
-convert an object from python to LUA +
-xa python compatible object +
- +
-## check +
-``` +
-check( +
- doc: PersonalDetails | MRZDocument | DocumentWrapper +
- field: str | list[str] +
- fn: bool (list[str] | Any+
- ref: str +
- parse: bool = False +
- hide: bool = False +
- all_values: bool = False +
-+
-``` +
-Verify the validity of a field with the function given +
-- doc: a DocumentWrapper, PersonalDetails or MRZDocument to get the value from +
-- field: standardize field name or a list of standardize field name to get from the document +
-fn: the function to verify the validity of the data +
-- ref: a description to indicate the verification done for the report +
-- parse: True to try to parse the data before giving it to the function, False to have a string. If a PersonalDetails is or MRZDocument is given the value is already parsed +
-- hide: True to hide this verification from the report +
-- all_values: If False, the first value to return true is used, else every value must return true +
- +
-## is_available +
-``` +
-is_available( +
- doc: DocumentWrapper +
- field: str +
-+
-``` +
-Determine if the field is available in a document +
-- doc: a DocumentWrapper to get the value from +
-- field: standardize field name to get from the document+
  
 ## correct ## correct
Ligne 247: Ligne 235:
 - hide: True to hide this correction from the report - hide: True to hide this correction from the report
  
-## contains+## create_date_mask
 ``` ```
-contains+create_date_mask
- _listlist[Any] + dstr 
- item: Any+ date_format: Any = "%y%m%d"
 ) )
 ``` ```
-Test if y is contains in x +Create a valid mask for the date given (ex: 1990 -> YYYY, 901212 -> YYMMDD) 
-_listAny list +dthe date as a string 
-item: the item to find+date_format: the format of the date to parse
  
 ## custom_info ## custom_info
Ligne 275: Ligne 263:
 - score: if used, indicate the score obtain with this verification - score: if used, indicate the score obtain with this verification
  
-## check_concat+## error_type
 ``` ```
-check_concat+error_type
- docDocumentWrapper + errorException
- field: str | list[str] +
- fn: bool (list[str] | Any) +
- ref: str +
- hide: bool = False +
- parse: bool = False +
- allow_missing_field: bool = False+
 ) )
 ``` ```
-Verify the validity of the concatenation of multiple field with the function given +Get the name of a python exception 
-- doc: a DocumentWrapper to get the value from +errorThe exception to have the name from
-- field: standardize field name or a list of standardize field name to get from the document +
-- fn: the function to verify the validity of the data +
-- ref: description to indicate the verification done for the report +
-hideTrue to hide this verification from the report +
-- parse: True to try to parse the data before giving it to the function, False to have a string +
-- allow_missing_field: True to allow the fields to not be found, else an error will be raised if a field is not found in the document +
- +
-## get_value +
-``` +
-get_value( +
- doc: DocumentWrapper +
- field: str | list[str] +
- parse: bool = False +
-+
-``` +
-Get the value of a field in a document +
-- doc: a DocumentWrapper to get the value from +
-- field: standardize field name or a list of standardize field name to get from the document +
-- parse: True to try to parse the result, False to have a string +
- +
-## parse_date +
-``` +
-parse_date( +
-  +
-+
-``` +
  
 ## fuzzy ## fuzzy
Ligne 338: Ligne 293:
 Make a python coroutine usable. Available: #(...), .first(), .all() Make a python coroutine usable. Available: #(...), .first(), .all()
 - co: Python coroutine to use - co: Python coroutine to use
 +
 +## get_value
 +```
 +get_value(
 + doc: DocumentWrapper
 + field: str | list[str]
 + parse: bool = False
 +)
 +```
 +Get the value of a field in a document
 +- doc: a DocumentWrapper to get the value from
 +- field: standardize field name or a list of standardize field name to get from the document
 +- parse: True to try to parse the result, False to have a string
 +
 +## is_available
 +```
 +is_available(
 + doc: DocumentWrapper
 + field: str
 +)
 +```
 +Determine if the field is available in a document
 +- doc: a DocumentWrapper to get the value from
 +- field: standardize field name to get from the document
  
 ## list ## list
Ligne 347: Ligne 326:
 convert a list from lua to python convert a list from lua to python
 - x: a LUA compatible list - x: a LUA compatible list
 +
 +## parse_date
 +```
 +parse_date(
 +
 +)
 +```
 +
 +
 +## save_error
 +```
 +save_error(
 + codes: list[tuple[EnrollmentStatusCodeEnum | str] | ErrorCodeException | EnrollmentStatusCode]
 +)
 +```
 +
 +- codes: save an instance of EnrollmentStatusCode or ErrorCodeException or (EnrollmentStatusCodeEnum, text)
  
 ## throw ## throw
Ligne 358: Ligne 354:
 - code: One of EnrollmentStatusCodeEnum possibility - code: One of EnrollmentStatusCodeEnum possibility
 - msg: A text to join with the code - msg: A text to join with the code
 +
 +## to_lua
 +```
 +to_lua(
 + x: Any
 +)
 +```
 +convert an object from python to LUA
 +- x: a python compatible object
  
 # Enums # Enums
Ligne 405: Ligne 410:
 - CG_FR_V1 - CG_FR_V1
  
-# Other 
-``` 
-services: object 
-``` 
-``` 
-output: object 
-``` 
-``` 
-MRZ_TYPES: dict[MRZDocumentType | IdentityDocument] 
-``` 
 # Lua modules allowed # Lua modules allowed
-pcall+_G 
 +- _VERSION 
 +- assert 
 +- bit 
 +- collectgarbage
 - coroutine - coroutine
-assert +debug 
-tostring +error 
-tonumber +math
-- print+
 - module - module
-bit+next 
 +- os 
 +  - date 
 +  - difftime 
 +  - time
 - package - package
-error +pairs 
-debug+pcall 
 +- print
 - rawequal - rawequal
-unpack +string
-- pairs+
 - table - table
-next +tonumber 
-math +tostring
-- _G +
-- _VERSION +
-- string+
 - type - type
 +- unpack
 - utf8 - utf8
-- collectgarbage 
-- os 
-  - date 
-  - time 
-  - difftime 
  
-Extracted Data Classes +Définition des classes utilisés pour les données pivots
-## PROOF_OF_AGE +
-``` +
-PROOF_OF_AGE( +
- services: dict[str | dict] | null,  +
- is_of_age: bool | null,  +
- minimum_age: int | null +
-+
-```+
 ## BANK_DETAILS ## BANK_DETAILS
 ``` ```
Ligne 531: Ligne 518:
 ) )
 ``` ```
-## HEALTH_INSURANCE_CARD+## DIGITAL_IDENTITY
 ``` ```
-HEALTH_INSURANCE_CARD( +DIGITAL_IDENTITY(
- services: dict[str | dict] | null,  +
- full_name: str | null,  +
- amc: str | null,  +
- csr: str | null,  +
- adherent_number: str | null,  +
- convention: str | null,  +
- starting_date: date | null,  +
- ending_date: date | null +
-+
-``` +
-## IDENTITY_DOCUMENT +
-``` +
-IDENTITY_DOCUMENT(+
  services: dict[str | dict] | null,   services: dict[str | dict] | null, 
  type: str | null,   type: str | null, 
Ligne 575: Ligne 549:
 ) )
 ``` ```
-### IDENTITY_DOCUMENT_EXTRA+### DIGITAL_IDENTITY_EXTRA
 ``` ```
-IDENTITY_DOCUMENT_EXTRA(+DIGITAL_IDENTITY_EXTRA(
  id_number: str | null,   id_number: str | null, 
  issuing_date: datetime | null,   issuing_date: datetime | null, 
Ligne 592: Ligne 566:
 ) )
 ``` ```
-## DIGITAL_IDENTITY+## HEALTH_INSURANCE_CARD
 ``` ```
-DIGITAL_IDENTITY(+HEALTH_INSURANCE_CARD( 
 + services: dict[str | dict] | null,  
 + full_name: str | null,  
 + amc: str | null,  
 + csr: str | null,  
 + adherent_number: str | null,  
 + convention: str | null,  
 + starting_date: date | null,  
 + ending_date: date | null 
 +
 +``` 
 +## IDENTITY 
 +``` 
 +IDENTITY(
  services: dict[str | dict] | null,   services: dict[str | dict] | null, 
  type: str | null,   type: str | null, 
Ligne 623: Ligne 610:
 ) )
 ``` ```
-### DIGITAL_IDENTITY_EXTRA+### IDENTITY_EXTRA
 ``` ```
-DIGITAL_IDENTITY_EXTRA(+IDENTITY_EXTRA(
  id_number: str | null,   id_number: str | null, 
  issuing_date: datetime | null,   issuing_date: datetime | null, 
Ligne 640: Ligne 627:
 ) )
 ``` ```
-## IDENTITY+## IDENTITY_DOCUMENT
 ``` ```
-IDENTITY(+IDENTITY_DOCUMENT(
  services: dict[str | dict] | null,   services: dict[str | dict] | null, 
  type: str | null,   type: str | null, 
Ligne 671: Ligne 658:
 ) )
 ``` ```
-### IDENTITY_EXTRA+### IDENTITY_DOCUMENT_EXTRA
 ``` ```
-IDENTITY_EXTRA(+IDENTITY_DOCUMENT_EXTRA(
  id_number: str | null,   id_number: str | null, 
  issuing_date: datetime | null,   issuing_date: datetime | null, 
Ligne 755: Ligne 742:
  dmx_city: str | null,   dmx_city: str | null, 
  dmx_date: null  dmx_date: null
 +)
 +```
 +## PROOF_OF_AGE
 +```
 +PROOF_OF_AGE(
 + services: dict[str | dict] | null, 
 + is_of_age: bool | null, 
 + minimum_age: int | null
 ) )
 ``` ```
Ligne 788: Ligne 783:
 ) )
 ``` ```
-Classes+Définition des objets utilisés dans les scripts
 ## DocumentWrapper ## DocumentWrapper
-- document: Document +- document 
-- name: str +- name 
-- iteration: int | None +- iteration 
-- mode: DocumentWrapperModeEnum +- mode 
-- engine: EngineTypes +- engine 
-- type: list[DocumentTypeEnum] +- type 
-- content: dict | null +- content 
-- input_documents: list[Document] +- input_documents 
-- is_internal: bool +- is_internal 
-- step_step_documents: list[StepStepDocument] +- step_step_documents 
-- ignore_validation: bool +- ignore_validation 
-- tags: list[object] +- tags 
-- is_valid: bool | null +- is_valid 
-- document_provider: str | null +- document_provider 
-- enrollment_steps: list[EnrollmentStep]+- enrollment_steps
  
  
 ## EnrollmentStatusCode ## EnrollmentStatusCode
-## IdentityExtractedDataExtra +id 
-- id_number: str | null +code 
-- issuing_date: datetime | null +message 
-- expiration_date: datetime | null +step 
-- issuing_country: str | null +external_method_step 
-issuer: str | null +enrollment 
-address: str | null +validation 
-dmx_id_number: str | null +document
-dmx_signature_status: str | null +
-mrz_line_1: str | null +
-mrz_line_2: str | null +
-mrz_line_3: str | null +
-nfc_compatible: bool | null+
  
 +- pk: _empty
 +
 +## ErrorCodeException
 +
 +- status_code: EnrollmentStatusCode
  
-## PersonalDetails 
 ## IdentityDocument ## IdentityDocument
-- definition: list[dict[str | IdentityDocumentPart]] +- definition 
-- type: MRZDocumentType +- type 
-- name: str +- name 
-- line_size: int +- line_size 
-- nb_line: int+- nb_line
  
  
-## ErrorCodeException+## IdentityExtractedDataExtra 
 +- id_number 
 +- issuing_date 
 +- expiration_date 
 +- issuing_country 
 +- issuer 
 +- address 
 +- dmx_id_number 
 +- dmx_signature_status 
 +- mrz_line_1 
 +- mrz_line_2 
 +- mrz_line_3 
 +- nfc_compatible
  
-status_codeEnrollmentStatusCode+ 
 +## PersonalDetails 
 +id 
 +- name 
 +- birth_name 
 +- first_name 
 +- first_names 
 +- email 
 +- address 
 +- zip_code 
 +- city 
 +- country 
 +- phone_number 
 +- birth_date 
 +- gender 
 +- birth_place 
 +- birth_country 
 +- nationality 
 +- identity_valid 
 +- enrollment 
 + 
 +- pk_empty
  
 # Exemple # Exemple
Ligne 927: Ligne 954:
 ``` ```
  
 +</markdown>

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

Plus d’informations