Technical writing
Articles and engineering notes
Notes from Adrian Zevenster on production problems, design choices, and the trade-offs behind machine learning and AI systems.
The interactive view couldn’t load.
CueSense is live on iOS
You can now use CueSense on iPhone to turn a spoken thought into a note, reminder, or plan. Tap the orb and speak, or type it in. Download CueSense on the App Store.
How a signed clinical report survives the next edit
Imagine that a clinician signs a report on Friday and releases a workbook for an agreed activity. On Monday, the clinician spots an ambiguity in the report and reopens it. The patient has already written about the activity over the weekend. Which PDF should appear when they open Friday’s workbook? In the Clinical Assessment Platform, they get Friday’s PDF. Monday’s correction can have a release of its own. This fictional sequence explains several choices in the self-hosted reporting workspace, from the first receipt through to a reply from the clinician.
Explore the Clinical Assessment Platform
Give a submitted questionnaire a durable identity
A connection can disappear between saving an assessment and showing the patient their receipt.
A patient who presses Submit again needs the original receipt. Another patient, or the same person returning a month later, may legitimately give the same answers. Comparing the scores cannot distinguish those situations. The client assigns the completion an identifier. The server pairs it with a digest of the form identity, version and submitted fields. A retry with matching content gets the same reference and recorded time. Reusing the identifier with changed content raises a conflict.
The server prepares the original PDF and commits its bytes, digest and submission snapshot together with the initial review record. Two simultaneous submissions compete on the same unique identifier. Even across application instances, the database admits one completion. A failed archive leaves the patient free to retry. A public receipt contains the reference and time. Opening the clinical record requires its own staff session.
Let two tabs disagree about a draft
A reviewer can open a draft before a colleague changes it. Rendering the PDF creates another opportunity for the draft to go stale.
Every edit carries the revision the clinician opened. On save, the service locks the review, rechecks the staff session and compares the expected revision with the stored one. If two tabs submit edits to the same revision, one succeeds and the other receives a conflict. The second clinician has to reload and decide how to carry their wording forward. That interruption is preferable to silently losing the first clinician’s change.
The same issue arises when someone previews the PDF. Rendering takes time. A clinician can finish an edit while a preview of the earlier wording is still being prepared. The server checks the revision again after rendering and before sending the preview. One test deliberately holds the renderer open, saves an edit, then releases the renderer. The preview receives a conflict and the activity history records no completed export.
Make a correction possible after release
Sign-off records the reviewer, time, reviewed wording and exact PDF. Reopening gives the next edit a place of its own.
A report regenerated next year could look different after a font or template update, even if its answers and wording stayed the same. At sign-off I keep the rendered bytes with their SHA-256 digest. When staff reopen the report, the service checks that digest, copies the signed revision into history and opens the editable review in one transaction. If either change fails, the transaction rolls back.
A request for a specific signed revision reads the current and archived versions in one database snapshot and verifies the bytes before serving them. That detail matters during reopening. Two independent lookups could search the archive before the move and the current review after it, missing a document that existed the entire time. Retaining signed PDFs costs storage and adds sensitive material to the practice’s backup responsibility. It also lets a clinician retrieve the document they actually signed.
Release the workbook against one signed revision
Clinical sign-off, patient access and the activity a patient agrees to each have a separate point of decision.
The signing clinician chooses the reviewed revision, confirms the intended recipient and records the agreed activity, goal, review date and practice contact. The release stores a copy of the signed PDF. An invitation and activation code establish access to that workbook. In the Friday example, the patient can reopen the report that accompanied the activity even while the practice prepares the correction.
Respondent identity matters here. A child’s self-report and a caregiver’s account can describe the same child from different perspectives. The paediatric workflow keeps those series separate. For a proxy release the clinician verifies the recorded caregiver’s identity and authority. Comparing two proxy reports also requires the same caregiver. Grouping solely by the child’s practice code would produce a plausible-looking comparison between answers supplied by two different people.
Preserve the version the patient chose to share
A private amendment, a shared observation and a clinician’s reply have different readers.
Suppose the patient shares a Saturday observation, then adds a private sentence on Sunday. The clinician can still read the Saturday version. Saving a private amendment never publishes the new sentence. When the patient chooses to share an updated version, that revision becomes available for review. A reply records the specific entry revisions and activity versions the clinician saw. If the clinician adapts the activity, earlier observations retain the earlier instructions.
For assisted workbook review, the application computes counts from shared entries and prepares possible observations and questions. A private model can select up to three of the offered options by code. Application code supplies the wording and links it to the entries. An unknown option, an unavailable model or a mismatch with the configured model digest returns a labelled template. The clinician writes and publishes the patient-facing reply. A day with no shared entry remains a day for which the reviewer has no observation.
Handle the email whose answer never comes back
A saved report, a mail relay accepting the attachment and a patient reading it are three different events.
Email starts with a separate preview of the recipient, wording and attachment. The practice can sign and archive a report before anyone chooses to send it. If the relay explicitly rejects a message, the service has evidence that it can be retried. If the connection drops after transmission, the relay may already have accepted it. Automatically retrying at that point risks sending a sensitive attachment twice.
The delivery history preserves that uncertain outcome for reconciliation. An operator can use the relay’s evidence to resolve the attempt. A positive acceptance record describes what the relay acknowledged. The patient may still have an unread message. Collapsing those states into a single green “sent” label would give staff a very different account of what happened.
Test the handoffs a person depends on
Synthetic records let the tests exercise concurrency, correction and privacy without disclosing anyone’s assessment.
The reporting tests drive concurrent saves through the HTTP handlers, change drafts during PDF rendering, and compare downloaded bytes with the archived versions. Workbook tests release a report, clear the current review’s PDF and check that the patient can still download the released bytes. Other cases try access from a different workbook, make a private amendment after sharing and verify that the clinician sees only the revision shared with them.
These checks establish software behaviour. A separate question for a practice pilot is whether people understand it. I would give a clinician and a patient the fictional Friday report, ask the clinician to correct it, and ask both people to locate the version the patient had over the weekend. Then I would ask the patient to amend an observation privately and predict what the clinician could see. Their answers would tell us whether the interface communicates the distinctions the database preserves.
Building a clinical assessment platform that keeps scores reproducible
Two fictional assessments both score 10/42, yet individual answers move in opposite directions. Follow those changes back to the submitted form and see how six different questionnaires become illustrated staff reports. The case study includes anonymised PDF excerpts, a sensory guide with a weekly tracker, and the checks on private model-assisted drafts. View the practice website project.
Report excerpts and application screenshots
- The questionnaire selector showing six assessment choices, including executive skills and musculoskeletal pain.
- 8 Dimensions of Wellness report with eight fictional dimension totals ranging from 24 to 29 on scales of 10–40.
- Staff dashboard showing the DASS-21 scale from 0 to 42 and Secure Flourish scale from 0 to 10.
- Fictional DASS-21 report showing depression 10, anxiety 6 and stress 8, each on a 0–42 scale.
- Fictional ESQ-R report with a total of 41/75 and five skill-area means on a 0–3 scale.
- Fictional Örebro report showing 99 on a scale of 4–210, followed by clinician questions about pain episodes and sleep.
- Weekly tracker in the fictional Sensory Guide with Monday–Sunday columns, suggested activities and spaces for the reader’s own choices.
- Earlier clinician review screen labelled “Template draft. The model was unavailable.” Two supporting answers are expanded.
- Fictional report showing a Flourish Index of 4.7/10 and a Secure Flourish Index of 4.33/10.
Topics
- Designing isolated, identity-aware generative-media workflows on Google Cloud.
- Building regression frameworks for stochastic LLM extraction.
- Separating processing status from business decisions in document verification.
- Designing extraction systems for large, inconsistent bank statements.
- Running Gemini extraction across prompts, schemas, parsers, confidence, and observability.
- Building an analyst agent that validates proposed actions and reports incomplete execution.
- Building private AI with verified sources and reviewed actions in CueSense. Get CueSense on Google Play or download CueSense on the App Store.