/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)
Properties of a REST API method document
...
Document type
...
Метод REST API
...
Document title
...
[Document status] REST API [Назва методу] [ID методу]
...
Guideline ID
...
GUI-0011
...
Author
...
@
...
Document version
...
1
...
Document status
...
DRAFT
...
Date of creation
...
ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD)
...
Date of update
...
ХХ.ХХ.ХХХХ (дата зміни версії)
...
Method API ID
...
API-007-011-001-0472
...
Microservices (namespace)
...
MPI
...
Component
...
Auth
...
Component ID
...
COM-007-011
...
Link на API-специфікацію
...
...
Resource
...
{{host}}//api.ehealth.gov.ua/api/patients/id/encounter_package
...
Scope
...
/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)
Properties of a REST API method document
Document type | Метод REST API |
---|---|
Document title | [DRAFT] [NEW] Submit Composition [API-007-011-001-0472] |
Guideline ID | GUI-0011 |
Author | @ |
Document version | 1 |
Document status | DRAFT |
Date of creation | ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD) |
Date of update | ХХ.ХХ.ХХХХ (дата зміни версії) |
Method API ID | API-007-011-001-0472 |
Microservices (namespace) | ME |
Component | Compositions_ME |
Component ID | COM-007-011 |
Link на API-специфікацію | |
Resource | {{host}}//api.ehealth.gov.ua/api/patients/id/encounter_package |
Scope | |
Protocol type | REST |
Request type | |
Sync/Async | |
Public/Private |
...
Save signed content to media storage, in the bucket pointed in MEDIA_STORAGE_COMPOSITION_BUCKET chart parameter
Set subject with hashed mpi identifier from URL
Get encounter where id = Composition.encounter.identifier.value
Set Composition.context_episode_id = encounter.episode
Save data to compositions collection in DB according to /wiki/spaces/emal/pages/18210586637
Save link from media storage to the $.signed_content_links field in compositions collection
Create job and return it’s id.
If $.authorize_with is submitted send SMS to patient with composition number via template
CREATE_{{COMPOSITION_TYPE}}_COMPOSITION_SMS_TEMPLATE
. Use $.authorize_with as patient’s authentication method
Configuration parameters
Description of the configuration parameters that are used when processing a request in the system
Dictionaries
Provides a list of links to dictionaries that are available in Confluence
Input parameters
Description of input N/A
Dictionaries
N/A
Input parameters
Input parameter | Mandatory | Type | Description | Example | |
---|---|---|---|---|---|
1 | composition_id | M | String ($uuid) (path) | Composition object ID | 89678f60-4cdc-4fe3-ae83-e8b3ebd35c59 |
2 |
|
|
|
|
|
Request structure
See on API-specification (посилання на сторінку з API-специфікацією)
Description of the REST API request structure, example
...
title | Example |
---|
...
Headers
...
Key
...
Value
...
Mandatory
...
Description
...
Example
...
Content-Type
...
application/json
...
M
...
Тип контенту
...
Content-Type:application/json
...
Authorization
...
Bearer c2778f3064753ea70de870a53795f5c9
...
M
...
Перевірка користувача
...
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
...
...
...
...
...
...
2 |
|
|
|
|
|
Request structure
See on API-specification
Expand | ||
---|---|---|
| ||
|
Headers
Request data validation
Authorization
Verify the validity of access token
in case of error - return 401 (“Invalid access token”) in case of validation fails
Verify that token is not expired
in case of error - return 401 (“Invalid access token”)
Check user and client scopes in order to perform this action (scope = 'composition:write')
return 403 (“Your scope does not allow to access this resource. Missing allowances: composition:write”) in case of invalid scope(s)
If BLOCK_UNVERIFIED_PARTY_USERS is true, then check party's data match following condition: verification_status != NOT_VERIFIED or (verification_status = NOT_VERIFIED and updated_at > current_date - UNVERIFIED_PARTY_PERIOD_DAYS_ALLOWED):
in case not match - return 403 ("Access denied. Party is not verified")
If BLOCK_DECEASED_PARTY_USERS is true, check that party is not deceased (party_verification record does not equal to: dracs_death_verification_status = VERIFIED and dracs_death_verification_reason = MANUAL_CONFIRMED):
in case of error - return 403 ("Access denied. Party is deceased")
Validate Digital Sign
Validate request is signed
in case of error - return 400 (“Invalid signed content”)
Check DS is valid and not expired
Validate that DS belongs to the employee who sign the Composition ($.attester)
Check that DRFO from DS and party.tax_id of the registrar matches
in case of error - return 422 (“Does not match the signer drfo“)
Validate Patient
Get Patient identifier from the URL
Check it exists in the Mongo DB
Return 404 ('Person is not found') in case of error
Validate request
Validate encoded and decoded request using JSON schema.
Return 422 with the list of validation errors in case validation fails
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 composition data using different configs depends on type and category of composition. Return 422 with the list of validation errors in case validation fails.
List of validations for composition depends on type and category. For unique combination of type and category of composition exist only one active config file, if config setting is not exist in file - system must skip validation. Structure of table in DB describe here - /wiki/spaces/emal/pages/18118934643
Find /wiki/spaces/emal/pages/18118967693 where composition.type = сonfigurations.type and composition.category = сonfigurations.category and execute validation from config for current composition. Configs for validations stored inprm
DB (like forbidden groups). Get file fromprm
then use it in validation composition process.
...
a. get config by type and category (of composition) from [prm
].composition
а.1 in case there is no record in PRM.configurations with requested combination of type and category return 422 - (“Category {{Composition.category}} is not allowed for type {{Composition.type}}”)
b. get setting and compare config.condition data to composition data to find the desired setting (in case when some values isn’t exist - skip validation)
c. compare data from config.check with data from composition
...
Check (7) possibility to create composition for PREperson - COMPOSITION_PREPERSON_ALLOW.
Return 422 ("Forbidden to create composition with such category for preperson") in case of error
Validate (10) person age between min and max values in config - COMPOSITION_PERSON_AGE.
Skip this validation in case the patient is preperson with an empty age parameter
Calculating logic of person age:days: from birthday to current date (include leap years)
months: from birthday of month to current days, in result must be integer value of full month
years: from birthday to current day, in result must be integer value of full years
example:
birthday = 12.07.1991, current day = 03.10.1991. Days - 83, month - 2, years - 0
settings value: min - value: 18, units: days and max - value: 1, units: years
calculation logic:
min value 18 days less than 83 days - OK
max value 1 year more than 0 year - OKbirthday = 12.07.1991, current day = 23.05.1995. Days - 1411, month - 46, years - 3
settings value: min - value: 18, units: days and max - value: 1, units: years
calculation logic:
min value 18 days less than 1411 days - OK
max value 3 years more than 1 year - ERRORReturn 422 ("Forbidden to create composition for person of this age") in case of error
Validate (11) person gender must match the config value - COMPOSITION_PERSON_GENDER
Return 422 ("Invalid gender of person for such composition") in case of error
...
Validate (6.1) LE type which base on config - COMPOSITION_LEGAL_ENTITY_TYPE
in case of error - return 422 ("Invalid custodian legal entity type")
Validate (6.2) LE verification status which base on config - COMPOSITION_LEGAL_ENTITY_VERIFICATION_STATUS
in case of error - return 422 ("Invalid legal entity verification status")
...
Check extension from Composition.extension in case when composition event code allow to include extension.
Extension parameters description:
Parameter | Type | M/O | Description |
---|---|---|---|
code | string | M | Extension code = Validate by config - COMPOSITION_EXTENSION_ALLOW |
valueCodeableConcept | {CodeableConceptExtension} | M |
|
CodeableConceptExtension
Parameter | Type | M/O | Description |
---|---|---|---|
coding | [Coding] | M |
|
| string | M | Code of additional condition of admission |
| string | M | COMPOSITION_ADDITIONAL_CONDITION_ADMISSION |
text | string | O | Plain text representation of the concept |
extension | [Extension] | O |
|
Extension
Parameter | Type | M/O | Description |
---|---|---|---|
сode | string | M | Name of object: or letter code of additional condition of admission - COMPOSITION_ADDITIONAL_CONDITION_ADMISSION_LETTER_DESIGNATIONS |
valueDecimal | number | O | Number value of additional condition of admission. Validation of the need to fill value checked by config - COMPOSITION_ADDITIONAL_CONDITION_VALUES |
valueCodeableConcept | {CodeableConcept} | O |
|
| [Coding] | M |
|
| string | M | Letter code of additional condition of admission. Validation of correctly dependence to the code number by - COMPOSITION_ADDITIONAL_CONDITION_RELATED_LETTER_DESIGNATIONS |
| string | M | COMPOSITION_ADDITIONAL_CONDITION_ADMISSION_LETTER_DESIGNATIONS |
*next validations use configs
If
composition.extension
is not empty and there is an extension withextension.сode
= "COMPOSITION_ADDITIONAL_CONDITION_ADMISSION
" validate composition type = “DRIVERS“Return 422 (
COMPOSITION_ADDITIONAL_CONDITION_ADMISSION
extension is not allowed for {{composition_type}} composition type) in case of error
When (36) composition type = “DRIVERS“ and
composition.extension
is not empty, check that at least one ofcomposition.event.code
corresponds to appropriate config - COMPOSITION_EVENT_ADMIT_CODESReturn 422 ("Allow composition status must be Admit when extension is not empty") in case of error
If
composition.extension
is not empty, check thatextension.сode
of extension corresponds to appropriate config - COMPOSITION_EXTENSION_ALLOWReturn 422 ("Prohibited extension code") in case of error
*new validations
If (42.4)
composition.extension
is not empty
ANDextension.сode
= “COMPOSITION_ADDITIONAL_CONDITION_ADMISSION“check that value in
extension.valueCodeableConcept.coding.code
is from /wiki/spaces/emal/pages/18118967693 dictionaryReturn 422 ('value is not allowed in enum') in case of error
If (42.5)
composition.extension
is not empty
ANDextension.сode
= "COMPOSITION_ADDITIONAL_CONDITION_ADMISSION
"
ANDextension.valueCodeableConcept.extension.valueCodeableConcept.coding.code
is not emptycheck that value is from the COMPOSITION_ADDITIONAL_CONDITION_ADMISSION_LETTER_DESIGNATIONS dictionary
Return 422 ('value is not allowed in enum') in case of error
If (42.6)
composition.extension
is not empty
ANDextension.сode
= "COMPOSITION_ADDITIONAL_CONDITION_ADMISSION
"
ANDextension.valueCodeableConcept.extension
is not empty
ANDextension.valueCodeableConcept.extension.code
=COMPOSITION_ADDITIONAL_CONDITION_ADMISSION_LETTER_DESIGNATIONS
check that:extension.valueCodeableConcept.extension.valueCodeableConcept.coding.code
value is in configuration.check array, where configuration.condition.code is equal toextension.valueCodeableConcept.coding.code
, configuration - ADDITIONAL_CONDITION_RELATED_LETTER_DESIGNATIONSReturn 422 ('Invalid letter designation for the additional admission condition code') in case of error
If
composition.extension
is not empty
ANDextension.сode
= "COMPOSITION_ADDITIONAL_CONDITION_ADMISSION
"
ANDextension.value_codeable_concept.extension
is not empty
ANDextension.value_codeable_concept.extension.code
= “COMPOSITION_ADDITIONAL_CONDITION_ADMISSION_VALUE"
check that:parameter
extension.value_codeable_concept.extension.value_decimal
is presentReturn 422 ("
value_decimal
must be present for COMPOSITION_ADDITIONAL_CONDITION_ADMISSION_VALUE extension") in case of error
extension.value_codeable_concept.coding.code
is in config.condition array of COMPOSITION_ADDITIONAL_CONDITION_VALUES
AND config.check = falseReturn 422 ('
COMPOSITION_ADDITIONAL_CONDITION_ADMISSION_VALUE
extension is not allowed for additional admission condition with code {{extension.value_codeable_concept.coding.code}}') in case of error
there is only one extension in
extension.value_codeable_concept.extension
array with code =“COMPOSITION_ADDITIONAL_CONDITION_ADMISSION_VALUE"
Return 422 ("Only one
COMPOSITION_ADDITIONAL_CONDITION_ADMISSION_VALUE
extension is allowed for each additional admission condition") in case of error
If (42.7)
composition.extension
is not empty
ANDextension.сode
= "COMPOSITION_ADDITIONAL_CONDITION_ADMISSION
"
check config COMPOSITION_ADDITIONAL_CONDITION_VALUES:If
extension.valueCodeableConcept.coding.code
is inconfig.condition
array
ANDconfig.check
= true
THENCheck that
extension.value_codeable_concept.extension
is present andextension.value_codeable_concept.extension.code
= “COMPOSITION_ADDITIONAL_CONDITION_ADMISSION_VALUE"
Return 422 ('Missing required extension
COMPOSITION_ADDITIONAL_CONDITION_ADMISSION_VALUE
for additional admission condition with code {{extension.value_codeable_concept.coding.code}}') in case of error
parameter
extension.value_codeable_concept.extension.value_decimal
is present for this additional admission conditionReturn 422 ("
value_decimal
must be present for COMPOSITION_ADDITIONAL_CONDITION_ADMISSION_VALUE extension") in case of error
10. Relates to
New composition can replace previously created composition in case when employee add some new information or change patient data. In this case employee fill parameter “relates_to” - reference on previously composition. Get previously created composition identifier from Composition.relates_to and execute next validations:
...
Check employee data who sign composition. Get employee data from Composition.attester and execute next validations:
Check
composition.Attester.mode.coding.system
= "eHealth/composition_attester_modes"
&composition.attester.mode.coding.code
is a value from dictionary eHealth/composition_attester_modesCheck (18) that attester of composition work in same LE as custodian parameter:
сomposition.attester
legal_entity_id =composition.custodian
Return 422 ("Attester of composition must work in same LE as custodian") in case of error
Check (19) that attester employee is in active status
Return 422 ('Attester is not active') in case of error
Check (19.1) that
composition.attester
array has only one itemReturn 422 ("Only one attester for composition must be submitted") in case of error
Extract (21) user_id from token. Check that attester belongs to the employee user who sign composition.
Return 422 ('Attester id doesn’t belongs to employee id from token') in case of error
...
Check (20) that attester verification status based on config - COMPOSITION_ATTESTER_VERIFICATION_STATUS.
Return 422 ("Employee with such verification status can’t sign composition") in case of error
Check (17) that author of composition work in same LE with attester:
сomposition.author.legal_entity_id
=composition.attester.legal_entity_id
. Need validate when "sign_check" value = true - COMPOSITION_ATTESTER_SIGN_CHECK.Return 422 ("Author and Attester of composition must work in same LE as custodian") in case of error
Check (22) that attester type based on config - COMPOSITION_ATTESTER_TYPE.
Return 422 ("Forbidden to create composition with this attester type") in case of error
Check (23) that attester position based on config - COMPOSITION_ATTESTER_POSITION.
Return 422 ("Forbidden to create composition with this attester position") in case of error
Check (24) that attester speciality is in allowed values from config - COMPOSITION_ATTESTER_SPECIALITY.
Return 422 ("Forbidden to create composition with this attester speciality") in case of error
Check (24.1) that attester has combination of allowed specialisation and position from config - COMPOSITION_ATTESTER_SPECIALITY_POSITION
Return 422 ("Forbidden to create composition with referenced attester speciality and position") in case of error
Check (26) that attester main speciality (
employee.accreditation.speciality_officio
= true ) is in allowed values from config - COMPOSITION_ATTESTER_MAIN_SPECIALITYReturn 422 ("Forbidden to create composition with this attester main speciality") in case of error
...
When (39) composition type = “DRIVERS“ and
composition.event.code
= "DRIVERS_GROUP1_ADMIT" or "DRIVERS_GROUP2_ADMIT" -composition.event.period.start
andcomposition.event.period.end
is requiredReturn 422 ("Event period start and period end is required") in case of error
When (40) composition type = “DRIVERS“ and
composition.event.code
= "DRIVERS_GROUP1_DENY" or "DRIVERS_GROUP2_DENY" -composition.event.period.start
is required andcomposition.event.period.end
must be emptyReturn 422 ("Event period start is required and event period end must be empty") in case of error
When (40.1) composition type = “ADOPTION“ and composition.event.code = "ADOPTION_ADOPTER_INELIGIBLE" or "ADOPTION_ADOPTER_RELATIVE_INELIGIBLE" -
composition.event.period.start
is required andcomposition.event.period.end
must be emptyReturn 422 ("Event period start is required and event period end must be empty") in case of error
Check (38.1) all
event.code
must be unique. In case when composition has more than one eventReturn 422 ("Event codes must be unique") in case of error
Check (37.1) that
composition.event.code
corresponds to appropriate dictionary - COMPOSITION_EVENTSReturn 422 ('value is not allowed in enum") in case of error
*next validations use configs
When (25) composition type = “DRIVERS“ check that
event.period
(event.period.end
-event.period.start
) less than duration (depending on person age and compositionevent.code
). Base on config - COMPOSITION_EVENT_PERIOD_DURATION
Calculating logic:composition.event.period.end
-composition.event.period.start
<config.check
valueReturn 422 ("Composition event period duration must be less than <check.value> <check.units>") in case of error
Check (38) all
composition.event.code
in composition - it must corresponds to appropriate config and match with at least one combination of statuses - COMPOSITION_EVENT_CODE
examples:
if composition category = “DRIVERS_GROUP1“ check whatcomposition.event.code
must be:
"DRIVERS_GROUP1_ADMIT"
OR
"DRIVERS_GROUP1_DENY" and “DRIVERS_GROUP2_DENY“if composition category = “DRIVERS_GROUP2“ check that
composition.event.code
match with one of combination:
“DRIVERS_GROUP1_ADMIT“ and “DRIVERS_GROUP2_DENY“
OR
“DRIVERS_GROUP1_ADMIT“ and “DRIVERS_GROUP2_ADMIT“
OR
“DRIVERS_GROUP1_DENY“ and “DRIVERS_GROUP2_DENY“if composition category = “ADOPTERS“ check that
composition.event.code
match with one of combination:
”ELIGIBLE”
OR
”INELIGIBLE”Return 422 ("Invalid event code for current composition category") in case of error
Check (28.1) that
composition.event.period.start
<composition.event.period.end
Return 422 ("Period end of event must be later than event start period") in case of error
...
Check (43) count of medical records in
composition.section.entry
<= then value from config - COMPOSITION_SECTION_ENTRY_LIMIT.Return 422 ("Limit of medical records for this composition type and category must be less or equal <RECORDS_LIMIT>") in case of error
Check (41) codes for all records from
composition.section.entry
whereresource.type
= "observation" on prohibited values for composition (all records not include prohibited codes), depends on event codes which included in config - COMPOSITION_SECTION_ENTRY_PROHIBITED_CODES whereconfig.resource_type
= "observation"Return 422 ("Prohibited observation code - <code> in section.entry for current composition") in case of error
Check (41.1) codes for all records from
composition.section.entry
whereresource.type
= "condition" on prohibited values for composition (all records not include prohibited codes), depends on event codes which included in config - COMPOSITION_SECTION_ENTRY_PROHIBITED_CODES whereconfig.resource_type
= "condition"Return 422 ("Prohibited condition code - <code> in section.entry for current composition") in case of error
Check (42) codes for all records from
composition.section.entry
whereresource.type
= "observation" on required values for composition (at least one record composition entry must contain) which depends onsection.code
wich included in config - COMPOSITION_SECTION_ENTRY_REQUIRED_CODES whereconfig.resource_type
= "observation"Return 422 ("Empty required codes in section.entry for current composition") in case of error
Check (42.1) codes for all records from
composition.section.entry
whereresource.type
= "condition" on required values for composition (at least one record composition entry must contain) which depends onsection.code
wich included in config - COMPOSITION_SECTION_ENTRY_REQUIRED_CODES whereconfig.resource_type
= "condition"Return 422 ("Empty required codes in section entry for current composition") in case of error
Check (44 + 45) existing in composition required and optional sections codes which depends on
section.code
- COMPOSITION_SECTION_CONFIG
Logic description:
Find allconfig.code
where parameterconfig.mandatory
= true and compare all codes tocomposition.section.[n].code
. In case when config has nested sections but parametermandatory
= false - don't compare codes to nested sections.
Logic description:in case when object from
config
orconfig.sections.[n]
havemandatory
= true butcomposition.section.code
orcomposition.section.section.[n].code
hasn’t same value inconfig.code
orconfig.sections.[n].code
- return errorin case when
composition.section.code
has code wich hasn’tconfig.code
- return errorReturn 422 ("Invalid section content. Mandatory section
{{code}}
is missed") in case of error with empty required fields
Check (45.1) section codes for nested sections hierarchy from config which depends on config - COMPOSITION_SECTION_CONFIG
Logic description:
Check that all values fromcomposition.section.code
equal toconfig.code
fromconfig.sections
on the same nested level whereconfig.sectionAllowed
= truein case when value from
composition.section.code
hasn’t same values with nestedconfig.code
(fromconfig.sections
) orcomposition.section.code
has codes wich doesn’t exist inconfig.code
(fromconfig.sections
) - return error Return 422 ("Sections structure does not correspond to the permitted one") in case of error with empty required fields
examples
success case:
Composition -composition.section.code
= MAIN, nested section -composition.section.section.code
= PEDIATRIST
Config -config.sectionAllowed
= true,config.code
= MAIN,config.section.code
= PEDIATRIST
error case 1:
Composition -composition.section.code
= MAIN, nested section -composition.section.section.code
= NURSING
Config -config.sectionAllowed
= true,config.code
= MAIN,config.section.code
= PEDIATRIST
error case 2:
Composition -composition.section.code
= MAIN, nested section -composition.section.section.code
= PEDIATRIST
Config -config.sectionAllowed
= true,config.code
= MAIN,config.section.code
= PEDIATRIST +config.section.code
= MAINCheck (45.2) section content for all sections which depends on section code - COMPOSITION_SECTION_CONFIG
Configuration parameters description:
if
sectionAllowed
= true current section can contain nested sectionsif
isEmpty
= true current section can contain emptyReason parameter instead ofentry
arrayif
containsResources
= true current section can containentry
andorderBy
parameters
Validate section content:
Check that current section contains
at leastjust one of:nested
section
parameteremptyReason
parameterentry
parameter
in case of error an error return 422 ("Section {{section_code}} must contain
at leastone AND only one of: nestedsection
,emptyReason
orentry
")
In case section contains
entry
parameter check thatcontainsResources
= truein case
containsResources
= false return 422 ("Section {{section_code}} can not containentry
")
In case section contains emptyReason check that
isEmpty
= truein case
isEmpty
= false return 422 ("Section {{section_code}} can not contain emptyReason")
In case section contains nested
section
check thatsectionAllowed
= truein case
sectionAllowed
= false return 422 ("Section {{section_code}} can not contain nestedsection
")
In case section contains entry parameter AND emptyReason parameterin case of error an error return 422 ("Section {{section_code}} can not contain both entry and emptyReason parameters")
In case configuration parameters containsResources = true and isEmpty = true check that one of parameters is present: entry or emptyReason, and entry array is not emptyin case of error an error return 422 ("Section {{section_code}} must contain one of: entry or emptyReason parameters")
In case one of configuration parameters: containsResources or isEmpty is true:containsResources= true, isEmpty=false check that entry array is not emptyin case of error an error return 422 ("Section {{section_code}} must contain entry array with resources")
containsResources= false, isEmpty=true check that emptyReason is not emptyin case of error an error return 422 ("Section {{section_code}} must contain emptyReason")
Check (46) nesting level of sections <= the allowed limit - COMPOSITION_SECTION_NESTING_LEVEL
Return 422 ("Prohibited nested level for composition section") in case of error
Check (47) count of section <= than value from - COMPOSITION_SECTION_COUNT_LIMIT
Return 422 ("Prohibited amount of composition section") in case of error
...
Check (48) composition.section.title
Check that composition.section.title is not empty.
Also check value from COMPOSITION_SECTION_TITLE_MANUAL_FILL config (depends on
composition.section.code
)if config.value = "true" (or section with same code doesn't exist) - don’t validate
composition.section.title
else if value = "false"
get display value from COMPOSITION_SECTION_CODES dictionary where key=
composition.section.code
check
composition.section.title
= display
Return 422 ("Invalid title for composition.section") in case of error
Check (48.1) that section code (
composition.section.code
) corresponds to appropriate dictionary - COMPOSITION_SECTION_CODESReturn 422 ("Section code value is not allowed in enum") in case of error
Check (48.2) that section order by parameter (
composition.section.orderby
) corresponds to appropriate dictionary - COMPOSITION_SECTION_ORDERBYReturn 422 ("Section order by value is not allowed in enum") in case of error
Check (48.3) that empty reason (
composition.section.emptyreason
) corresponds to appropriate config - COMPOSITION_SECTION_EMPTY_REASON. In case whencomposition.section.emptyreason
is not emptyReturn 422 ("Empty reason value is not allowed in enum") in case of error
Check (49) that person from composition.section.focus = person from composition.subject (or merged person in mpi.merged_person) - depends on section code and value for need check ("check" value = true) in config - COMPOSITION_SECTION_PERSON_CHECK (in case when "check" value = false or section with same code isn't exist - don't check person)Return 422 ("Person from section.focus must be the same as composition.subject") in case of error
Check (50) that person from all records in
composition.section.entry
the sameas composition.section.focusorcomposition.subject
(or merged person inmpi.merged_person
)Return 422 ("Person from section.entry must be the same as composition.subject or composition.section.focus") in case of error
Check (54) that author position from
section.author
based on config - COMPOSITION_SECTION_AUTHOR_POSITION for selectedsection.code
Return 422 ("Section author position does not allow") in case of error
Check (55) that author speciality from
section.author
based on config - COMPOSITION_SECTION_AUTHOR_SPECIALITY for selectedsection.code
Return 422 ("Section author speciality does not allow to create such composition") in case of error
Check (55.1) that author main speciality (
employee.accreditation.speciality_officio
= true ) fromsection.author
based on based on config - COMPOSITION_SECTION_AUTHOR_MAIN_SPECIALITYReturn 422 ("Section author main speciality does not allow to create such composition") in case of error
Check (56) count of resources from
composition.section.entry
selectedsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_LIMITReturn 422 ("Max count of resources in
section.entry
- <count>") in case of error
Check (56.1) that the resource type of the resource in
composition.section.entry
is allowed by config COMPOSITION_SECTION_SECTION_ENTRY_RESOURCESfor thissection.code
andevent.code
Return 422 ("Resource type is not allowed in this section for this section code") in case of error
Referenced resources validations
...
Check (60) that referenced diagnostic report (if entry has resource with this type) from
composition.section.entry
has status based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_STATUSReturn 422 ("Invalid referenced diagnostic report status in section.entry") in case of error
Check (61) that referenced diagnostic report (if entry has resource with this type) from
composition.section.entry
has code based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_CODE where resource_type = "diagnostic report"Return 422 ("Invalid code in referenced diagnostic report at section.entry") in case of error
Check (62) that referenced diagnostic report (if entry has resource with this type) from
composition.section.entry
has category based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_CATEGORYReturn 422 ("Invalid category in referenced diagnostic report at section.entry") in case of error
Check (63) that different from sign composition date and referenced diagnostic report (if entry has resource with this type)
effective_period.end
incomposition.section.entry
between min and max (depends on section code). Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_PERIOD_END:
min >=composition.date
-diagnostic_report.effective_period.end
<= max
or
min >=composition.date
-diagnostic_report.effective_period.end
(in case when config has only one parameter)Return 422 ("Difference between sign composition date and referenced diagnostic report end date must be from <min> to <max>") in case of error
Check (63.1) that different from sign composition date and referenced diagnostic report (if entry has resource with this type)
issued
incomposition.section.entry
between min and max (depends on section code). Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_CREATED_AT:
min >=composition.date
-diagnostic_report.issued
<= max
or
min >=composition.date
-diagnostic_report.issued
(in case when config has only one parameter)Return 422 ("Difference between sign composition date and referenced diagnostic report issued date must be from <min> to <max>") in case of error
...
Check (67.1) that referenced care plan (if entry has resource with this type) from
composition.section.entry
has category based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_CATEGORYReturn 422 ("Invalid category in referenced care plan at section.entry") in case of error
Check (68) that referenced care plan (if entry has resource with this type) from
composition.section.entry
has status based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_STATUSReturn 422 ("Invalid referenced care plan status in section.entry") in case of error
Check (70) that different from sign composition date and referenced care plan (if entry has resource with this type)
period.start
incomposition.section.entry
between min and max (depends on section code). Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_PERIOD_START:
min >=composition.date
-care_plan.period.start
<= max
or
min >=composition.date
-care_plan.period.start
(in case when config has only one parameter)Return 422 ("Difference between sign composition date and referenced care plan start date must be from <min> to <max>") in case of error
...
Check (82) that referenced observation (if entry has resource with this type) from
composition.section.entry
has code (code.coding.code and code.coding.system) based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_CODE whereresource_type
= "observation"Return 422 ("Invalid code in referenced observation at section.entry") in case of error
Check (83) that referenced observation (if entry has resource with this type) from
composition.section.entry
has status based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_STATUSReturn 422 ("Invalid referenced observation status in section.entry") in case of error
Check (84) that referenced observation (if entry has resource with this type) from
composition.section.entry
has category based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_CATEGORYReturn 422 ("Invalid category in referenced observation at section.entry") in case of error
Check (85) that different from sign composition date and referenced observation (if entry has resource with this type)
issued
incomposition.section.entry
between min and max (depends on section code). Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_TERM whereresource_type
= "observation" andaction
= "issued":
min >=composition.date
-observation.issued
<= max
or
min >=composition.date
-observation.issued
(in case when config has only one parameter)Return 422 ("Difference between sign composition date and referenced observation issued date must be from <min> to <max>") in case of error
Return 422 ("Invalid referenced observation date in section.entry") in case of error
Check (86) that different from sign composition date and referenced observation (if entry has resource with this type) between min and max (depends on section code):
if observation has filledeffective_period.end
incomposition.section.entry
calculate:
min >=composition.date
-observation.effective_period.end
<= max
or
min >=composition.date
-observation.effective_period.end
(in case when config has only one parameter)
Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_PERIOD_END whereresource_type
= "observation"
if observation has filledeffective_date_time
incomposition.section.entry
calculate:
min >=composition.date
-observation.effective_date_time
<= max
or
min >=composition.date
-observation.effective_date_time
(in case when config has only one parameter)
Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_TERM whereresource_type
= "observation" andaction
= "effective"Return 422 ("Difference between sign composition date and referenced observation date must be from <min> to <max>") in case of error
...
Check (90) that referenced immunization (if entry has resource with this type) from
composition.section.entry
has explanation.reason_not_given (explanattion.reason_not_given.coding.code and explanation.reason_not_given.coding.system) based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_IMMUNIZATION_EXPLANATION_REASON_NOT_GIVENReturn 422 ("Invalid referenced immunization explanation reason not given in section.entry") in case of error
Check (91) that referenced immunization (if entry has resource with this type) from
composition.section.entry
has explanation.reason (explanattion.reason.coding.code and explanation.reason.coding.system) based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_IMMUNIZATION_EXPLANATION_REASONReturn 422 ("Invalid referenced immunization explanation reason in section.entry") in case of error
Check (92) that referenced immunization (if entry has resource with this type) from
composition.section.entry
has status based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_STATUSReturn 422 ("Invalid referenced immunization status in section.entry") in case of error
Check (93) that referenced immunization (if entry has resource with this type) from
composition.section.entry
has vaccine_code (vaccine_code.coding.code and vaccine_code.coding.system) based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_CODE whereresource_type
= "immunization"Return 422 ("Invalid vaccine code in referenced immunization at section.entry") in case of error
Check (94) that referenced immunization (if entry has resource with this type) from
composition.section.entry
has report_origin (report_origin.coding.code and report_origin.coding.system) based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_IMMUNIZATION_REPORT_ORIGINReturn 422 ("Invalid referenced immunization report origin in section.entry") in case of error
Check (95) that different from sign composition date and referenced immunization (if entry has resource with this type)
date
incomposition.section.entry
between min and max (depends on section code). Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_TERM whereresource_type
= "immunization" andaction
= "date":
min >=composition.date
-immunization.date
<= max
or
min >=composition.date
-immunization.date
(in case when config has only one parameter)Return 422 ("Difference between sign composition date and referenced immunization date must be from <min> to <max>") in case of error
...
Check (100) that referenced service request (if entry has resource with this type) from
composition.section.entry
has category (category.coding.code and category.coding.system) based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_CATEGORYReturn 422 ("Invalid category in referenced service request at section.entry")
Check (101) that referenced service request (if entry has resource with this type) from
composition.section.entry
has code.identifier (code.identifier.type.coding.code and code.identifier.type.coding.system) based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_CODE whereresource_type
= "service request"Return 422 ("Invalid code identifier in referenced service request at section.entry") in case of error
Check (102) that referenced service request (if entry has resource with this type) from
composition.section.entry
has status based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_STATUSReturn 422 ("Invalid referenced service request status in section.entry") in case of error
Check (103) that different from sign composition date and referenced service request (if entry has resource with this type) between min and max (depends on section code):
if service request has filledoccurrence_period.start
incomposition.section.entry
calculate:
min >=composition.date
-service_request.occurrence_period.start
<= max
or
min >=composition.date
-service_request.occurrence_period.start
(in case when config has only one parameter)
Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_PERIOD_START whereresource_type
= "service request"
if service request has filledoccurrence_date_time
incomposition.section.entry
calculate:
min >=composition.date
-service_request.occurrence_date_time
<= max
or
min >=composition.date
-service_request.occurrence_date_time
(in case when config has only one parameter)
Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_TERM whereresource_type
= "service request" andaction
= "occurrence"Return 422 ("Difference between sign composition date and referenced service request date must be from <min> to <max>") in case of error
...
Check (122) that referenced employee (if entry has resource with this type) from
composition.section.entry
has status based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_EMPLOYEE_STATUSReturn 422 ("Invalid referenced employee status in section.entry") in case of error
Check (123) that referenced employee (if entry has resource with this type) from
composition.section.entry
has position based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_EMPLOYEE_POSITIONReturn 422 ("Invalid referenced employee position in section.entry") in case of error
Check (124) that referenced employee (if entry has resource with this type) from
composition.section.entry
has speciality based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_EMPLOYEE_SPECIALITYReturn 422 ("Invalid referenced employee speciality in section.entry") in case of error
Check (124.1) that referenced employee (if entry has resource with this type) from
composition.section.entry
has main speciality (employee.accreditation.speciality_officio
= true ) based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_EMPLOYEE_MAIN_SPECIALITYReturn 422 ("Invalid referenced employee main speciality in section.entry") in case of error
Check (125) that referenced employee (if entry has resource with this type) from
composition.section.entry
has type based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_EMPLOYEE_TYPEReturn 422 ("Invalid referenced employee type in section.entry") in case of error
Check (126) that different from sign composition date and referenced employee (if entry has resource with this type) start working date -
start_date
incomposition.section.entry
between min and max (depends on section code). Base on config - COMPOSITION_SECTION_SECTION_ENTRY_DEVICE_DISPENSE_WHEN_HANDED_OVER:
min >=composition.date
-employee.start_date
<= max
or
min >=composition.date
-employee.start_date
(in case when config has only one parameter)Return 422 ("Difference between sign composition date and employee start working date must be from <min> to <max>") in case of error
Processing
A list of processes related to receiving, changing or transmitting data according to the logic defined in the REST API
Response structure examples
...
See on API-specification (посилання на сторінку з API-специфікацією)
Expand | |||||
---|---|---|---|---|---|
| |||||
|
...
Response code | HTTP Status code | Message | Internal name | Description | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | Базові | ||||||||||
2 | 401 | Invalid access token | |||||||||
3 | 400 | Invalid signed content | 4 | ||||||||
5 |
| 401 | Unauthorized |
| Помилка підтвердження | ||||||
6 | 400 | Invalid signed content | |||||||||
4 | 403 | Access denied. Party is not verified | |||||||||
75 | 403 | Access denied. Party is deceased | |||||||||
86 | 403 | Your scope does not allow to access this resource. Missing allowances: composition:write | |||||||||
9 | 10007 | 404 | Composition not found | COMPOSITION_NOT_FOUND_404 | Не знайдено медичний висновок | 10 | 404 | Person is not found | |||
118 | 409 | Patient is not verified | |||||||||
129 | 422 | Allow composition status must be Admit when extension is not empty | |||||||||
1310 | 422 | Attester of composition must work in same LE as custodian | |||||||||
1411 | 422 | Attester is not active | |||||||||
1512 | 422 | Attester id doesn’t belongs to employee id from token | |||||||||
1613 | 422 | Author and Attester of composition must work in same LE as custodian | |||||||||
1714 | 422 | Authentication method with type THIRD_PERSON must be submitted for this person | |||||||||
1815 | 422 | Authentication method doesn't exist, is inactive or does not belong to this person | |||||||||
1916 | 422 | Composition type is not allowed by configuration | |||||||||
2017 | 422 | Composition title is invalid | |||||||||
2118 | 422 | Composition with title <title> already exists | |||||||||
2219 | |||||||||||
2320 | 422 |
| |||||||||
2421 | 422 |
| |||||||||
2522 | 422 | Composition event period duration must be less than <check.value> <check.units> | |||||||||
2623 | 422 | Does not match the signer drfo | |||||||||
2724 | 422 | Difference between start date and sign date must be from <min> to <max> days | |||||||||
2825 | 422 | Difference between create encounter date and sign composition date must be in range of <min value> and <max value> days | |||||||||
2926 | 422 | Difference between sign composition date and referenced diagnostic report end date must be from <min> to <max> | |||||||||
3027 | 422 | Difference between sign date old and new composition must be from <min> to <max> | |||||||||
3128 | 422 | Difference between sign composition date and referenced episode start date must be from <min> to <max> | |||||||||
3229 | 422 | expected a minimum of %{min} items but got %{actual} | |||||||||
3330 | 422 | Employee with such verification status can’t sign composition | |||||||||
3431 | 422 | Forbidden to create composition with this attester type | |||||||||
3532 | 422 | Forbidden to create composition with this attester position | |||||||||
3633 | 422 | Forbidden to create composition with this attester speciality | |||||||||
3734 | 422 | Forbidden to create composition with referenced attester speciality and position | |||||||||
3835 | 422 | Forbidden to create composition with this attester main speciality | |||||||||
3936 | 422 | Invalid letter designation for the additional admission condition code | |||||||||
4037 | 422 | Employee with such verification status can’t create composition | |||||||||
4138 | 422 | Event period start and period end is required | |||||||||
4239 | 422 | Event period start is required and event period end must be empty | |||||||||
4340 | 422 | Event codes must be unique | |||||||||
4441 | 422 | Empty required codes in section.entry for current composition | |||||||||
4542 | 422 | Empty reason value is not allowed in enum | |||||||||
4643 | 422 | Forbidden to create composition with such category for preperson | |||||||||
4744 | 422 | Forbidden to create composition with selected author type | |||||||||
4845 | 422 | Forbidden to create composition with selected encounter type | |||||||||
4946 | 422 | Forbidden to create composition for person of this age | |||||||||
5047 | 422 | Forbidden to create composition with selected author position | |||||||||
5148 | 422 | Forbidden to create composition with selected author speciality | |||||||||
5249 | 422 | Forbidden to create composition with selected author main speciality | |||||||||
5350 | 422 | Forbidden to create composition with selected author speciality and position | |||||||||
5451 | 422 | Invalid gender of person for such composition | |||||||||
5552 | 422 | Invalid legal entity of employee | |||||||||
5653 | 422 | Invalid legal entity from sign | |||||||||
5754 | 422 | Invalid custodian legal entity type | |||||||||
5855 | 422 | Invalid legal entity verification status | |||||||||
5956 | 422 | Invalid section content. Mandatory section | |||||||||
6057 | 422 | Invalid referenced diagnostic report status in section.entry | |||||||||
6158 | 422 | Invalid code in referenced diagnostic report at section.entry | |||||||||
6259 | 422 | Invalid referenced encounter type in section.entry | |||||||||
6360 | 422 | Invalid referenced encounter status in section.entry | |||||||||
6461 | 422 | Invalid referenced encounter class in section.entry | |||||||||
6562 | 422 | Invalid referenced care plan status in section.entry | |||||||||
6663 | 422 | Invalid referenced activity detail.product_reference in section.entry | |||||||||
6764 | 422 | Invalid referenced activity status in section.entry | |||||||||
6865 | 422 | Invalid referenced procedure type in section.entry | |||||||||
6966 | 422 | Invalid category in referenced diagnostic report at section.entry | |||||||||
7067 | 422 | Invalid code.coding in referenced condition at section.entry | |||||||||
7168 | 422 | Invalid code in referenced observation at section.entry | |||||||||
7269 | 422 | Invalid referenced condition clinical_status in section.entry | |||||||||
7370 | 422 | Invalid referenced condition verification_status in section.entry | |||||||||
7471 | 422 | Invalid referenced observation status in section.entry | |||||||||
7572 | 422 | Invalid referenced observation date in section.entry | |||||||||
7673 | 422 | Invalid referenced immunization explanation reason not given in section.entry | |||||||||
7774 | 422 | Invalid referenced immunization status in section.entry | |||||||||
7875 | 422 | Invalid vaccine code in referenced immunization at section.entry | |||||||||
7976 | 422 | Invalid referenced immunization report origin in section.entry | |||||||||
8077 | 422 | Invalid referenced medication request status in section.entry | |||||||||
8178 | 422 | Invalid category in referenced care plan at section.entry | |||||||||
8279 | 422 | Invalid category in referenced service request at section.entry | |||||||||
8380 | 422 | Invalid code identifier in referenced service request at section.entry | |||||||||
8481 | 422 | Invalid referenced service request status in section.entry | |||||||||
8582 | 422 | Invalid referenced division type in section.entry | |||||||||
8683 | 422 | Invalid referenced employee status in section.entry | |||||||||
8784 | 422 | Invalid referenced employee type in section.entry | |||||||||
8885 | 422 | Invalid referenced employee position in section.entry | |||||||||
8986 | 422 | Invalid referenced employee speciality in section.entry | |||||||||
9087 | 422 | Invalid referenced employee main speciality in section.entry | |||||||||
9188 | 422 | Invalid category in referenced observation at section.entry | |||||||||
9289 | 422 | LegalEntity with such ID is not found | |||||||||
9390 | 422 | Legal entity referenced as performer is in invalid status | |||||||||
9491 | 422 | Limit of medical records for this composition type and category must be less or equal <RECORDS_LIMIT> | |||||||||
9592 | 422 | Missing required extension | |||||||||
9693 | 422 | Max count of resources in | |||||||||
9794 | 422 | Only one | |||||||||
9895 | 422 | Only one attester for composition must be submitted | |||||||||
9996 | 422 | Patient is not active | |||||||||
10097 | 422 | Person from section.entry must be the same as composition.subject or composition.section.focus | |||||||||
10198 | 422 | Prohibited extension code | |||||||||
10299 | 422 | Previously created composition must be in status 'entered_in_error | |||||||||
103100 | 422 | Period end of event must be later than event start period | |||||||||
104101 | 422 | Prohibited observation code - <code> in section.entry for current composition | |||||||||
105102 | 422 | Prohibited nested level for composition section | |||||||||
106103 | 422 | Prohibited amount of composition section | |||||||||
107104 | 422 | required property %{property} was not present | |||||||||
108105 | 422 | Referenced encounter not found for this patient | |||||||||
109106 | 422 | Related composition used for another composition | |||||||||
110107 | 422 | Related document type must be 'Composition' | |||||||||
111108 | 422 | Resource type is not allowed in this section for this section code | |||||||||
112109 | 422 | schema does not allow additional properties | |||||||||
113110 | 422 | Sign date must be less or equal | |||||||||
114111 | 422 | string does not match pattern | |||||||||
115112 | 422 | Section order by value is not allowed in enum | |||||||||
116113 | 422 | Section {{section_code}} can not contain | |||||||||
117114 | 422 | Section {{section_code}} can not contain emptyReason | |||||||||
118115 | 422 | Section {{section_code}} can not contain nested | |||||||||
119116 | 422 | Sections structure does not correspond to the permitted one | |||||||||
120117 | 422 | Section code value is not allowed in enum | |||||||||
121118 | 422 | Section {{section_code}} must contain | |||||||||
122119 | 422 | Section author position does not allow | |||||||||
123120 | 422 | Section author speciality does not allow to create such composition | |||||||||
124121 | 422 | Section author main speciality does not allow to create such composition | |||||||||
125122 | 422 | Status of person can’t be 'not verified' in | |||||||||
126123 | 422 | Type, category and subject of composition and related composition must be the same | |||||||||
127124 | 422 | value is not allowed in enum | |||||||||
128125 | 422 |
| |||||||||
129 | 130126 | Специфічні | |||||||||
131 |
| 422 | Only for active MPI record can be created medication request! | 127 |
|
Post-processing processes
Description of actions performed on data after processing
Technical modules where the method is used
List of pages describing technical N/A
Technical modules where the method is used
Название | ID ТМ | Статус |
---|---|---|
TM0112 | ||
...