Feature added: 2026-07-30
Applies to: GP Booking App (lab_documents module)
Related pages: eViewPlus, Lab Workflow User Guide
This feature reduces/eliminates manual data entry errors when clinicians interact with TDL's eViewPlus portal during the lab order process. Two key improvements were implemented:
tdl_order_ref field ready for barcode scanner input (or manual paste), rather than closing and forcing a page reload.| File | Change |
|---|---|
lab_documents/views.py |
New api_update_order_ref endpoint (PATCH tdl_order_ref on an existing LabOrder); New MockTdlView for testing |
lab_documents/urls.py |
Added routes: api/orders/<int:order_id>/update-ref/ and mock-tdl/ |
dsp_clinic/settings.py |
Added TDL_PORTAL_URL setting; registered debug and tdl_portal_url context processors |
dashboards/context_processors.py |
New tdl_portal_url context processor |
| File | Change |
|---|---|
lab_documents/templates/lab_documents/_log_order_modal.html |
Complete rewrite with two-state modal: State 1 (test selection + patient copy buttons), State 2 (post-save with scanner-ready ref input) |
users/templates/users/patient_detail.html |
Rewritten JS — modal transitions to State 2 instead of closing+reload; handles ref save, Enter-key detection for barcode scanners |
lab_documents/templates/lab_documents/_order_card.html |
Copy button next to TDL ref on existing order cards |
lab_documents/templates/lab_documents/order_list.html |
Updated TDL portal link to respect DEBUG mode |
lab_documents/templates/lab_documents/mock_tdl.html |
New — Mock TDL eViewPlus portal for testing |
Appears automatically after successful API response. The original form is hidden and replaced by:
After saving the reference, the input and button are disabled with a success feedback message.
POST /lab/api/orders/<id>/update-ref/
Request:
{ "tdl_order_ref": "TDL-MOCK-A3B7X9K2" }
Response:
{ "status": "ok" }
Updates the tdl_order_ref field on an existing LabOrder without changing its status. Used when the clinician returns from the TDL portal with the reference number.
No special driver or library is needed. USB barcode scanners emulate a keyboard — they send the scanned text followed by an Enter keypress. The implementation:
tdl_order_ref input in State 2 is auto-focused when the modal transitionsURL: /lab/mock-tdl/?order_id=X
A fully functional mock of TDL's eViewPlus portal for end-to-end testing without access to the real system. Features:
TDL-MOCK-XXXXXXXX)When DEBUG=True, all "Open TDL Portal" buttons/links across the app automatically point to this mock instead of the real eViewPlus URL. This is controlled by the TDL_PORTAL_URL setting (defaults to https://eviewplus.tdlpathology.com/login).
DEBUG=True in your environment (or set TDL_PORTAL_URL environment variable)Step 1: Create a lab order
/users/<id>/)Step 2: Verify modal transition
Step 3: Use the mock TDL portal
TDL-MOCK-A3B7X9K2)Step 4: Save the TDL reference
Step 5: Verify persistence
Step 6: Test the existing order card copy button
<code> works| Scenario | Expected |
|---|---|
| Click Save with empty ref | Red error: "Please enter or scan a TDL reference." |
| API error during save | Red error with message |
| Close modal without saving ref | Order still exists (PENDING, no ref) — accessible via patient record |
| Reopen patient record | Order card shows with or without ref as saved |
| Open TDL Portal on order card (existing PENDING order) | Works the same as from modal |
| Open TDL Portal from order list page | Works correctly |
If DEBUG=False, the mock portal is still available at /lab/mock-tdl/?order_id=X but you'll need to navigate to it manually. The "Open TDL Portal" button will point to the real eViewPlus URL.
| Setting | Default | Description |
|---|---|---|
TDL_PORTAL_URL |
https://eviewplus.tdlpathology.com/login |
Base URL for the TDL eViewPlus portal. Set via environment variable. When DEBUG=True, automatically overridden to the mock portal URL. |
dental_booking_app) does not yet have the LabOrder module — will be replicated from GP Booking App when dental development begins============================================================
Page: https://wiki.veripath.co.uk/development/projects/doctors_laboratory/eViewPlus/enhanced-lab-order-flow
Prerequisite: acquire a USB barcode scanner (keyboard wedge/HID — no special drivers needed).
| # | Test | Steps | Expected |
|---|---|---|---|
| 1 | Scanner wedge input | Click TDL Ref field in modal State 2, scan a barcode | Ref text appears in field as if typed |
| 2 | Save via Enter | Scan barcode into TDL Ref field, press Enter | AJAX POST fires, green feedback: "Reference saved successfully!" |
| 3 | Save via button | Scan barcode, click the Save button | Same as Enter — ref saved, feedback shown |
| 4 | Direct scan (no prior focus) | With TDL Ref field already focused from State 2 entry, scan immediately | Works the same as manual focus-then-type |
| 5 | Re-scan after save | After a ref is saved (field disabled), scan again | Field remains disabled, no overwrite |
| 6 | Multiple orders | Log 2+ orders in the same session, scan a ref for each | Each ref linked to the correct order ID |
| 7 | Page reload after scan | Save ref, click Done, page reloads | Order card shows correct TDL Ref with copy button |
| 8 | Copy button on order card | Click copy icon next to TDL Ref on order card | Ref copied to clipboard |
| 9 | Click-to-copy patient details | In modal State 1, click name and DOB copy buttons | Values copied to clipboard, ready to paste into eViewPlus |
Prerequisite: DSPT accreditation obtained, contact established with TDL.
| # | Test | Steps | Expected |
|---|---|---|---|
| 1 | Click-to-copy into eViewPlus | From modal State 1, click name/DOB copy buttons, switch to eViewPlus tab, paste | Values transfer correctly |
| 2 | Open TDL portal from modal | In modal State 2, click Open TDL Portal | eViewPlus opens (real URL from TDL_PORTAL_URL setting) |
| 3 | Open TDL portal from order card | On any PENDING order card, click Open TDL Portal | Same as above |
| 4 | Open TDL portal from order list | On the lab orders list page, click TDL button | Same as above |
| 5 | End-to-end: order → scan → results | Log order, scan printed label ref, wait for results | Lab document arrives, order status transitions PENDING → RECEIVED → FILED |
| 6 | Manual ref entry (no scanner) | Type ref manually in State 2, save | Works identically to scanner input |
| 7 | Ref entered during order creation | Fill TDL Ref in State 1 before saving | Ref saved on initial POST /api/orders/create/, no second step needed |
api_create_lab_order, api_update_order_ref) plus click-to-copy for the portal. Confirm this is acceptable.