Skip to content

URS-020 · Duplicate Delivered Order Form (DOF / Bill-Only) Detection

Title: Duplicate Delivered Order Form (DOF / Bill-Only) Detection Date: 2026-04-23T03:37:55.647Z Duration: 129.1s Overall Status: ✅ PASS

The system shall detect potential duplicate DOFs using account, PO, patient ID, and procedure date.

Source: User_Requirement_Specifications_ZuriMED_DeviceFlow.xlsx — the run below proves the system meets this requirement.

The run below validates what the merged implementation actually does. The following bullets call out every place where the implementation differs from the URS wording so a reviewer reading them side-by-side does not mistake the spec text for the system behaviour.

  • PO number is not a duplicate-detection input. (see DF-2598) URS-020 lists PO number as a detection signal, but checkDuplicateBillingOrders (in modules/bill_only/src/services/billing-order-queries.ts) detects duplicates on sales_account_id + procedure_date only, scoped to the user’s organization. Patient ID and patient last name are used solely to annotate matched rows with the “(Same patient ID)” / “(Same last name)” badges — not as part of the primary match key. This is intentional: sales reps typically submit bill-onlies before the PO has arrived, so requiring PO in the match would silently disable detection for the common case. The test below exercises the merged behaviour (positive match on account+date, negative match when either differs) rather than the URS wording.

Status: ✅ PASS

Each step below corresponds to one Playwright test that ran sequentially. Screenshots and video recordings provide visual evidence of the UI behaviour.

1. Step 1: Login and open bill-only form — ✅ PASS

Section titled “1. Step 1: Login and open bill-only form — ✅ PASS”

What this step proves:

Bob Kauffman (StellarTech admin, has billing:create) signs in and opens the bill-only creation wizard. Establishes the user + permission context for every subsequent step.

Screenshots:

step 01 logged in

step 01 billing form step2

Video recording:


2. Step 2: Submit reference order — ✅ PASS

Section titled “2. Step 2: Submit reference order — ✅ PASS”

What this step proves:

Submits a bill-only order with the canonical reference values — BOSS Surgical account, procedure date 2026-04-15, patient PAT-URS020-001 / URS020TestLastName. No warning appears because no prior duplicate exists. This order becomes the match target for Step 3–5 and is persisted with the “URS-020 validation test” notes marker.

Audit events generated by this step:

(Evidence scoped to step execution window: 2026-04-23T03:38:15.134Z → 2026-04-23T03:38:25.699Z)

TimeTypeActionUserOrgPerformed
2026-04-23 03:38:22Zdecisionbill_only_order.enqueue_upload_classificationbob.kauffman@stellartech.comZuriMEDno
2026-04-23 03:38:24Ztransactional_emailnew_bill_onlyStellarTech Medical Solutions

Emails triggered by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

Email 1: New Bill-Only Order - 2/22/2026 - ZuriMED BO-1

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-1

New Bill-Only Order - 2/22/2026 - ZuriMED BO-1

Email 2: New Bill-Only Order - 2/22/2026 - ZuriMED BO-2

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-2

New Bill-Only Order - 2/22/2026 - ZuriMED BO-2

Email 3: New Bill-Only Order - 2/22/2026 - ZuriMED BO-3

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-3

New Bill-Only Order - 2/22/2026 - ZuriMED BO-3

Email 4: New Bill-Only Order - 2/17/2026 - ZuriMED BO-4

Template: New_Bill-Only_Order_-_2_17_2026_-_ZuriMED_BO-4

New Bill-Only Order - 2/17/2026 - ZuriMED BO-4

Screenshots:

step 02 reference step2

step 02 reference review

step 02 reference submitted

Video recording:


3. Step 3: Duplicate warning with both badges — ✅ PASS

Section titled “3. Step 3: Duplicate warning with both badges — ✅ PASS”

What this step proves:

Re-entering the reference account + procedure date + patient ID + last name triggers “Possible Duplicate Submission”. Both “(Same patient ID)” and “(Same last name)” badges render because the match row shares those annotation fields. Clicking “This is not a duplicate — continue” unlocks step advancement and the submission then completes end-to-end — proving duplicate detection is a soft block the user can acknowledge and override, and giving the DB a second row that shares the full (account, date, patient ID, last name) key with the reference order.

