ЕСОЗ - публічна документація
DEPRICATED DUE TO CR-213!!! COVID encounter type
Introduction
СТОРІНКА ВТРАТИЛА АКТУАЛЬНІСТЬ ЧЕРЕЗ ЗМІНИ ЗА ЗАПИТОМ https://e-health-ua.atlassian.net/browse/CR-213
This page describes requirements, configurations and validations of encounter data package specific for type COVID
All medical cases related to COVID-19 (suspicion, laboratory investigations, ambulatory etc) must be submitted to eHealth system via Encounter Package with type covid
Specification
Apiary. Submit Encounter Data Package
Key features
Attribute | Validation |
---|---|
encounter.type | Encounter type covid is available for INPATIENT and AMB encounter classes |
encounter.division | $.encounter.division is mandatory for type covid |
encounter.performer | Any employee type can submit encounter with type covid. Don't validate performer_type for such encounter |
encounter.performer | Do not validate signer drfo. Any employee from $.encounter.managing_organization can sign encounter package with type covid |
encounter.diagnoses | $.encounter.diagnoses is mandatory for type covid. Validate primary condition:
|
encounter.reasons | $.encounter.reasons is mandatory for type covid |
encounter.actions encounter.action_references | $.encounter.actions OR $.encounter.action_references is mandatory depending on class
|
Validations
Authorization
Verify the validity of access token
in case of error return 401 ('Access denied')
Check user scope encounter:write in order to perform this action
in case of error generate 403 response ('Invalid scopes')
Request validation
Note: No update operations are allowed. All IDs, submitted as PK, should be unique for eHealth.
Validate patient status
db.patients.status for this patient must be "active"
in case of error return 409 - "Patient is not active"
Validate request according to JSON Schema
Return 422 with list of validation errors in case validation fails
Validate Visit
$.visit is optional in request. You can create new or reference existing one in encounter object
If $.visit is present in request
$.visit.id is unique
in case of error return 422 - "Visit with such id already exists"
$.visit.end is filled
in case of error return - "End date of visit must be filled"
Verify signed content and signer
Verify signed content
Validate that Signer belongs to the managing_organization
validate that there is at least one employee in managing_organization with such drfo (Signer DRFO)
Validate encoded signed content according to JSON Schema (link)
Return 422 with list of validation errors in case validation fails
Validate Legal Entity Type
Validate legal entity from token: legal_entities.type should be in me_allowed_transactions_le_types and legal_entities.status =='active'
Validate encounter
Validate encounter id as a primary key
Validate that the date is within acceptable limits
$.encounter.date is required
$.encounter.date <= current_date
$.encounter.date >= current_date - encounter_max_days_passed
Validate "episode" is an active episode that belongs to the current patient
$.encounter.episode is required
$.encounter.episode.identifier.value is one of ME.patinet{patient_id}.episodes{*}.id
in case of error return 422 "Episode with such ID is not found"
$.encounter.episode.identifier.value is an ID of an Episode that meets the requirements:
ME.patient{patinet_id}.episodes{episode_id}.status = 'active'
in case of error return 422 "Episode is not active"
ME.patient{patinet_id}.episodes{episode_id}.managing_organization==token.client_id
in case of error return 422 "Managing_organization in the episode does not correspond to user`s legal_entity"
Validate "visit" is a visit that belongs to the current patient
$.encounter.visit is required
$.encounter.visit.identifier.value=$.visit.id OR ID of already existing Visit in ME.patient{patient_id}.visit.id
in case of error return 422 "Visit with such ID is not found"
Validate referrals
As a referral it can be referenced electronic (registered in the system) OR paper service request
Validate ($.encounter.incoming_referrals OR $.encounter.paper_referral) or none in request
Validate incoming referrals as References
Validate paper referral as Object (paper_referral)
Validate incoming referrals that corresponds to $.encounter.incoming_referrals[*].identifier.value have:
..used_by_legal_entity.identifier.value==token.client_id OR null
in case of error return 409 "Service request is used by another legal_entity"
..status==active or program_processing_status=in_progress (any status is valid in case program_processing_status= in_progress)
in case of error return 409 "Invalid service request status"
..if program is defined program_processing_status=new, in_queue or in_progress
Validate performer
$.encounter.performer is required
$.encounter.performer.identifier.value is an ID of existing employee in PRM.Employees
in case of error return "There is no Employee with such id"
$.encounter.performer.identifier.value == PRM.Employees.id where (PRM.Employees.status==`active`)
in case of error return "Employee is not active"
$.encounter.performer.identifier.value == PRM.Employees.id where (PRM.Employees.legal_entity== client_id)
"User can not create encounter for this legal_entity"
Validate division
$.encounter.division is required
$.encounter.division.identifier.value must meet the following requirements
PRM.division.status = "ACTIVE"
in case of error return 409 "Division is not active "
PRM.division.legal_entity= token.client_id
in case of error return 409 "User is not allowed to create encounters for this division"
Validate supporting_info as References
Validate encounter.class
according to legal_entity.type - use config file (legal_entity_episode_types)
in case error return 409, msg "Encounter.class $class is forbidden for your legal entity type"
according to episode.type - use config file (episode_type_encounter_classes)
in case error return 409, msg "Encounter.class $class is forbidden for your episode type"
Validate encounter.type == covid
Validate diagnoses
$.encounter.diagnoses is required
Validate conditions as References
Validate encounter has exactly one diagnosis where $.encounter.diagnoses[?(@.role.coding[0].code=="primary")]
in case of error return 422 "Encounter must have exactly one primary diagnosis"
Validate condition.id is in DB or in current Encounter package
Validate that each condition is active (verification_status != entered_in_error)
in case of error return 409 "Conditions in diagnoses must be active"
Validate that primary diagnosis defined in the system that corresponds to encounter class validations
in case of error "Primary diagnosis should be defined in {$.encounter.diagnoses[*].role.coding[*].system } system"
Validate reasons
$.encounter.reasons is required
Validate that reasons are defined in the eHealth/ICPC2/reasons system
Validate service presence according to encounter class validations
in case error return 409, msg "At least one of action references, diagnostic reports or procedures should exist in encounter package"
Validate incoming referrals. If incoming referrals exists and encounter.class =='AMB" and encounter.type <> "patient_identity" validate service for encounter.actions OR diagnostic_report.code OR procedure.code
If service_requests.code.identifier.value is service, validate $resourse.code.identifier.value = service_requests.code.identifier.value
in case error return 409, "Service in $resourse differ from service in service request"
if service_requests.code.identifier.value is service_group, validate $resourse.code.identifier.value in (SELECT service_id from service_inclusions where service_group_id='service_requests.code.identifier.value')
in case error return 409, "Service in $resourse differ from services in service request's service_group"
Validate $resourse.service.is_active = true
in case error return 409, "Service should be active"
Validate actions and action_references
Validation vs Encounter class | PHC | All others |
---|---|---|
$.encounter.actions |
|
|
$.encounter.action_references |
|
|
Validate Immunizations
See validations on submit encounter data package page
Validate Allergy Intolerances
See validations on submit encounter data package page
Validate Risk Assessments
See validations on submit encounter data package page
Validate Devices
See validations on submit encounter data package page
Validate Medication Statement
See validations on submit encounter data package page
Validate Medication Administration
See validations on submit encounter data package page
Validate Diagnostic Report
See validations on submit encounter data package page
Validate Procedures
See validations on submit encounter data package page
Primary key validation
Validate that IDs of all submitted entities in the array are unique
validate that $.{collection}[*].id from the payload are all unique among themselves
in case of error return 409 "All primary keys must be unique"
validate there is no entity with such id in the corresponding Medical events collection
in case of error return 422 "{Entity} with such id already exists"
Reference validation
This validation is used to validate references to medical events data from patient's collection.
Validate that $..identifier.value is an existing value from $..identifier.type.coding[0].code collection in DB and it belongs to the patient OR it is a value from corresponding collection in the current request
in case of errror return 422 "There is no {$..identifier.type.coding[0].code} with such id"
Validate that this entity is not in status entered_in error
in case of errror return 422 "Could not reference entity in status entered_in_error"
Performer(asserter) validation
case $..primary_source==true
$..performer(or $..asserter) must be filled
in case of error "Performer (asserter) must be filled"
$..report_origin must be absent
in case of error "Report_origin can not be submitted in case primary_source is true"
validate performer(asserter) is a valid value from corresponding dictionary
$..performer.identifier.type.coding[*].system == "eHealth/resources"
in case of error "Submitted system is not allowed for this field"
$..performer.identifier.type.coding[*].code=="employee"
in case of error "Submitted code is not allowed for this field"
validate performer(asserter) is a active employee from current legal_entity
$..performer.identifier.value is an ID of existing employee in PRM.employee
in case of error "Employee with such id is not found"
$..performer.identifier.value == PRM.employees.id where (PRM.employees.status == "APPROVED")
case primary_source==false
$..report_origin must be filled
in case of error "Report_origin must be filled"
if $..primary_source==false then $..performer(asserter) must be absent
in case of error "Performer(asserter) can not be submitted in case primary_source is false"
validate report_origin
$..report_origin.coding[*].system == "eHealth/report_origins"
in case of error "Submitted system is not allowed for this field"
Employee validation
Users can not reference employees between different legal entities. Employee that is not in status `approved` can not be referenced as well.
$...identifier.value exists in PRM.employees
in case of error 409 "Employee not found"
$...identifier.value == PRM.employees.id where (PRM.employees.status == "APPROVED" and PRM.employees.legal_entity==token.client_id)
in case of error 409 "Submitted employee is not an active employee from current legal entity"
References
ЕСОЗ - публічна документація