Table of Contents | ||
---|---|---|
|
...
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 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 COMPOSITION_ADDITIONAL_CONDITION_ADMISSION 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:
...
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
...
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 ("Invalid section hierarchy for nested section") 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 least one of:
nested
section
parameteremptyReason
parameterentry
parameterin case of error an error return 422 ("Section {{section_code}} must contain at least one of: nested
section
,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 ANDemptyReason
parameterin case of error an error return 422 ("Section {{section_code}} can not contain both
entry
andemptyReason
parameters")
In case configuration parameters
containsResources
= true andisEmpty
= 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
oremptyReason
parameters")
In case one of configuration parameters:
containsResources
orisEmpty
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 thatemptyReason
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 (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 referenced care plan category in 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 (71) that referenced activity (if entry has resource with this type) from
composition.section.entry
has detail.kind based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_ACTIVITY_DETAIL_KINDReturn 422 ("Invalid referenced activity detail.kind in section.entry") in case of error
Check (72) that referenced activity (if entry has resource with this type) from
composition.section.entry
has detail.product_reference (care_plan) based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_ACTIVITY_DETAIL_PRODUCT_REFERENCEReturn 422 ("Invalid referenced activity detail.product_reference in section.entry") in case of error
Check (73) that referenced activity (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 activity status in section.entry") in case of error
...
Check (74) that referenced procedure (if entry has resource with this type) from
composition.section.entry
has code (code.identifier.type.coding.code and code.identifier.type.coding.system) based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_TYPEReturn 422 ("Invalid referenced procedure type in section.entry") in case of error
Check (75) that referenced procedure (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 procedure status in section.entry") in case of error
Check (76) that different from sign composition date and referenced procedure (if entry has resource with this type) between min and max (depends on section code):
if procedure has filledperformed_period.end
incomposition.section.entry
calculate:
min >=composition.date
-procedure.performed_period.end
<= max
or
min >=composition.date
-procedure.performed_period.end
(in case when config has only one parameter)
Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_PERIOD_END whereresource_type
= "procedure"
if procedure has filledperformed_date_time
incomposition.section.entry
calculate:
min >=composition.date
-procedure.performed_date_time
<= max
or
min >=composition.date
-procedure.performed_date_time
(in case when config has only one parameter)
Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_TERM whereresource_type
= "procedure" andaction
= "performed"Return 422 ("Difference between sign composition date and referenced procedure date must be from <min> to <max>") in case of error
...
Check (77) that referenced condition (if entry has resource with this type) from
composition.section.entry
has code (at least one item in code.coding array (code.coding.code and code.coding.system)) based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_CODE whereresource_type
= "condition"Return 422 ("Invalid referenced condition code.coding in section.entry") in case of error
Check (78) that referenced condition (if entry has resource with this type) from
composition.section.entry
has clinical_status based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_STATUSReturn 422 ("Invalid referenced condition clinical_status in section.entry") in case of error
Check (79) that referenced condition (if entry has resource with this type) from
composition.section.entry
has verification_status based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_CONDITION_VERIFICATION_STATUSReturn 422 ("Invalid referenced condition verification_status in section.entry") in case of error
Check (80) that different from sign composition date and referenced condition (if entry has resource with this type)
asserted_date
incomposition.section.entry
between min and max (depends on section code). Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_TERM whereresource_type
= "condition" andaction
= "asserted":
min >=composition.date
-condition.asserted_date
<= max
or
min >=composition.date
-condition.asserted_date
(in case when config has only one parameter)Return 422 ("Difference between sign composition date and referenced condition asserted date must be from <min> to <max>") in case of error
Check (81) that different from sign composition date and referenced condition (if entry has resource with this type)
onset_date
incomposition.section.entry
between min and max (depends on section code). Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_TERM whereresource_type
= "condition" andaction
= "onset":
min >=composition.date
-condition.onset_date
<= max
or
min >=composition.date
-condition.onset_date
(in case when config has only one parameter)Return 422 ("Difference between sign composition date and referenced condition onset 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 referenced observation code in 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 referenced observation category in 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 referenced immunization vaccine code in 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 (96) that referenced medication 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 medication request status in section.entry") in case of error
Check (97) that different from sign composition date and referenced medication request (if entry has resource with this type)
created_at
incomposition.section.entry
between min and max (depends on section code). Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_TERM whereresource_type
= "medication request" andaction
= "created":
min >=composition.date
-medication_request.created_at
<= max
or
min >=composition.date
-medication_request.created_at
(in case when config has only one parameter)Return 422 ("Difference between sign composition date and referenced medication request created date must be from <min> to <max>") in case of error
Check (98) that different from sign composition date and referenced medication request (if entry has resource with this type)
started_at
incomposition.section.entry
between min and max (depends on section code). Base on config - COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_PERIOD_START:
min >=composition.date
-medication_request.started_at
<= max
or
min >=composition.date
-medication_request.started_at
(in case when config has only one parameter)Return 422 ("Difference between sign composition date and referenced medication request started at 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 referenced service request category in 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 referenced service request code identifier in 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 (120) that referenced division (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 division status in section.entry") in case of error
Check (121) that referenced division (if entry has resource with this type) from
composition.section.entry
has type based on dictionary which depends onsection.code
- COMPOSITION_SECTION_SECTION_ENTRY_RESOURCE_TYPEReturn 422 ("Invalid referenced division type in section.entry") 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
...
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 composition data model
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
Response structure
...
Expand | ||
---|---|---|
| ||
{ |