Audit events generated by this step:

(Evidence scoped to step execution window: 2026-04-23T03:38:37.192Z → 2026-04-23T03:38:49.206Z)

TimeTypeActionUserOrgPerformed
2026-04-23 03:38:48Zdecisionbill_only_order.enqueue_upload_classificationbob.kauffman@stellartech.comZuriMEDno
2026-04-23 03:38:49Ztransactional_emailnew_bill_onlyStellarTech Medical Solutions

Emails triggered by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

Email 1: New Bill-Only Order - 2/22/2026 - ZuriMED BO-1

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-1

New Bill-Only Order - 2/22/2026 - ZuriMED BO-1

Email 2: New Bill-Only Order - 2/22/2026 - ZuriMED BO-2

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-2

New Bill-Only Order - 2/22/2026 - ZuriMED BO-2

Email 3: New Bill-Only Order - 2/22/2026 - ZuriMED BO-3

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-3

New Bill-Only Order - 2/22/2026 - ZuriMED BO-3

Email 4: New Bill-Only Order - 2/17/2026 - ZuriMED BO-4

Template: New_Bill-Only_Order_-_2_17_2026_-_ZuriMED_BO-4

New Bill-Only Order - 2/17/2026 - ZuriMED BO-4

Screenshots:

step 03 warning with both badges

step 03 duplicate submitted

Video recording:


4. Step 4: Change date — warning hides — ✅ PASS

Section titled “4. Step 4: Change date — warning hides — ✅ PASS”

What this step proves:

Switching procedure date from 2026-04-15 to 2026-04-10 dismisses the warning because the primary match key (sales_account_id, procedure_date) no longer matches. Reverting the date brings the warning back — confirms the check is live-driven by form state, not cached server-side.

Screenshots:

step 04 alternate date no warning

step 04 date restored warning

Video recording:


5. Step 5: Clear patient ID — badge hides, warning remains — ✅ PASS

Section titled “5. Step 5: Clear patient ID — badge hides, warning remains — ✅ PASS”

What this step proves:

Clearing the patient ID field while leaving account + procedure date intact keeps the “Possible Duplicate Submission” warning (primary key still hits) but drops the “(Same patient ID)” badge — proving patient_id is only an annotation, not part of the primary match, while last-name match still annotates.

Screenshots:

step 05 warning last name only

Video recording:


6. Step 6: Different account, same date — no warning — ✅ PASS

Section titled “6. Step 6: Different account, same date — no warning — ✅ PASS”

What this step proves:

Submits a bill-only for a DIFFERENT sales account (“Copley Hospital Account Request”) on the reference procedure date (2026-04-15) with the same patient ID + last name as the reference. No warning appears and the order submits cleanly — proving that changing sales_account_id alone is sufficient to escape detection, even when every other field matches the reference row. This is the symmetric negative counterpart to Step 4: Step 4 proves date-variation escapes detection; Step 6 proves account-variation does too.

Audit events generated by this step:

(Evidence scoped to step execution window: 2026-04-23T03:39:30.501Z → 2026-04-23T03:39:38.614Z)

TimeTypeActionUserOrgPerformed
2026-04-23 03:39:36Zdecisionbill_only_order.enqueue_upload_classificationbob.kauffman@stellartech.comZuriMEDno
2026-04-23 03:39:37Ztransactional_emailnew_bill_onlyStellarTech Medical Solutions

Emails triggered by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

Email 1: New Bill-Only Order - 2/22/2026 - ZuriMED BO-1

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-1

New Bill-Only Order - 2/22/2026 - ZuriMED BO-1

Email 2: New Bill-Only Order - 2/22/2026 - ZuriMED BO-2

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-2

New Bill-Only Order - 2/22/2026 - ZuriMED BO-2

Email 3: New Bill-Only Order - 2/22/2026 - ZuriMED BO-3

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-3

New Bill-Only Order - 2/22/2026 - ZuriMED BO-3

Email 4: New Bill-Only Order - 2/17/2026 - ZuriMED BO-4

Template: New_Bill-Only_Order_-_2_17_2026_-_ZuriMED_BO-4

