Inbound HL7 Overview
Operation map for inbound HL7/SFTP order workflows handled by `hl7/2_3/createOrder/`.
Inbound HL7 Overview
hl7/2_3/createOrder/ is the inbound HL7/SFTP router for
order-related workflows. It validates the integration token, parses the raw HL7
payload, checks the external order number, and then routes the request to the
correct operation.
Entry Point
| Item | Value |
|---|---|
| Function | hl7/2_3/createOrder/ |
| Source file | livehealthapp/labs/views.py |
| Parser, standard orders | orm_hl7_parsing_api_corrohealth |
| Parser, tox/micro orders | orm_hl7_parsing_function_tox |
| Downstream bill creation endpoint | /create_order_in_crelio/ |
| Required integration category | actionCategoryListId = 51 |
Request Contract
| Field | Location | Required | Description |
|---|---|---|---|
authKey | Query string | Yes | Validates requestToken and resolves lab, lab user, and lab timezone. |
integration | Query string | No | Vendor identifier passed to the parser for vendor-specific mapping. |
patient_strict_check | Query string | No | Enables stricter downstream patient matching by demographic fields. |
| HL7 message | Request body | Yes | Raw HL7 payload parsed into the inbound order payload. |
Routing Summary
| Operation | Routing condition | Documentation |
|---|---|---|
| Create new order | No active bill exists for the inbound order number, or no order number is parsed. | Create Order |
| Update order / accession | Existing bill or report is found downstream and the request carries accession/sample identifiers. | Update Order |
| Add tests to bill | Existing active bill, addTestToBill = 1, and uniqueOrderNo = 0. | Add Test to Bill |
| Cancel bill | Existing active bill, uniqueOrderNo = 1, cancelBill = 1, and ORC-1 = CA. | Bill Cancel |
Request Routing Flow
Common Integration Configuration
These keys are read from the integration configuration.
| Key | Default | Used by | Description |
|---|---|---|---|
uniqueOrderNo | 1 | Create, cancel, duplicate handling | Enforces one active bill per external order number. |
cancelBill | 0 | Bill cancel | Allows full bill cancellation when the inbound order status is CA. |
addTestToBill | 0 | Add test to bill | Allows appending inbound tests to an existing bill when duplicate order numbers are permitted. |
add_duplicate_test | 0 | Add test to bill | Allows adding a test even if the bill already has that test. |
toxMicroIntegration | 0 | Create order | Switches to the tox/micro parser and post-bill drug setup. |
orgPriceList | 0 | Create, add test | Uses organization price-list amounts where applicable. |
replace_insurance_details | 0 | Create order | Replaces active patient insurance records before saving inbound insurance. |
auto_add_insurance | 0 | Create order | Creates insurance master data from inbound IN1 if the code is not found. |
prescription_reflex_at_order | 0 | Tox/micro create order | Controls prescription reflex setup after tox bill creation. |
is_aoe_store | unset | Create, add test | Stores OBX question/value data as AOE values. |
Parsed Fields Used For Routing
| Parsed field | HL7 source | Description |
|---|---|---|
orm_status | ORC-1 | Order control/status. CA is used for cancellation. |
orderNumber | OBR placer/filler fields, with vendor-specific overrides | External order number used for duplicate, update, add-test, and cancel lookup. |
testList | OBR-4 | Inbound tests to create or append. |
lab_report_id | OBR-3 | Report identifier used by accession/update flows. |
manual_sample_id | ZCT-12 | Manual sample/accession identifier used by update flows. |
Duplicate Order Lookup
When the inbound orderNumber is available, the router searches active bills in
the same lab where:
isCancel = 0isRefund = 0isWriteOff = 0orderNumbermatches the inbound order number, or the inbound order number is numeric and matcheslabBillId
That lookup decides whether the request becomes add-test, bill cancel, duplicate acknowledgement, or create order.
Response Timing
Create-order requests are forwarded to Fusion and return a jobId immediately.
Add-test and bill-cancel requests are handled synchronously in the router.
Update/accession behavior happens inside /create_order_in_crelio/ when the
downstream function detects an existing order or report.