Adapted from Ride Primetime’s company article. Prepared with AI drafting assistance. The code and tests below are synthetic design examples, not deployed dispatch behavior.
A rider needs to reach a building by 9 a.m. They need a ride home, but the appointment end time is unknown. If the input is just an optional return time, a blank could mean one way, return needed with no time yet, or a field the rider skipped. Those meanings should not share one value.
Capture what the rider knows
Use a tagged union. A one-way request has no return time. A discussed-later return intentionally has no time. A timed return has a time. Keep these as request facts. Availability and agreement are separate evidence from the provider.
type ReturnPlan =
| { kind: "one-way" }
| { kind: "return-time-unknown" }
| { kind: "return-time-requested"; at: string };
type Confirmation = { outbound: boolean; return: boolean };
function summary(plan: ReturnPlan, confirmed: Confirmation) {
const outbound = confirmed.outbound
? "Outbound confirmed"
: "Outbound needs confirmation";
if (plan.kind === "one-way") return outbound;
const back = confirmed.return
? "Return confirmed"
: plan.kind === "return-time-unknown"
? "Return requested; discuss timing and pickup"
: "Return time requested; needs confirmation";
return `${outbound}. ${back}.`;
}
The booleans in this simplified display example represent verified provider decisions for this same request revision, not values supplied by the form. In a real system, match each decision to the relevant leg and current revision before building the read model. A form receipt is not that evidence. Validate actual time and timezone at the server boundary; don’t insert a default to make the UI look complete.
Test the meaning, not just whether a label renders
- One way plus no confirmed legs: “Outbound needs confirmation,” with no return label.
- Unknown return plus confirmed outbound: show both the confirmed outbound and the unresolved return.
- Requested return time with no provider decision: still needs confirmation; the presence of a time proves nothing about availability.
- Change a previously confirmed pickup: invalidate the affected decision before showing status for that revision; test that a late response for the old revision cannot restore it.
Use fictional data. Log the status transitions in a test trace without putting phone numbers, addresses or appointment details into analytics. W3C’s notification guidance is useful for making the outcome and next step understandable in the interface.
Read the exact Ride Primetime original on improving medical transportation software for the operational context. Published from Jeremy Nwokorie’s account on behalf of Ride Primetime.
Top comments (0)