New Bill-Only Order - 2/17/2026 - ZuriMED BO-4

Screenshots:

step 06 different account no warning

step 06 different account submitted

Video recording:


7. Step 7: Non-duplicate and verify billing list — ✅ PASS

Section titled “7. Step 7: Non-duplicate and verify billing list — ✅ PASS”

What this step proves:

Creates a fourth order with the SAME account + patient but the alternate procedure date (2026-04-10). No warning appears and the order submits without any acknowledgement. The billing list is then asserted to display every URS-020 PO number (reference, acknowledged duplicate, different-account negative, alternate-date non-duplicate) — proving every submission from this run landed in the shared view the next operator would see. (The list itself does not render a row-level duplicate indicator — the warning is a creation-time UX only; see README “Known Deviations”.)

Audit events generated by this step:

(Evidence scoped to step execution window: 2026-04-23T03:39:49.371Z → 2026-04-23T03:39:58.458Z)

TimeTypeActionUserOrgPerformed
2026-04-23 03:39:54Zdecisionbill_only_order.enqueue_upload_classificationbob.kauffman@stellartech.comZuriMEDno
2026-04-23 03:39:56Ztransactional_emailnew_bill_onlyStellarTech Medical Solutions

Emails triggered by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

Email 1: New Bill-Only Order - 2/22/2026 - ZuriMED BO-1

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-1

New Bill-Only Order - 2/22/2026 - ZuriMED BO-1

Email 2: New Bill-Only Order - 2/22/2026 - ZuriMED BO-2

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-2

New Bill-Only Order - 2/22/2026 - ZuriMED BO-2

Email 3: New Bill-Only Order - 2/22/2026 - ZuriMED BO-3

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-3

New Bill-Only Order - 2/22/2026 - ZuriMED BO-3

Email 4: New Bill-Only Order - 2/17/2026 - ZuriMED BO-4

Template: New_Bill-Only_Order_-_2_17_2026_-_ZuriMED_BO-4

New Bill-Only Order - 2/17/2026 - ZuriMED BO-4

Screenshots:

step 07 non duplicate step2

step 07 non duplicate submitted

step 07 billing list

Video recording:


The following SQL queries ran against the application database after the Playwright scenarios completed. Each query asserts a specific condition that proves the feature under test persisted its data correctly.

Four URS-020 billing orders created — ✅ PASS

Section titled “Four URS-020 billing orders created — ✅ PASS”

Assertion: Playwright submitted four bill-only orders — reference, acknowledged duplicate, different-account negative case, and alternate-date non-duplicate — all tagged with the URS-020 marker.

SELECT id, order_number, sales_account_id, procedure_date,
patient_id, patient_last_name, po_number, status, notes, created_at
FROM billing_orders
WHERE created_by_user_id = $1
AND notes LIKE $2
ORDER BY created_at ASC
idorder_numbersales_account_idprocedure_datepatient_idpatient_last_namepo_numberstatusnotescreated_at
019db86a-d7fe-753d-8926-cd3ea0283a46BO-1fea7b8c9-d0e1-2345-0123-4567890123452026-02-22T06:00:00.000ZPAT-URS020-001URS020TestLastNamePO-URS020-REFsubmittedURS-020 validation test — reference order2026-04-23T03:38:22.955Z
019db86b-3d3a-710f-a9a6-6b7d12e367bcBO-2fea7b8c9-d0e1-2345-0123-4567890123452026-02-22T06:00:00.000ZPAT-URS020-001URS020TestLastNamePO-URS020-DUPsubmittedURS-020 validation test — acknowledged duplicate2026-04-23T03:38:48.971Z
019db86b-f54a-78cc-a3a6-1de605efb9d9BO-31fb8c9d0-e1f2-3456-1234-5678901234562026-02-22T06:00:00.000ZPAT-URS020-001URS020TestLastNamePO-URS020-ALTACCTsubmittedURS-020 validation test — different account negative case2026-04-23T03:39:36.118Z
019db86c-3ed2-76c3-a0ef-7d693cc2e8caBO-4fea7b8c9-d0e1-2345-0123-4567890123452026-02-17T06:00:00.000ZPAT-URS020-001URS020TestLastNamePO-URS020-NONEsubmittedURS-020 validation test — non-duplicate (alternate procedure date)2026-04-23T03:39:54.931Z

