Skip to content

[docs] Report templates for 3.1 - #140

Draft
billjohnc wants to merge 2 commits into
mainfrom
docs/report-template-b7c5
Draft

billjohnc wants to merge 2 commits into
mainfrom
docs/report-template-b7c5

Conversation

@billjohnc

@billjohnc billjohnc commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Refreshes the Care 3.1 report template pages: the concept, the five existing flows, the reference, and two new flows (Print a report, Archive a report). Written with the Ezhuthachan skill. Supersedes the earlier draft #74, which put these pages under definitions and predates the 29 Nov report viewer rework.

Pages (version 3.1 only)

Page Change
concepts/platform/report-template.mdx Rewritten
flows/platform/report-template/view-report-templates.mdx Rewritten
flows/platform/report-template/create-a-report-template.mdx Rewritten
flows/platform/report-template/preview-a-template.mdx Rewritten
flows/platform/report-template/edit-a-report-template.mdx Rewritten
flows/platform/report-template/generate-and-view-a-report.mdx Rewritten, path kept (#109, #126 and #129 link it)
flows/platform/report-template/print-a-report.mdx New
flows/platform/report-template/archive-a-report.mdx New
references/platform/report.mdx Rewritten
versioned_sidebars/version-3.1-sidebars.json Two lines appended inside the existing "Report Template" category; nothing reordered

Version 3.0 has no report template concept or flows; its references/platform/report.mdx is left as it is (not verified against 3.0).

Verified against

  • care develop at ddfd840db (23 Nov 2026) and care_fe develop at abf394594 (30 Nov 2026), which includes care_fe 6a40c4913 (ReportViewer and routes reworked around associatingId and reportType: reports from an encounter, a patient and a billing account) and ecba1c7a4 (print without running report scripts).
  • Every statement was checked against that code (386 facts with file and line, kept in the session). Permission paths were traced from sign-in to save.
  • Runtime, on a local stack with invented data only (care ddfd840 backend, care_fe abf394594 frontend): a Doctor and a Nurse get "can_write_template" in the facility's permissions, so they see Create Template, but the template schema call returns 403 for them; a Facility Admin gets it.
  • Recorded on that stack: one narrated video and 3 to 9 screenshots per flow (38 screenshots, 7 videos, static/media/platform/report-template/). Template flows as Rohan Kapoor (Facility Admin, Administration); report flows as Dr. Meera Iyer (Doctor, General Medicine). Every API call went to the local backend; no call returned 4xx; the calls match each page's Permissions table (plus the shell calls every page makes). Patient names, identifiers and the report frame are blurred in the browser while recording.

What changed since the pages on main (12 Aug)

  • Reports are generated from three places: an encounter (Discharge Summary, from Files > Reports > Generate Report, and the Overview side panel's Reports tab), a patient (Patient Summary, the patient's Files > Reports), and a billing account (Account Report, the account's Reports tab or its ⋮ menu while the account is active). Main said reports live in the Overview tab's Reports section.
  • The report viewer opens the latest report when one exists and generates only when none exists; Regenerate makes a new version; Report History lists earlier ones.
  • Only PDF reports open and print in Care; HTML reports can only be downloaded (billjohnc: say so and advise PDF for printable templates).
  • Creating and editing a template needs "Can Create Template on Facility" in the facility's root organization (Administration); the builder also needs "Can View Template Schema", and preview "Can Preview Template", which by default only Facility Admin holds. So by default a Facility Admin builds templates. Main listed Doctor and Nurse without these conditions.
  • Generating for a completed, cancelled, discontinued or entered-in-error encounter needs "Can generate report for completed encounter" (Facility Admin by default); for any other status "Update Encounter non clinical". Account reports need "Can Update Account". Patient Summaries need a role on the patient.
  • Corrected labels and rules from main: slug 5 to 50 characters with letters, digits, - and _ (main said 5 to 25, lowercase only); Preview Template, Save Template, Template HTML, Select Context; no Description field in the builder; the status filter calls Retired "Archived".
  • "Admin" is left out of permission tables (not a default facility role). Instance-wide templates (no facility) are superuser-only and are not described in the user pages; no facility screen lists them, because the template list filters on the facility.

Related open PRs

Where the pages differ from the house style on purpose

  • Language: Simplified Technical English rules in steps, prerequisites and outcomes; plain English in explanations.
  • Versions: written for 3.1 only, the version whose code was verified.
  • Permissions: each table covers the whole path to the action (seeing the menu entry, listing, opening, and saving), with where each permission must be held.
  • The concept keeps the Permissions and Where to find it sections the page on main has, and adds "Report templates and print templates".
  • The generate flow groups its variants (encounter, Overview panel, patient, account, report list) as lettered sections with continuous step numbers.
  • Media: each recorded flow has a video under Overview with a captions track, and screenshots after the steps they show, as other 3.1 flow pages have them. The generate video covers its encounter steps 1 to 7; the print video holds on the report viewer for the last step, because a headless browser does not draw the browser's print dialog.
  • Narration: the voice reads a short script per step, the step and a sentence or two of context from the page, and the subtitles show what it says. It is AI-generated with ElevenLabs (model eleven_v4), in two cloned voices taking turns flow by flow in sidebar order: Gauri-eng and Bill-eng. Where a line is longer than its step on screen, a settled frame is held and the subtitles are timed to match.

Left out

  • Instance-wide templates and anything only a superuser can do.
  • The Encounter Report type: the backend registers it, but no screen offers it (reference only).
  • Small-screen behaviour of the report list.
  • Videos for the Overview-panel, patient, account and report-list variants of the generate flow (text only).

Product issues found (not filed)

Found while documenting; recorded here, nothing filed on GitHub.

  1. Doctors and Nurses see Create Template and Edit, but the builder cannot work for them (confirmed at runtime). They hold "Can Create Template on Facility" and get it in the facility's permissions, but not "Can View Template Schema" or "Can Preview Template": the builder's schema call returns 403 ("You do not have permission to access template schema"), so no contexts or fields load and preview fails. Saving also needs the role in Administration. care security/permissions/template.py:17-49, security/authorization/template.py; care_fe TemplateBuilder.tsx:120-127, TemplatePage.tsx.
  2. HTML is the default format, but HTML reports cannot be shown or printed in Care. The viewer previews and prints PDF only; the sandboxed HTML printing from care_fe ecba1c7a4 was turned off hours later by 6a40c4913. care_fe ReportViewer.tsx, TemplateBuilder.tsx defaults.
  3. New template: Save fails until a context is picked, although the Fields panel already shows the first context's fields (code reading). care_fe TemplateBuilder.tsx:116, 209-215, 228.
  4. Template syntax is not checked on save. A broken Active template fails only in the background task, and the status check returns the same empty response as a success. care viewsets/report/report_upload.py:131-134, tasks/report_generation.py:76-78.
  5. Archive is shown to everyone who can see the report list, while the backend requires write access; the backend also accepts an empty reason and re-archiving an archived report (overwriting reason, time and person). care_fe ReportSubTab.tsx; care report_upload.py:159-171.
  6. Generate Report opens the latest existing report instead of generating a new one; the user must press Regenerate. Possibly intended.
  7. Retired is called "Archived" in the Templates status filter, and "Archived" also means archived reports.
  8. Some encounter statuses print raw values in reports, for example "On_Hold". care reports/context_builder/data_points/encounter.py:42-48.
  9. An update can move a template to another facility without permission there (the update spec copies facility; authorize_update checks only the old facility). care resources/report/template/spec.py:47-50, 93-94, viewsets/report/template.py:86-91.
  10. Smaller: "Create Your First Template" is not gated by the write permission; the builder has no Description input and a cleared description is not saved; TemplateCard's "Generate Report" is dead code; "{n} Version" is not pluralised; the print error reuses the QR-code message; Download stays disabled for a report outside the 50-item history.

Noted, not an issue (billjohnc): only a Facility Admin can generate or archive a report once the encounter is completed, by design; the Generate Report button still shows on a completed encounter.

Open questions

  • Patient Summary: facility users lose access to a patient's summaries once all of that patient's encounters are completed (care security/authorization/patient.py:19-21). Intended?
  • Account Report: generating or archiving needs "Can Update Account" (Facility Admin by default), so billing staff with Staff cannot. Intended?
  • Can a questionnaire answer carry a procedure or immunization into a report through the completed questionnaire responses? Not verified; the pages say only that procedures and immunizations are not available as report data.

🤖 Generated with Claude Code

Concept, the five existing flows (paths kept), the reference, and two new
flows: Print a report and Archive a report. Verified against care ddfd840
and care_fe abf394594 (reports from encounter, patient and billing account
after care_fe 6a40c4913; printing after ecba1c7a4). Supersedes draft #74.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Deploying coredocs with  Cloudflare Pages  Cloudflare Pages

Latest commit: d75ea79
Status: ✅  Deploy successful!
Preview URL: https://37d01b56.coredocs.pages.dev
Branch Preview URL: https://docs-report-template-b7c5.coredocs.pages.dev

View logs

Seven flows recorded on a local Care stack with invented data (care ddfd840,
care_fe abf394594), names, identifiers and the report frame blurred while
recording. Narration by ElevenLabs (eleven_v4), voices Gauri-eng and
Bill-eng alternating in sidebar order; subtitles follow the voice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant