Configuration of the Oz API
Oz API can be configured with a configuration file saved on Oz API server at this location: /opt/gateway/configs/config.py
Important! After introducing changes to configuration file use this command to restart the Oz API service:
Bash
sudo systemctl restart gateway.target
Settings of the Oz API Configuration File.
Basic settings:
PORT - Port for file resources generated by the app. A numeric parameter, default value = 80;
DEBUG - This parameter indicates whether the system is running in debugging mode. Possible values = True/False;
SCHEME – Scheme for file resources generated by the app. Possible values = http\https;
ALLOWED_HOSTS – URL that can be used to address the system; a text parameter, multiple values are supported;
HOST - Name of the web server host to be used for file resources generated by the app. Can be specified as follows: ALLOWED_HOSTS[0] where the number within square brackets provides a host name from the array specified by parameter ALLOWED_HOSTS (zero-based count).
DB_USER – User name to connect to the system database; a text parameter;
DB_HOST - System database server address; a text parameter;
DB_PASS - Password to connect to the system database; a text parameter;
DB_NAME - System database name; a text parameter;
DB_ENGINE - System database type; a text parameter;
DB_CONNECT_OPTS - Special database connection parameters; a text parameter; default value = None.
Timeout settings:
OZ_EXTERNAL_REQUEST_TIMEOUT – Timeout of execution an HTTP request to an external system; a numeric parameter specified as a number of seconds;
OZ_CELERY_RETRY_MAX_COUNT – Maximum number of repeated requests in case of request processing errors; a numeric parameter;
OZ_CELERY_RETRY_STEP – Time between repeated requests in case of request processing errors; a numeric parameter specified as a number of seconds;
OZ_ANALYSE_PROCESSING_EXPIRE_TIMEOUT – Analysis completion timeout; a numeric parameter specified as a number of seconds;
OZ_ANALYSE_DELIVERY_EXPIRE_TIMEOUT – Timeout for uploading requests to engines; a numeric parameter specified as a number of seconds;
OZ_ANALYSE_EXPIRE_BEAT_PERIOD – Analysis completion scanning frequency; a numeric parameter specified as a number of seconds.
Module settings:
OZ_FFMPEG_BINARY – Server folder where the video storyboard tool FFMpeg is stored; a text parameter;
OZ_COLLECTION_FOLDER_NAME – Name of the folder where collections are stored; a text parameter;
OZ_REPORTS_FOLDER_NAME – Name of the folder where reports are stored; a text parameter;
OZ_SERVICE_REGULA_HOST - OZ Text server address; a text parameter;
OZ_SERVICE_REGULA_USERID - User name to connect to the OZ Text module; a text parameter;
OZ_SERVICE_REGULA_PASSWORD - Password to connect to the OZ Text module; a text parameter;
OZ_SERVICE_PHOTOEXPERT_HOST - OZ Photoexpert server address; a text parameter;
OZ_SERVICE_PHOTOEXPERT_USER - User name to connect to the OZ Photoexpert module; a text parameter;
OZ_SERVICE_PHOTOEXPERT_PASSWORD - Password to connect to the OZ Photoexpert module; a text parameter;
OZ_SERVICE_COLLECTION_API_NODE – OZ Collection verification server address; a text parameter;
OZ_SERVICE_TFSS_ANALYSE_VALID_ACTION_MAP – a block for mapping action types in the system with analyses that are performed. Example of settings: 'biometry': ['far', 'close'] – only videos with tags video_selfie_zoom_in and video_selfie_zoom_out will be sent to analysis, videos with other tags will be ignored. Abridged names are used to identify tags in this parameter; their mapping array is provided in the configuration file parameter OZ_MEDIA_TAGS_MAPPING. Current tag list;
OZ_SERVICE_TFSS_HOST – Address of system TFSS server, a text parameter.
Threshold settings:
OZ_SERVICE_THRESHOLD_BIOMETRY_MIN – lower limit for the Biometry verification;
OZ_SERVICE_THRESHOLD_BIOMETRY_MAX – upper limit for the Biometry verification;
OZ_SERVICE_THRESHOLD_BLACKLIST_MIN – lower limit for the Collection verification;
OZ_SERVICE_THRESHOLD_BLACKLIST_MAX – upper limit for the Collection verification;
OZ_SERVICE_THRESHOLD_LIVENESS - Quality verification limit, not in use currently;
OZ_SERVICE_THRESHOLD_REPLAY - Quality verification limit, not in use currently;
OZ_SERVICE_THRESHOLD_SPOOFING - Quality verification limit.
Settings of file size and number in request:
OZ_IMAGE_SIZE_THUMBNAIL - Max thumbnail file size in bytes;
OZ_ATTACHMENT_MAX_COUNT - Max number of files in a single request;
OZ_ATTACHMENT_MAX_SIZE – Max file size in bytes.
Settings of media files processing:
OZ_VIDEO_DURATION_MAX – Max video duration in the system;
OZ_SERVICE_TFSS_SLICING – FFMPEG storyboard parameters for models used with videos:
- sentinel\podium\inquisitor – target model name;
- mode – method of frame extracting:
- rate – frames per second;
- count – precise number of frames;
- value – numeric value of number of frames/frames per second;
OZ_SERVICE_TFSS_INQUISITOR_THR – internal limit for Inquisitor model;
OZ_SERVICE_SLIDER_DEFAULT_MODELS – name of the face extracting model by default;
OZ_MEDIA_TAGS_MAPPING – block of face extracting model mapping depending on media file tag and list of tags used by the system with their abridged names. Current tag list;
OZ_VALID_MIMETYPES_IMAGE – for mapping photo file mime-types that are valid within the system;
OZ_VALID_MIMETYPES_VIDEO – block for mapping video file mime-types that are valid within the system;
OZ_VALID_MIMETYPES_VIDEO_PREVIEW – block for mapping video preview file mime-types that are valid in the system;
OZ_VIDEO_PREVIEW_CONVERT_TARGET_FORMAT – target format for video conversion;
OZ_VIDEO_PREVIEW_CONVERT_TIMEOUT – video conversion timeout.
Settings of session duration:
OZ_SESSION_TTL – standard duration of sessions for non-servicing user accounts;
OZ_SESSION_LONGLIVE_TTL - duration of sessions for servicing user accounts.
Settings of password recovery:
OZ_EMAIL_RESTORE_CODE_TIMEOUT – expiration time of a password recovery pin code;
OZ_EMAIL_RESTORE_TEMPLATE_NAME – file name of a template password recovery email;
OZ_EMAIL_RESTORE_SUBJECT – subject of the password recovery email.
Settings of SQL requests logging:
LAMB_VERBOSE_SQL_LOG – activation of raw SQL requests logging. Possible values = true/false;
LAMB_VERBOSE_SQL_LOG_THRESHOLD - database request duration limit, a numeric parameter specified as a number of seconds.
Customized settings of document types in OZ Text module
Following configuration file parameters define the settings of document types in OZ Text module:
- OZ_SERVICE_REGULA_DEFAULT_CAPABILITIES, parameter value for normal system use cases = 508, parameter value for using the system with OZ Mobile SDK for IOS-Android (provide a link to section “OZ Mobile SDK for IOS-Android” here; the section is still under development) = 492
- OZ_SERVICE_REGULA_DEFAULT_AUTHENTICITY, parameter value = 0 in all cases; not in use currently
- OZ_SERVICE_REGULA_DOCTYPE_GROUP_CHECKS this block of parameters provides an explicit request of a certain type of 2nd side for 2-sided documents and verifies the availability of required fields.
Example of settings for both sides of a document in «OZ_SERVICE_REGULA_DOCTYPE_GROUP_CHECKS»:
JSON
\\ comment, name of the document type in Oz Text. It’s recommended to provide this information to facilitate reading.
# KAZ: {'Id Card #1', 'Id Card #1 Side B'},
\\ internal IDs for both sides of the 2-sided document in Oz Text
frozenset({825787810, 1308487493}):
\\ List of fields required for a successful document verification
{ 'Personal_Number', 'Nationality', 'Nationality_Code', 'Date_of_Expiry', 'Sex', 'Document_Number', 'MRZ_Strings_With_Correct_CheckSums', 'Surname', 'Given_Names', 'Date_of_Birth', # 'Authority', 'Date_of_Issue' }
With these settings, if any side of a document from the specified pair is fed to Oz Text, the system requests a mandatory submission of the other side. If document type cannot be identified (e. g. because of a poor scan/picture quality) or no one of the listed fields is present, the verification ends with a failed status.