Duplicate pair shares account + procedure date — ✅ PASS

Section titled “Duplicate pair shares account + procedure date — ✅ PASS”

Assertion: Two URS-020 orders must share the reference sales account and procedure date; that is exactly what checkDuplicateBillingOrders uses as its primary key.

SELECT id, order_number, po_number, patient_id, patient_last_name, created_at
FROM billing_orders
WHERE created_by_user_id = $1
AND notes LIKE $2
AND sales_account_id = $3
AND procedure_date = $4
ORDER BY created_at ASC
idorder_numberpo_numberpatient_idpatient_last_namecreated_at
019db86a-d7fe-753d-8926-cd3ea0283a46BO-1PO-URS020-REFPAT-URS020-001URS020TestLastName2026-04-23T03:38:22.955Z
019db86b-3d3a-710f-a9a6-6b7d12e367bcBO-2PO-URS020-DUPPAT-URS020-001URS020TestLastName2026-04-23T03:38:48.971Z

Alternate-date order: same account, different date (no warning) — ✅ PASS

Section titled “Alternate-date order: same account, different date (no warning) — ✅ PASS”

Assertion: A URS-020 order must exist with the reference sales account but the alternate procedure date. The UI rendered no warning at submission time — evidence that changing procedure_date alone is sufficient to escape duplicate detection.

SELECT id, order_number, po_number, sales_account_id, procedure_date
FROM billing_orders
WHERE created_by_user_id = $1
AND notes LIKE $2
AND sales_account_id = $3
AND procedure_date = $4
idorder_numberpo_numbersales_account_idprocedure_date
019db86c-3ed2-76c3-a0ef-7d693cc2e8caBO-4PO-URS020-NONEfea7b8c9-d0e1-2345-0123-4567890123452026-02-17T06:00:00.000Z

Different-account order: other account, same date (no warning) — ✅ PASS

Section titled “Different-account order: other account, same date (no warning) — ✅ PASS”

Assertion: A URS-020 order must exist with the alternate sales account (Copley) on the reference procedure date. The UI rendered no warning at submission time — evidence that changing sales_account_id alone is sufficient to escape duplicate detection, proving account is a primary-key element and the detection key is symmetric in account and date.

SELECT id, order_number, po_number, sales_account_id, procedure_date
FROM billing_orders
WHERE created_by_user_id = $1
AND notes LIKE $2
AND sales_account_id = $3
AND procedure_date = $4
idorder_numberpo_numbersales_account_idprocedure_date
019db86b-f54a-78cc-a3a6-1de605efb9d9BO-3PO-URS020-ALTACCT1fb8c9d0-e1f2-3456-1234-5678901234562026-02-22T06:00:00.000Z

Duplicate pair also matches patient ID and last name — ✅ PASS

Section titled “Duplicate pair also matches patient ID and last name — ✅ PASS”

Assertion: Both duplicate-pair orders carry the reference patient ID and patient last name so the warning surfaced both “(Same patient ID)” and “(Same last name)” badges.

SELECT COUNT(*) AS n
FROM billing_orders
WHERE created_by_user_id = $1
AND notes LIKE $2
AND sales_account_id = $3
AND procedure_date = $4
AND patient_id = $5
AND patient_last_name = $6
n
2

Per-declaration outcome of every expectedAuditActions and expectedEmailTemplates entry written into the orchestrator. Missing evidence here is a real test failure, not a soft warning.

Each row asserts that a declared expectedAuditActions entry produced a matching row in audit_events. A ❌ flips overall status to FAIL — the declaration is real proof, not just an annotation.

StepExpected Audit ActionFound
Step 2: Submit reference orderdecision:bill_only_order.enqueue_upload_classification
Step 3: Duplicate warning with both badgesdecision:bill_only_order.enqueue_upload_classification
Step 6: Different account, same date — no warningdecision:bill_only_order.enqueue_upload_classification
Step 7: Non-duplicate and verify billing listdecision:bill_only_order.enqueue_upload_classification

Each row asserts that a declared expectedEmailTemplates entry was matched (case-insensitive substring) by a captured email subject or template. A ❌ flips overall status to FAIL.

