The scenario: finding the product leaves several decisions unresolved
Selecting a medicine from a catalogue identifies a product; it does not establish the patient-specific dosage, frequency, duration or route. A prescription editor needs to represent those remaining inputs rather than silently treating a successful search selection as a complete instruction. That distinction also matters when suggestions originate from an AI-assisted workflow.
The inspected Movo-X implementation shares a validation helper between two editors and the HTTP boundary. Six isolated cases examine selected completeness rules, numeric boundaries and dosage-form mapping. Every value is synthetic. The work evaluates software behaviour without issuing a prescription or judging a treatment.
Require the prescribing fields independently of the product identifier
The helper requires a nonempty item collection and a nonblank product identifier on each row. It separately requires dosage, frequency, duration and route as nonblank strings. Its error identifies the numbered medication and names the missing fields, explaining that catalogue selection does not fill those details.
The existing fixture supplies a selected product with missing dosage and duration and checks the resulting refusal. It also checks that a missing product on the second row is identified as medication two. These checks establish selected input completeness. They do not prove that an entered string describes an appropriate clinical instruction.
Bound collection size and text without claiming normalization
The helper caps a prescription at one hundred items and bounds the required text fields, with a different limit for route. Optional string instructions have their own limit. The supplemental fixture checks accepted endpoints and refusals immediately beyond selected item and text boundaries.
Validation returns an error string or null; it does not rewrite the input into a canonical prescription object. A fixture confirms that accepted strings, including surrounding spaces on a product identifier, remain unchanged. Trimming for a nonblank check is therefore different from normalizing every field before persistence. The downstream command must interpret and validate its own inputs.
Read the quantity rule as numeric validation with tolerance
The quantity check converts the supplied value with Number, requires a finite result above zero and no greater than one hundred thousand, and applies a small floating-point tolerance when checking thousandths. The supplemental fixture accepts selected endpoints and a numeric string, while refusing an unparseable string and values outside selected bounds.
This is a numerical rule rather than a strict decimal-text grammar or a rule that the original input must already have number type. The examples describe implementation limits only. A positive bounded quantity does not establish the right unit, an appropriate dose or a medically suitable amount for a particular patient.
Do not infer every administration route from dosage form
The catalogue-route helper lowercases a supplied form and maps a selected set of forms to broad route values. It clears the route for injection and drops because those forms alone do not identify their more specific administration route. For an unknown form it retains the supplied current route.
The fixtures exercise those distinctions, including case handling and selected mapped forms. This helper is not a full medicine knowledge base or a clinical route decision. Its result must be considered alongside the actual editor path: an explicitly supplied suggestion route can take a different path from a form-only catalogue selection.
Trace the actual catalogue-selection paths
In the prescriptions page, choosing a catalogue result retains the existing dosage and applies the dosage-form helper to the route. The editor combines its confirmed list and any current medication draft before running the shared completeness check. It also requires a patient and consultation context before submitting.
The modal has a separate path for suggested items that first need catalogue creation. It performs a preliminary check with a temporary product marker, checks the user’s catalogue-add capability and then attempts the catalogue request before building the final prescription request. These source branches are not evidence of a successful catalogue write or an atomic multi-step transaction.
Run the same basic guard at the HTTP command boundary
The inspected server route calls the shared item validator for prescription POST and PATCH requests. A validation issue returns a bad-request response before that branch calls the prescription command. The method selects issue or correct, and the server passes tenant, facility and request context to the authoritative operation.
This source placement avoids relying solely on the browser’s form check. The six executed cases exercise the helper, not that full authenticated handler or its database command. Catalogue ownership, clinician permission, encounter state, version rules and transactional persistence need their own authoritative acceptance tests.
Use error messages to preserve the unresolved decision
The helper’s errors distinguish choosing a catalogue item, entering missing fields, reducing an oversized value and correcting quantity. That gives the editor a specific reason to stop rather than replacing missing values with generic defaults to make a request pass.
Passing the helper still means only that these selected guards accepted the supplied representation. A value can be nonblank and within the text limit while being ambiguous or clinically inappropriate. The interface and professional workflow must preserve the distinction between completing a required field and confirming the meaning of its contents.
A practical prescription-input acceptance package
Keep deterministic fixtures for catalogue selection with missing details, row-specific errors, collection limits, numeric endpoints, route ambiguity and unchanged accepted input. Add editor interaction and authenticated command tests for the actual issue and correction journeys. Test pending catalogue creation and retry behaviour separately when that feature is in scope.
For a CTO, this case shows how a shared helper makes selected input rules consistent across interfaces while leaving authority with the command layer. The pinned source and six scoped cases establish the reviewed transformation boundaries. They do not certify clinical safety, current permissions, correct dispensing or production persistence.
Compare the reviewed boundaries
What each prescription boundary establishes
On smaller screens, scroll across to compare every column. Keyboard users can focus the table and use the arrow keys.
| Boundary | Selected evidence | Separate acceptance |
|---|---|---|
| Catalogue selection | Product choice does not supply every required detail | Correct product and patient-specific instruction |
| Shared validator | Collection, text and numeric rules | Semantic validity and canonical persistence |
| Route helper | Selected mappings and explicit ambiguous forms | Actual administration decision |
| HTTP branch | Guard precedes command call in source | Authenticated integration and database transaction |
Illustrative control flow
Pseudocode summarizing the decision boundary. It is not copied production code or a deployment instruction.
items = confirmed_items + current_medication_draft
issue = validate_selected_completeness_and_bounds(items)
if issue:
preserve_draft_and_show_specific_error(issue)
else:
request_authorized_issue_or_correction(items)
# A syntactically complete item is not a confirmed clinical decision.About this engineering series
Written by Omer Muneer Qazi from a review of Movo-X implementation and dated engineering records. This article explains source behaviour and historical observations; current production, clinical outcomes and store availability require their own verification. Examples are synthetic and proposed test cases are identified as such.
Explore the Movo-X engineering series → · Related implementation experience →
Discuss a similar engineering problem
Send the workflow, current platform and the decision your team needs to make. I can help define an implementation or review scope with concrete acceptance evidence.
Discuss your project on WhatsApp ↗