Purpose This page describes validation rules for person data (both regular person and person than have confidant person) as part of sign-up processes through person information system (PIS).
Regular person Key points for regular person dataset:
Schema does not allow to submit “confidant_person” block
There is a need to check if persons age is greater then no_self_registration_age chart parameter
Person authentication methods must contain only records with type = 'OTP'
This validation rules set is currently used by following WS:
Validations Validate schema Validate person data according to JSON Schema:
Regular person registration request schema
{
"$schema": "http://json-schema.org/person_request/schema#",
"definitions": {
"phone": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Dictionary: PHONE_TYPE"
},
"number": {
"type": "string",
"pattern": "^\\+38[0-9]{10}$"
}
},
"required": [
"type",
"number"
],
"additionalProperties": false
},
"name": {
"type": "string",
"pattern": "^(?!.*[ЫЪЭЁыъэё@%&$^#])[a-zA-ZА-ЯҐЇІЄа-яґїіє0-9№\\\"!\\^\\*)\\]\\[(._-].*$"
},
"person_name": {
"type": "string",
"pattern": "^(?!.*[ЫЪЭЁыъэё@%&$^#])[А-ЯҐЇІЄа-яґїіє\\'\\-]+(\\s(?!.*[ЫЪЭЁыъэё@%&$^#])[А-ЯҐЇІЄа-яґїіє\\'\\-]+)*$",
"minLength": 1,
"maxLength": 255
},
"unzr": {
"type": "string",
"pattern": "^[0-9]{8}-[0-9]{5}$"
},
"tax_id": {
"type": "string",
"pattern": "^[0-9]{10}$",
"minLength": 10,
"maxLength": 255
},
"no_tax_id": {
"type": "boolean",
"description": "Status person refused tax_id"
},
"gender": {
"type": "string",
"description": "Dictionary: GENDER",
"maxLength": 255
},
"address": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Dictionary: ADDRESS_TYPE"
},
"country": {
"type": "string"
},
"area": {
"$ref": "#/definitions/name"
},
"region": {
"$ref": "#/definitions/name"
},
"settlement": {
"$ref": "#/definitions/name"
},
"settlement_type": {
"type": "string",
"description": "settlement type Dictionary: SETTLEMENT_TYPE"
},
"settlement_id": {
"type": "string",
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
},
"street_type": {
"type": "string",
"description": "street type Dictionary: STREET_TYPE"
},
"street": {
"$ref": "#/definitions/name"
},
"building": {
"type": "string",
"pattern": "^[1-9]((?![ЫЪЭЁыъэё])()([А-ЯҐЇІЄа-яґїіє \\/\\'\\-0-9])){0,20}$"
},
"apartment": {
"type": "string"
},
"zip": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"inserted_by": {
"type": "string"
},
"updated_by": {
"type": "string"
},
"inserted_at": {
"type": "string"
},
"updated_at": {
"type": "string"
}
},
"required": [
"type",
"country",
"area",
"settlement",
"settlement_type",
"settlement_id",
"inserted_by",
"updated_by"
],
"additionalProperties": false
},
"series_number_document": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"PASSPORT",
"COMPLEMENTARY_PROTECTION_CERTIFICATE",
"REFUGEE_CERTIFICATE",
"TEMPORARY_CERTIFICATE"
],
"description": "Dictionary: DOCUMENT_TYPE"
},
"number": {
"type": "string",
"pattern": "^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$"
},
"issued_by": {
"type": "string",
"minLength": 1
},
"issued_at": {
"type": "string",
"format": "date"
}
},
"required": [
"type",
"number"
],
"additionalProperties": false
},
"number_document": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"BIRTH_CERTIFICATE",
"TEMPORARY_PASSPORT"
],
"description": "Dictionary: DOCUMENT_TYPE"
},
"number": {
"type": "string",
"pattern": "^(?![ЫЪЭЁыъэё@%&$^#`~:,.*|}{?!])[A-ZА-ЯҐЇІЄ0-9№\\/()-]+$",
"minLength": 1,
"maxLength": 255
},
"issued_by": {
"type": "string",
"minLength": 1
},
"issued_at": {
"type": "string",
"format": "date"
}
},
"required": [
"type",
"number"
],
"additionalProperties": false
},
"id_card": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"NATIONAL_ID"
],
"description": "Dictionary: DOCUMENT_TYPE"
},
"number": {
"type": "string",
"pattern": "^[0-9]{9}$"
},
"issued_by": {
"type": "string",
"minLength": 1
},
"issued_at": {
"type": "string",
"format": "date"
}
},
"required": [
"type",
"number"
],
"additionalProperties": false
},
"authentication_method": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"OTP"
],
"description": "Dictionary: AUTHENTICATION_METHOD"
},
"phone_number": {
"type": "string",
"pattern": "^\\+38[0-9]{10}$"
},
"alias": {
"type": "string",
"minLength": 1,
"maxLength": 255
}
},
"required": [
"type"
],
"additionalProperties": false
}
},
"type": "object",
"properties": {
"person": {
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
},
"second_name": {
"type": "string"
},
"birth_date": {
"type": "string"
},
"birth_country": {
"type": "string"
},
"birth_settlement": {
"type": "string"
},
"gender": {
"enum": [
"MALE",
"FEMALE"
]
},
"email": {
"type": "string"
},
"no_tax_id": {
"type": "boolean"
},
"tax_id": {
"type": "string"
},
"secret": {
"type": "string"
},
"documents": {
"type": "array"
},
"addresses": {
"type": "array"
},
"phones": {
"type": "array"
},
"unzr": {
"type": "string"
},
"emergency_contact": {
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
},
"second_name": {
"type": "string"
},
"phones": {
"type": "array"
}
},
"required": [
"first_name",
"last_name",
"phones"
]
},
"preferred_way_communication": {
"enum": [
"email",
"phone"
]
},
"authentication_methods": {
"type": "array"
}
},
"required": [
"first_name",
"last_name",
"birth_date",
"birth_country",
"birth_settlement",
"gender",
"no_tax_id",
"tax_id",
"secret",
"documents",
"addresses",
"emergency_contact",
"authentication_methods"
]
},
"patient_signed": {
"type": "boolean"
},
"process_disclosure_data_consent": {
"type": "boolean"
}
},
"required": [
"person",
"patient_signed",
"process_disclosure_data_consent"
]
}
in case field value does not match the schema - return 422 with field-specific message
in case additional fields exist in request - return 422 ('schema does not allow additional properties')
in case required parameter does not exist in request - return 422 ('required property %{property} was not present')
in case required amount of parameters does not exist in request - return 422 ('expected a minimum of %{min} items but got %{actual}')
Validate person Validate person documents Check submitted person document types exist in PIS_PERSON_REGISTRATION_DOCUMENT_TYPES config parameter that contains values from DOCUMENT_TYPE dictionary
Check documents that prove persons legal capacity
In case if persons age is greater then no_self_registration_age global parameter, but less then person_full_legal_capacity_age global parameter:
Check if at least one of submitted person document types exist in PIS_PERSON_REGISTRATION_DOCUMENT_TYPES config parameter that contains values from DOCUMENT_TYPE_EXTENDED dictionary
Check if at least one of submitted person document types exist in PIS_PERSON_LEGAL_CAPACITY_DOCUMENT_TYPES config parameter that contains values from DOCUMENT_TYPE_EXTENDED dictionary
Else check that any of submitted person document types exist in PIS_PERSON_REGISTRATION_DOCUMENT_TYPES config parameter
Validate person documents according to exiting validations, described here: Create/Update person request | Validate person documents
Validate person addresses Validate person authentication methods Person with confidant There are few differences between validation of reqular person and validation of person with confidant:
Schema allowes to submit “confidant_person” block
User can set only one confidant person and only one authentication method
There is no need to check if persons age is greater then no_self_registration_age chart parameter
To validate submitted document types another config parameter is used (PIS_PERSON_WITH_CONFIDANT _REGISTRATION_DOCUMENT_TYPES)
Person authentication methods must contain only records with type = 'THIRD_PERSON'
Confidant person must be validated
This validation rules set is currently used by following WS:
Validations Validate schema Validate person data according to JSON Schema:
Person with confidant registration request schema
{
"$schema": "http://json-schema.org/person_request/schema#",
"definitions": {
"phone": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Dictionary: PHONE_TYPE"
},
"number": {
"type": "string",
"pattern": "^\\+38[0-9]{10}$"
}
},
"required": [
"type",
"number"
],
"additionalProperties": false
},
"name": {
"type": "string",
"pattern": "^(?!.*[ЫЪЭЁыъэё@%&$^#])[a-zA-ZА-ЯҐЇІЄа-яґїіє0-9№\\\"!\\^\\*)\\]\\[(._-].*$"
},
"person_name": {
"type": "string",
"pattern": "^(?!.*[ЫЪЭЁыъэё@%&$^#])[А-ЯҐЇІЄа-яґїіє\\'\\-]+(\\s(?!.*[ЫЪЭЁыъэё@%&$^#])[А-ЯҐЇІЄа-яґїіє\\'\\-]+)*$",
"minLength": 1,
"maxLength": 255
},
"unzr": {
"type": "string",
"pattern": "^[0-9]{8}-[0-9]{5}$"
},
"tax_id": {
"type": "string",
"pattern": "^[0-9]{10}$",
"minLength": 10,
"maxLength": 255
},
"no_tax_id": {
"type": "boolean",
"description": "Status person refused tax_id"
},
"gender": {
"type": "string",
"description": "Dictionary: GENDER",
"maxLength": 255
},
"address": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Dictionary: ADDRESS_TYPE"
},
"country": {
"type": "string"
},
"area": {
"$ref": "#/definitions/name"
},
"region": {
"$ref": "#/definitions/name"
},
"settlement": {
"$ref": "#/definitions/name"
},
"settlement_type": {
"type": "string",
"description": "settlement type Dictionary: SETTLEMENT_TYPE"
},
"settlement_id": {
"type": "string",
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
},
"street_type": {
"type": "string",
"description": "street type Dictionary: STREET_TYPE"
},
"street": {
"$ref": "#/definitions/name"
},
"building": {
"type": "string",
"pattern": "^[1-9]((?![ЫЪЭЁыъэё])()([А-ЯҐЇІЄа-яґїіє \\/\\'\\-0-9])){0,20}$"
},
"apartment": {
"type": "string"
},
"zip": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"inserted_by": {
"type": "string"
},
"updated_by": {
"type": "string"
},
"inserted_at": {
"type": "string"
},
"updated_at": {
"type": "string"
}
},
"required": [
"type",
"country",
"area",
"settlement",
"settlement_type",
"settlement_id",
"inserted_by",
"updated_by"
],
"additionalProperties": false
},
"series_number_document": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"PASSPORT",
"COMPLEMENTARY_PROTECTION_CERTIFICATE",
"REFUGEE_CERTIFICATE",
"TEMPORARY_CERTIFICATE"
],
"description": "Dictionary: DOCUMENT_TYPE"
},
"number": {
"type": "string",
"pattern": "^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$"
},
"issued_by": {
"type": "string",
"minLength": 1
},
"issued_at": {
"type": "string",
"format": "date"
}
},
"required": [
"type",
"number"
],
"additionalProperties": false
},
"number_document": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"BIRTH_CERTIFICATE",
"TEMPORARY_PASSPORT"
],
"description": "Dictionary: DOCUMENT_TYPE"
},
"number": {
"type": "string",
"pattern": "^(?![ЫЪЭЁыъэё@%&$^#`~:,.*|}{?!])[A-ZА-ЯҐЇІЄ0-9№\\/()-]+$",
"minLength": 1,
"maxLength": 255
},
"issued_by": {
"type": "string",
"minLength": 1
},
"issued_at": {
"type": "string",
"format": "date"
}
},
"required": [
"type",
"number"
],
"additionalProperties": false
},
"id_card": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"NATIONAL_ID"
],
"description": "Dictionary: DOCUMENT_TYPE"
},
"number": {
"type": "string",
"pattern": "^[0-9]{9}$"
},
"issued_by": {
"type": "string",
"minLength": 1
},
"issued_at": {
"type": "string",
"format": "date"
}
},
"required": [
"type",
"number"
],
"additionalProperties": false
}
},
"type": "object",
"properties": {
"person": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
},
"second_name": {
"type": "string"
},
"birth_date": {
"type": "string"
},
"birth_country": {
"type": "string"
},
"birth_settlement": {
"type": "string"
},
"gender": {
"enum": [
"MALE",
"FEMALE"
]
},
"email": {
"type": "string"
},
"no_tax_id": {
"type": "boolean"
},
"tax_id": {
"type": "string"
},
"secret": {
"type": "string"
},
"documents": {
"type": "array"
},
"addresses": {
"type": "array"
},
"phones": {
"type": "array"
},
"unzr": {
"type": "string"
},
"emergency_contact": {
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
},
"second_name": {
"type": "string"
},
"phones": {
"type": "array"
}
},
"required": [
"first_name",
"last_name",
"phones"
]
},
"confidant_person": {
"type": "object",
"properties": {
"person_id": {
"type": "string"
},
"documents_relationship": {
"type": "array",
"properties": {
"type": {
"type": "string",
"description": "Dictionary: DOCUMENT_RELATIONSHIP_TYPE"
},
"number": {
"type": "string",
"pattern": "^[0-9]{9}$"
},
"issued_by": {
"type": "string",
"minLength": 1
},
"issued_at": {
"type": "string",
"format": "date"
},
"active_to": {
"type": "string",
"format": "date"
}
},
"required": [
"type",
"number"
],
"additionalProperties": false
}
}
},
"required": [
"person_id",
"documents_relationship"
]
},
"preferred_way_communication": {
"enum": [
"email",
"phone"
]
}
},
"required": [
"first_name",
"last_name",
"birth_date",
"birth_country",
"birth_settlement",
"gender",
"no_tax_id",
"tax_id",
"secret",
"documents",
"addresses",
"emergency_contact"
]
},
"patient_signed": {
"type": "boolean"
},
"process_disclosure_data_consent": {
"type": "boolean"
}
},
"required": [
"person",
"patient_signed",
"process_disclosure_data_consent"
]
}
in case field value does not match the schema - return 422 with field-specific message
in case additional fields exist in request - return 422 ('schema does not allow additional properties')
in case required parameter does not exist in request - return 422 ('required property %{property} was not present')
in case required amount of parameters does not exist in request - return 422 ('expected a minimum of %{min} items but got %{actual}')
Validate person Validate person documents Check submitted person document types exist in PIS_PERSON_WITH_CONFIDANT_REGISTRATION_DOCUMENT_TYPES config parameter that contains values from DOCUMENT_TYPE dictionary
Validate person documents according to exiting validations, described here: Create/Update person request | Validate person documents
Validate person addresses Validate сonfidant person Check if confidant_person.person_id is equal to person_id of user who initiates patient registration
Check if confidant_person.person_id exists in persons table (MPI DB)
Check if confidant person age >= no_self_registration_age chart parameter
Check if confidant person cumulative verification status is not in NOT_ALLOWED_CONFIDANT_PERSON_VERIFICATION_STATUSES
config parameter
Check if confidant person has authentication method with type = OTP
where ended_at is equal to or greater than today`s date
Validate person authentication methods Check that submitted authentication_methods contains only one record and this record has type = 'THIRD_PERSON'
Check if THIRD_PERSON is the same person who initiates patient registration and submitted as confidant (authentication_methods.value = x-person-id
from token)
in case of error - return 422 ('person.authentication_methods.value must be equal to person.confidant_person.person_id')