StepExpected TemplateFound
Step 2: Submit reference orderbill-only
Step 3: Duplicate warning with both badgesbill-only
Step 6: Different account, same date — no warningbill-only
Step 7: Non-duplicate and verify billing listbill-only

Every row written to audit_events while this test was running (scoped to the demo organizations). Provides compliance evidence that user actions are traced end-to-end (URS-003).

Capture window start: 2026-04-23T03:37:53.715Z

SELECT
ae.created_at,
ae.event_type,
ae.action,
ae.user_id,
u.email AS user_email,
ae.organization_id,
o.name AS organization_name,
ae.object_id,
ae.secondary_object_id,
ae.payload,
ae.route,
ae.trace_id
FROM audit_events ae
LEFT JOIN users u ON u.id = ae.user_id
LEFT JOIN organizations o ON o.id = ae.organization_id
WHERE ae.created_at >= $1
AND ae.organization_id = ANY($2::uuid[])
ORDER BY ae.created_at ASC

15 event(s) captured:

TimeTypeActionUserOrgObject IDPerformedReason
2026-04-23 03:37:58Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:38:05Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:38:22Zdecisionbill_only_order.enqueue_upload_classificationbob.kauffman@stellartech.comZuriMED019db86a-d7fe-753d-8926-cd3ea0283a46noNo uploaded PO documents
2026-04-23 03:38:24Ztransactional_emailnew_bill_onlyStellarTech Medical Solutions019db86a-d7fe-753d-8926-cd3ea0283a46
2026-04-23 03:38:27Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:38:48Zdecisionbill_only_order.enqueue_upload_classificationbob.kauffman@stellartech.comZuriMED019db86b-3d3a-710f-a9a6-6b7d12e367bcnoNo uploaded PO documents
2026-04-23 03:38:49Ztransactional_emailnew_bill_onlyStellarTech Medical Solutions019db86b-3d3a-710f-a9a6-6b7d12e367bc
2026-04-23 03:38:50Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:39:05Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:39:22Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:39:36Zdecisionbill_only_order.enqueue_upload_classificationbob.kauffman@stellartech.comZuriMED019db86b-f54a-78cc-a3a6-1de605efb9d9noNo uploaded PO documents
2026-04-23 03:39:37Ztransactional_emailnew_bill_onlyStellarTech Medical Solutions019db86b-f54a-78cc-a3a6-1de605efb9d9
2026-04-23 03:39:39Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:39:54Zdecisionbill_only_order.enqueue_upload_classificationbob.kauffman@stellartech.comZuriMED019db86c-3ed2-76c3-a0ef-7d693cc2e8canoNo uploaded PO documents
2026-04-23 03:39:56Ztransactional_emailnew_bill_onlyStellarTech Medical Solutions019db86c-3ed2-76c3-a0ef-7d693cc2e8ca

4 notification email(s) were captured during this test run. Each email is rendered as a screenshot for compliance review.

1. New Bill-Only Order - 2/22/2026 - ZuriMED BO-1

Section titled “1. New Bill-Only Order - 2/22/2026 - ZuriMED BO-1”

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-1

New Bill-Only Order - 2/22/2026 - ZuriMED BO-1

2. New Bill-Only Order - 2/22/2026 - ZuriMED BO-2

Section titled “2. New Bill-Only Order - 2/22/2026 - ZuriMED BO-2”

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-2

New Bill-Only Order - 2/22/2026 - ZuriMED BO-2

3. New Bill-Only Order - 2/22/2026 - ZuriMED BO-3

Section titled “3. New Bill-Only Order - 2/22/2026 - ZuriMED BO-3”

Template: New_Bill-Only_Order_-_2_22_2026_-_ZuriMED_BO-3

New Bill-Only Order - 2/22/2026 - ZuriMED BO-3

4. New Bill-Only Order - 2/17/2026 - ZuriMED BO-4

Section titled “4. New Bill-Only Order - 2/17/2026 - ZuriMED BO-4”

Template: New_Bill-Only_Order_-_2_17_2026_-_ZuriMED_BO-4

New Bill-Only Order - 2/17/2026 - ZuriMED BO-4