Fixing KIPU EMR API Payload Structure for PAA Document Attachment Routing
This guide helps resolve issues in which PAA (Pre-Admission Assessment) PDF documents do not appear in the correct KIPU EMR tab after being sent via the API.
Symptom/Error
When pushing PAA PDF documents to KIPU EMR after patient admission, you may experience the following:
API returns a "202 Accepted" response indicating successful upload
PAA PDF documents do not appear in the Pre-Admission tab in KIPU
Documents may appear to upload, but are not properly routed to the correct patient process tab
This typically occurs when trying to send updated PAA documents to existing patient charts that have already been admitted to KIPU.
Cause
The issue is caused by two problems in the API payload structure:
Incorrect nesting: The 'attachments_attributes' field is being sent under the 'data' hash but should be under 'document' instead
Missing routing field: The 'attachment_patient_process_id' field with value '69' is required to properly route documents to the Pre-Admission tab
Solution
Follow these steps to correct the API payload structure:
Step 1: Move attachments_attributes to correct location
Change the payload structure from this incorrect format:
{"document":{"recipient_id":"...","sending_app_name":"Dazos App","data":{"update":"true","update_patient_attributes":"true","ext_username":"dazosdev","attachments_attributes":[{"attachment_patient_process_id":"69","attachment":"filename.pdf"}]}}}
To this correct format:
{"document":{"recipient_id":"...","sending_app_name":"Dazos App","attachments_attributes":[{"attachment_patient_process_id":"69","attachment":"filename.pdf"}],"data":{"update":"true","update_patient_attributes":"true","ext_username":"dazosdev"}}}
Step 2: Ensure attachment_patient_process_id is included
Verify that each attachment includes the attachment_patient_process_id field with the value "69" to route documents to the Pre-Admission tab in KIPU.
Step 3: Test the corrected payload
Send a test document using the corrected payload structure and verify it appears in the Pre-Admission tab in KIPU.
Verification / Expected Result
After implementing the fix, you should see:
PAA PDF documents successfully appearing in the Pre-Admission tab in KIPU
Documents properly linked to the patient's pre-admission process
Ability to send updated PAA documents to existing patient charts regardless of admission status
Escalation
Contact Dazos support if:
The corrected payload structure still doesn't route documents properly
You need assistance implementing the payload structure changes
Documents appear to upload but are still not visible in the expected KIPU tab
You need clarification on other attachment_patient_process_id values for different document types