Table of Contents |
---|
Purpose
This WS allows to create Specimen entity by employees without submitting Encounter Data Package.
Specification
Link | |
Resource | api/patients/patient_id/specimens |
Scope | specimen:write |
Components | Specimen |
Microservices |
|
Protocol type | REST |
Request type | POST |
Sync/Async | Async |
Public/Private/Internal | Public |
...
Array item has type of {Reference} to Service Request resource
in case of error - return 422 ('value is not allowed in enum')
Service Request exists in the DB and relates to the patient ($.subject)
in case of error - return 422 ("Service request with such id is not found")
Service Request’s status is active or program_processing_status is in_progress (any status is valid in case program_processing_status= in_progress)
in case of error - return 422 ("Service request is not active or in progress")
If used_by_legal_entity is set in the Service request (program_processing_status=in_progress), then check it matches the client_id from token
in case of error - return 422 ("Service request must be related to the same legal entity")
Check if Service Request’s expiration date is less then or equal to current date
in case of error - return 422 ("Service request expiration date must be greater than or equal to current date")
...
Check there is no specimen with the same ID in the DB
in case of error return 422 “Specimen with such id <id> already exists“
8. Managing organization
...
Validate there is one of the required $.collection.collected_[x] field is set: collected_date_time or collected_period.
Return 422 ('Only At least one of the parameters must be present') in case more then one submitted
...
Check that $.collection.duration.system is
eHealth/ucum/units
dictionary, requiredin case of error - return 422 ('value is not allowed in enum')
Check that $.collection.duration.code comply with $.collection.duration.system and one of SPECIMEN_DURATION_ALLOWED_CODES, required
in case of error - return 422 ('value is not allowed in enum')
Check $.collection.duration.value is not empty, is float, greater than zero
in case of error - return corresponding 422 ('must be greater than 0')
...
Save signed content to media storage, in the bucket pointed in MEDIA_STORAGE_SPECIMEN_BUCKET chart parameter
Generate accession_identifier number:
Generate requisition number (see Human readable requisition number) based on the specimen id. Note: requisition number should be unique for each specimen and should not match with number of another entities. So, if generated number match to existing in DB - it should be regenerated
Encode and set it into $.accession_identifier attribute
Set display_value for:
registered_by attribute
managing_organization attribute
collection.collector attribute, only if type is employee (not patient)
Set context, received_time, status_reason, collection.procedure to null
Set subject with hashed mpi identifier
Save data to specimens collection in DB according to https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/17629118845 RC.__Specimen data model_EN
Save link from media storage to the $.signed_content_links field in specimens collection
Create job and return it’s id.
...