The scenario: a normalized date loses the evidence that explains it
An uploaded document has several possible dates: its printed date, the moment the photo was captured, its upload time and the time an automated reader processed it. Those values answer different questions. A timeline that substitutes one for another can look precise while saying something the source never established.
This Movo-X case follows the date pair that crosses the episode API: a normalized calendar day and the text quoted from the document. It traces the pinned reading validator, the episode-detail projection and portable Swift decoding. The research uses synthetic date-only documents, with no patient images or medicine instructions.
Keep the normalized value beside its quoted source
The reading structure carries documentDate and documentDateText separately. The inspected provider prompt asks for a printed or written date, requests its exact text and prohibits filling it from today or context. That instruction is an intended extraction rule, not proof that a provider always follows it.
The parser adds deterministic checks. It accepts a candidate only with quoted text, validates a real calendar day within its configured range and checks selected numeric components against that text. A date without supporting text is dropped. These checks constrain representation; they cannot certify whether an image actually contains the quote or whether every language and date format is correctly interpreted.
An ambiguity flag is different from a resolved interpretation
A purely numeric text can support more than one day/month interpretation. The inspected parser marks selected numeric forms ambiguous when the initial two components are different and both can be months. A normalized candidate can therefore remain present while the reading carries an ambiguity flag.
The prompt asks the provider to leave an ambiguous normalized date empty, but the parser also handles a provider that supplied one. The synthetic case deliberately exercises that latter path. The result is review evidence rather than a demonstrated resolution of the date order. Do not describe a flagged candidate as a confirmed date merely because it satisfies calendar syntax.
Trace the endpoint projection before declaring a missing field
The shared import-record builder assembles normalized document fields. Examining that structure alone can suggest that quoted source text has been lost. The episode-detail endpoint performs a further projection: it joins stored reading text back into each output document by attachment identity and emits it as dateText.
That endpoint step matters to the actual wire contract. The supplemental fixture supplies stored readings in a different order from the authorized photo list, then checks that each projected date still receives its own quoted text. A positional merge could pass a simple same-order example and silently attach another document’s evidence after sorting.
Use the actual server output as the native input
The research harness calls the pinned episode projection with synthetic metadata and writes the resulting JSON. A separate portable Swift test consumes those exact bytes through EpisodeDetail decoding. This bridges the two implementations more directly than independently writing matching examples in two languages.
The example contains a clear date with a month word, an ambiguous numeric date, a candidate without quoted text and unclear text without a normalized day. The server test checks attachment ordering, joined text, conflict flags and null capture-time fields. The Swift consumer checks the four resulting date-display states. Neither harness contacts the database or an extraction provider.
Understand the native decoder’s defensive boundary
The Swift wire decoder retains a normalized document date only when it is a real calendar day and nonblank dateText is present. It preserves the supplied conflict flag. Its printedDate representation distinguishes a normalized date with evidence, unclear source text and the absence of usable date evidence.
Additional synthetic wire examples exercise an impossible calendar day and whitespace-only evidence. This describes the decoding path specifically: the public in-memory initializer can be constructed directly and is not the same validation boundary. A state named notPrinted also cannot prove that the original image has no printed date; it can result from absent or rejected response evidence.
Keep upload chronology and unread records separate
The inspected episode projection emits null captureTime for these document records and does not replace missing printed dates with upload timestamps. A separate synthetic case keeps the merged record null when there are no stored readings, even when an upload timestamp is available.
That prevents an unread attachment from masquerading as an extracted document record. The interface can still display upload chronology with an accurate label. It should not silently use that timestamp as the document date. The evidence reviewed here concerns response and decoding behaviour; actual screen wording and visual treatment need their own app-interface review.
A useful date-provenance acceptance package
Keep an attachment-keyed fixture with deliberately reordered inputs, the projected JSON and assertions in each consuming client. Include missing evidence, unclear text, impossible dates and ambiguity. Record whether a check covers extraction, projection, wire decoding or presentation so a passing result is attributed to the right boundary.
For a CTO, this creates a repeatable contract between server and app without claiming that a small fixture set validates clinical extraction. The selected source and synthetic checks explain how evidence survives this path. Database permissions, provider accuracy, real device presentation and the full variety of document formats retain separate acceptance.
Compare the reviewed boundaries
What each date state establishes
On smaller screens, scroll across to compare every column. Keyboard users can focus the table and use the arrow keys.
| Wire evidence | Portable Swift result | Still needs review |
|---|---|---|
| Valid day and quoted text | Printed date representation | Accuracy against original document |
| Numeric candidate with conflict flag | Printed representation marked swappable | Actual day/month interpretation |
| Unclear text without a valid day | Unclear text retained | Human reading of source |
| Missing or blank quoted text | Normalized day discarded | Why source evidence is unavailable |
Illustrative control flow
Pseudocode summarizing the decision boundary. It is not copied production code or a deployment instruction.
reading = validate_candidate_and_quoted_text(provider_result)
record = merge_documents_by_attachment_identity(readings)
response = join_quoted_text_by_attachment_identity(record, readings)
native_detail = decode_exact_response_bytes(response)
assert_date_states(native_detail)
# Upload time and extraction time remain separate chronology.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 ↗