Report And Deliverables¶
Governed savings/audit report payloads, lineage, queue refresh, PDF export, workbook export, and narrative outputs.
Owner: Savings/Audit backend
Source Modules¶
scripts/serve_client_portal.pyLeafEnterprise/client_preview.pyLeafEnterprise/report_workbook.pyLeafEnterprise/pocket_consultant.py
Endpoint Summary¶
| Method | Path | Summary | Auth | Handler |
|---|---|---|---|---|
| GET | /api/client-report |
Returns the interactive savings/audit report payload for a resolved scope. | trusted frontend proxy | _handle_client_report |
| GET | /api/client-report-narrative |
Returns or drafts an executive narrative for the active report context. | trusted frontend proxy | _handle_report_narrative |
| GET | /api/client-report-pdf |
Exports the current savings/audit report as a PDF artifact. | trusted frontend proxy | _handle_report_pdf |
| GET | /api/client-report-xlsx |
Exports the governed audit workbook for the current resolved report scope. | trusted frontend proxy | _handle_report_workbook |
| GET | /api/client-report/context |
Returns authoritative report context, workbook posture, run lineage, AI handoff, and evidence status. | trusted frontend proxy | _handle_client_report_context |
| POST | /api/client-report/queue |
Queues or refreshes a governed savings/audit run for the selected scope. | trusted frontend proxy | _handle_client_report_queue |
| GET | /api/filter-options |
Returns governed filter/scope options for UI controls. | trusted frontend proxy | _handle_filter_options |
Endpoint Details¶
GET /api/client-report¶
Returns the interactive savings/audit report payload for a resolved scope.
| Property | Value |
|---|---|
| Handler | _handle_client_report |
| Auth | trusted frontend proxy |
| Cache | runtime cache optional |
| Status codes | 200, 401, 404, 500 |
Query parameters: pbm, tpa, group_name, start_date, end_date, request_id, top_n
Body fields: none
Response sections: client_context, executive_summary, channel_segmentation, top_drugs, specialty_high_cost, groups, deliverables
Tests / smoke paths: scripts/smoke_client_portal.py, tests/test_report_workbook.py
Notes: Browser pages must treat returned client_context as authoritative over requested query values.
Semantic Retrieval Hints¶
- Stable endpoint id:
GET /api/client-report - Route family:
report-deliverables - Source handler:
_handle_client_report - Secrets and raw source URLs must remain backend-only unless this endpoint explicitly documents otherwise.
GET /api/client-report-narrative¶
Returns or drafts an executive narrative for the active report context.
| Property | Value |
|---|---|
| Handler | _handle_report_narrative |
| Auth | trusted frontend proxy |
| Cache | internal narrative cache |
| Status codes | 200, 401, 500 |
Query parameters: pbm, tpa, group_name, start_date, end_date
Body fields: none
Response sections: narrative, runtime, grounding, fallback
Tests / smoke paths: scripts/smoke_client_portal.py
Notes: Azure OpenAI can draft text, but metrics remain deterministic report payload values.
Semantic Retrieval Hints¶
- Stable endpoint id:
GET /api/client-report-narrative - Route family:
report-deliverables - Source handler:
_handle_report_narrative - Secrets and raw source URLs must remain backend-only unless this endpoint explicitly documents otherwise.
GET /api/client-report-pdf¶
Exports the current savings/audit report as a PDF artifact.
| Property | Value |
|---|---|
| Handler | _handle_report_pdf |
| Auth | trusted frontend proxy |
| Cache | none |
| Status codes | 200, 401, 404, 500 |
Query parameters: pbm, tpa, group_name, start_date, end_date
Body fields: none
Response sections: application/pdf
Tests / smoke paths: scripts/smoke_client_portal.py
Notes: Export must stay consistent with the same run context used by the UI payload.
Semantic Retrieval Hints¶
- Stable endpoint id:
GET /api/client-report-pdf - Route family:
report-deliverables - Source handler:
_handle_report_pdf - Secrets and raw source URLs must remain backend-only unless this endpoint explicitly documents otherwise.
GET /api/client-report-xlsx¶
Exports the governed audit workbook for the current resolved report scope.
| Property | Value |
|---|---|
| Handler | _handle_report_workbook |
| Auth | trusted frontend proxy |
| Cache | none |
| Status codes | 200, 400, 401, 404, 409, 500 |
Query parameters: pbm, tpa, group_name, start_date, end_date, request_number
Body fields: none
Response sections: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Tests / smoke paths: tests/test_report_workbook.py, tests/test_serve_client_portal.py
Notes: Final workbook path; ITR-governed exports should reject missing or drifted exact-scope lineage.
Semantic Retrieval Hints¶
- Stable endpoint id:
GET /api/client-report-xlsx - Route family:
report-deliverables - Source handler:
_handle_report_workbook - Secrets and raw source URLs must remain backend-only unless this endpoint explicitly documents otherwise.
GET /api/client-report/context¶
Returns authoritative report context, workbook posture, run lineage, AI handoff, and evidence status.
| Property | Value |
|---|---|
| Handler | _handle_client_report_context |
| Auth | trusted frontend proxy |
| Cache | runtime cache optional |
| Status codes | 200, 401, 404, 500 |
Query parameters: pbm, tpa, group_name, start_date, end_date, request_number, refresh
Body fields: none
Response sections: client_context, workbook_export, run_lineage, ai_handoff, itr_handoff, contract_guarantee_evidence, domo_takeover
Tests / smoke paths: scripts/smoke_client_portal.py, tests/test_report_workbook.py
Notes: Primary backend authority for savings-page lineage and AI handoff posture.
Semantic Retrieval Hints¶
- Stable endpoint id:
GET /api/client-report/context - Route family:
report-deliverables - Source handler:
_handle_client_report_context - Secrets and raw source URLs must remain backend-only unless this endpoint explicitly documents otherwise.
POST /api/client-report/queue¶
Queues or refreshes a governed savings/audit run for the selected scope.
| Property | Value |
|---|---|
| Handler | _handle_client_report_queue |
| Auth | trusted frontend proxy |
| Cache | none |
| Status codes | 200, 202, 400, 401, 409, 500 |
Query parameters: none
Body fields: pbm, tpa, group_name, start_date, end_date, source_request_number, selected_scope_key, selected_scope_kind
Response sections: status, queued_requests, loaded_scope, itr_handoff
Tests / smoke paths: tests/test_serve_client_portal.py
Notes: Operator-facing only; do not blindly fan out ambiguous ITR scopes.
Semantic Retrieval Hints¶
- Stable endpoint id:
POST /api/client-report/queue - Route family:
report-deliverables - Source handler:
_handle_client_report_queue - Secrets and raw source URLs must remain backend-only unless this endpoint explicitly documents otherwise.
GET /api/filter-options¶
Returns governed filter/scope options for UI controls.
| Property | Value |
|---|---|
| Handler | _handle_filter_options |
| Auth | trusted frontend proxy |
| Cache | runtime cache optional |
| Status codes | 200, 401, 500 |
Query parameters: none
Body fields: none
Response sections: pbms, tpas, groups, date_windows, scope_registry
Tests / smoke paths: scripts/smoke_client_portal.py
Notes: Keep completed report scopes distinct from broader capability-ready scopes.
Semantic Retrieval Hints¶
- Stable endpoint id:
GET /api/filter-options - Route family:
report-deliverables - Source handler:
_handle_filter_options - Secrets and raw source URLs must remain backend-only unless this endpoint explicitly documents otherwise.