Reporting Template & Requirement Sets Page (TemplateRequirementsPage)¶
Audience and Purpose¶
This guide is written for:
Medical staff (physicians, nurses, documentation staff)
Clinical trainers
Product owners and project coordinators
No software engineering background is required.
The goal of this page is simple:
Select the correct report template for an examination.
Load and manage requirement sets for that case.
Prepare the case for the next reporting steps (findings, review, report editor).
Where This Page Is Used¶
TemplateRequirementsPage is a page inside the reporting workflow shell:
Shell component:
frontend/src/views/reporting/ReportingShell.vuePage component:
frontend/src/views/reporting/TemplateRequirementsPage.vueRoute:
/reporting/:patient_examination_id/template-requirements
This means it is part of the guided multi-step reporting process, not a standalone page.
What You See on the Page¶
The page has two main blocks.
1. Template Selection¶
This block lets you:
Choose the knowledge-base module (
KB module)See the current examination
Load templates for that examination
Select one template from the dropdown
See a summary of sections and validator counts
For clinical onboarding, a default training example is available:
Module:
report_template_examplesExample template for colonoscopy:
colonoscopy_training_basic
2. Template & Requirement Sets¶
This block lets you:
View the current
patient_examination_idView the active lookup token
Load lookup status
Select or deselect requirement sets
Trigger recomputation
Review suggested actions from lookup logic
Why Requirement Sets Matter (Clinical View)¶
Think of requirement sets as structured checklists derived from:
Examination context
Selected template
Existing findings
Rule logic in the backend
If sets are missing, downstream steps can be incomplete, and the final report quality may be lower.
Typical Step-by-Step Workflow¶
Use this sequence for training sessions.
Open a reporting case via deep link, for example:
/reporting/<patient_examination_id>/template-requirementsConfirm the displayed
PatientExamination-IDis correct.In Template Selection, keep module
report_template_examples(for training) or switch to your production module.Click Templates for examination load.
Select a template from the dropdown.
In Template & Requirement Sets, verify that requirement sets are shown.
Select relevant sets (switches on the right side).
Click recompute if needed.
Continue to next workflow pages (Findings, Requirements Review, Report Editor).
Full Reporting Flow (All Steps)¶
The reporting process is designed as a sequence inside ReportingShell.
Step 0: Worklist¶
Route:
/reportingMain goal: Start a new report or resume an existing one.
Typical actions:
Filter by status (
draft,final, or all).Open an existing case.
Or click Start new report to begin a new case.
Step 1: Case Setup¶
Route:
/reporting/case-setupMain goal: Create a valid case context.
Typical actions:
Select patient.
Select examination.
Start patient examination and lookup session.
Confirm that both fields are populated:
PatientExamination-IDandLookup-Token.
Without this step, later pages cannot calculate requirement logic reliably.
Step 2: Template & Requirement Sets¶
Route:
/reporting/<patient_examination_id>/template-requirementsMain goal: Align template structure and requirement logic for this case.
Typical actions:
Load templates for the selected examination.
Select a template.
Load lookup state.
Select requirement sets.
Recompute if needed.
This step controls what should be documented in later steps.
Step 3: Findings Capture¶
Route:
/reporting/<patient_examination_id>/findingsMain goal: Enter clinical findings and their classifications.
Typical actions:
Add findings to the case.
Set or update classifications.
Recompute lookup after important changes.
Review available findings from lookup.
For clinical documentation quality, this is one of the most important steps.
Step 4: Requirements Review¶
Route:
/reporting/<patient_examination_id>/requirements-reviewMain goal: Check unmet requirements and suggested actions.
Typical actions:
Load lookup hints.
Review unmet requirement sets.
Review advisory recommendations.
If needed, return to Findings or Template/Requirement Sets and adjust.
Important: This page is advisory; it supports decision-making but does not replace medical judgement.
Step 5: Report Editor¶
Route:
/reporting/<patient_examination_id>/report-editorMain goal: Produce and save the report text/content.
Typical actions:
Confirm template context.
Fill section notes (draft text per section).
Set indication rows when needed.
Save as
draftduring work-in-progress.Save as
finalwhen complete.
The editor creates/updates structured report submissions linked to the case.
Step 6: Segment/Frame Selector (Optional)¶
Route:
/reporting/<patient_examination_id>/frame-selectorMain goal: Select representative frames for segments and optionally link findings.
Typical actions:
Select a segment.
Set a representative frame manually or with helper actions.
Optionally attach/remove finding links.
Use this step when image/video evidence selection is needed.
Step 7: Finalization / Artifacts¶
Route:
/reporting/<patient_examination_id>/finalizedMain goal: Access final outputs and verify traceability.
Typical actions:
Load latest finalized report state.
Open/download PDF artifact.
Open patient timeline.
Verify status, version, and document type.
Quick Practical Path for Clinical Documentation¶
If the primary objective is to document findings quickly and safely:
Complete Case Setup.
In Template & Requirement Sets, select the matching template and requirement sets.
In Findings Capture, add findings and classifications.
Use Requirements Review to catch missing documentation.
Complete Report Editor and save as draft/final.
Confirm output in Finalization.
Deep Link Behavior¶
When this page is opened with :patient_examination_id in the route:
The page uses that ID as the active case context.
It fetches patient examination details.
It attempts to initialize a lookup session if no token exists.
It loads lookup data automatically.
This reduces manual setup and makes training demos reliable.
Developer Mapping: Requirement Objects to lx_dtypes Validators¶
The new base_api requirement routes are derived from lx_dtypes report templates and validator runtime execution.
Source implementation:
lx-data-models/lx_dtypes/django/api/main.py
1. GET /base_api/requirement-sets¶
Each returned requirement set maps to one report_template.
Mapping:
requirement_set.id-> 1-based index oversorted(kb.report_template.keys())requirement_set.name->report_template.namerequirement_set.template_name->report_template.namerequirement_set.type->report_template.examinationrequirement_set.module_name-> selected module (defaultreport_template_examples)requirement_set.requirements[]-> flattened validators attached to the template
Nested requirement object mapping:
requirements[i].id-> 1-based local index within the requirement setrequirements[i].name-> validator namerequirements[i].kind:findings_validatorif fromtemplate.validators.findings_validatorsexamination_validatorif fromtemplate.validators.examination_validators
Important:
These IDs are API-generated projection IDs, not database IDs.
They are deterministic for a given module content/order, but can change if template names or validator ordering changes.
2. GET /base_api/requirement-sets/{id}¶
This returns the same projected object as above, selected by projected id.
3. POST /base_api/evaluate-requirement-set¶
Accepted selector fields:
requirement_set_idrequirement_set_idsrequirementSetIds(legacy camelCase compatibility)
Evaluation input mapping:
reported_findings(or fallbackfindings) is passed to:kb.evaluate_report_template_validators(template_name, reported_findings=...)
Output mapping per validator execution:
result.requirement_set_id-> projected requirement set idresult.requirement_set_name-> template nameresult.requirement_name-> validator executionnameresult.met-> validator executionokresult.status->PASSED/FAILEDresult.details-> compact message from validator issuesresult.validator_result-> full runtime validator execution object
Compatibility notes:
patient_examination_idis retained in request/response meta for frontend compatibility.Requirement evaluation for these
base_apiroutes no longer depends onendoreg_dbrequirement models/services.
Common Problems and Practical Fixes¶
Problem: “No templates found for colonoscopy”¶
Possible causes:
No template exists for examination
colonoscopyin selected module.Wrong module selected.
What to do:
Set module to
report_template_examples.Reload templates.
Verify template
colonoscopy_training_basicappears.
Problem: “0 set(s)” and “No requirement sets found”¶
Possible causes:
No lookup token exists yet.
Lookup session expired.
Case was opened without valid
patient_examination_id.Backend rule engine returned no sets for current data.
What to do:
Verify
PatientExamination-IDis present.Check that
Lookup-Tokenis present.Use refresh/recompute.
If still empty, return to case setup and reinitialize lookup.
Problem: Mismatch warning between route parameter and stored case¶
Meaning:
The URL case ID and locally stored flow state refer to different cases.
What to do:
Reload the intended deep-link URL.
Avoid using stale browser tabs from older cases.
Training Checklist (For Clinical Onboarding)¶
Use this checklist when teaching staff.
Can the user identify current
PatientExamination-ID?Can the user explain the purpose of each reporting step/page?
Can the user load templates for the examination?
Can the user select the correct template?
Can the user understand requirement set status (fulfilled / not fulfilled / unknown)?
Can the user toggle a set and recompute?
Can the user add findings and update classifications?
Can the user use Requirements Review to identify gaps?
Can the user save draft/final report in the editor?
Can the user verify artifacts in Finalization?
Glossary (Plain Language)¶
Template: A predefined report structure with sections and expected findings.
Requirement set: A grouped rule/checklist for report completeness.
Lookup token: Session key for requirement calculations.
Recompute: Re-run backend logic after changes.
Patient examination: The concrete clinical case instance used for reporting.