Overview
The One-Click Audit Reports feature provides automated audit report generation, CDM event exploration, policy decision tracking, and comprehensive compliance verification. Reports can be exported in multiple formats (PDF, CSV, JSON, XLSX). Code Reference:app/services/audit_report_service.py, app/api/auditor_routes.pyFrontend:
client/src/apps/auditor/AuditReportGenerator.tsx, client/src/apps/auditor/AuditorRouter.tsx
Key Features
Report Generation
- Automated Generation: One-click report generation
- Multiple Templates: Standard, comprehensive, and executive templates
- Customizable Sections: Include/exclude report sections
- Date Range Filtering: Filter by date range
- Entity Selection: Generate reports for specific deals, loans, or filings
app/services/audit_report_service.py
CDM Event Explorer
- Event Browsing: Browse and filter CDM events
- Event Types: Filter by event type (TradeExecution, PolicyEvaluation, etc.)
- Transaction Linking: Link events to transactions
- Event Details: View complete CDM event data
- Related Events: Navigate related events
client/src/apps/auditor/CDMEventExplorer.tsx
Policy Decisions Explorer
- Decision Tracking: Track all policy decisions
- Decision Types: Filter by decision (ALLOW, BLOCK, FLAG)
- Rule Analysis: Analyze which rules were applied
- Evaluation Trace: View complete evaluation trace
- Transaction Context: View transaction context for decisions
client/src/apps/auditor/PolicyDecisionsExplorer.tsx
Export Functionality
- Multiple Formats: Export in PDF, CSV, JSON, XLSX
- Custom Exports: Customize export format and content
- Batch Export: Export multiple reports at once
- Scheduled Exports: Schedule automatic report exports
app/services/audit_export_service.py
Report Types
Overview Report
Comprehensive overview of all audit activity:- Total audit logs
- Policy decisions summary
- CDM events count
- Activity trends
- User activity summary
Deal Report
Audit trail for specific deal:- Deal information
- All related audit logs
- Policy decisions
- CDM events
- Document history
Loan Report
Audit trail for specific loan:- Loan information
- Verification history
- Policy decisions
- CDM events
- Recovery actions
Filing Report
Audit trail for regulatory filing:- Filing information
- Filing status
- Policy decisions
- CDM events
- Compliance verification
Custom Report
Customizable report with selected sections:- Custom date range
- Custom entity selection
- Custom section selection
- Custom template
app/services/audit_report_service.py
Workflow
1. Generate Report
- Select Report Type: Choose report type (overview, deal, loan, filing, custom)
- Set Date Range: Select date range for report
- Select Entities: Choose specific entities (if applicable)
- Choose Template: Select report template
- Configure Sections: Include/exclude report sections
- Generate: Generate report
2. Review Report
- View Report: Review generated report
- Explore Events: Navigate CDM events
- Analyze Decisions: Review policy decisions
- Verify Compliance: Verify compliance status
- Export: Export report in desired format
3. Export Report
- Select Format: Choose export format (PDF, CSV, JSON, XLSX)
- Configure Export: Set export options
- Download: Download exported report
- Archive: Archive report for future reference
API Endpoints
Generate Audit Report
Generate an audit report. Request Body:app/api/auditor_routes.py
Export Report
Export a generated report. Query Parameters:format: Export format (pdf, csv, json, xlsx)
Get CDM Events
Browse and filter CDM events. Query Parameters:event_type: Filter by event typetransaction_id: Filter by transaction IDstart_date: Start date filterend_date: End date filterpage: Page numberlimit: Items per page
Get Policy Decisions
Browse and filter policy decisions. Query Parameters:decision: Filter by decision (ALLOW, BLOCK, FLAG)rule_applied: Filter by rule nametransaction_type: Filter by transaction typestart_date: Start date filterend_date: End date filterpage: Page numberlimit: Items per page
app/api/auditor_routes.py
User Interface
Auditor Router
Location:client/src/apps/auditor/AuditorRouter.tsx
Features:
- Dashboard: Audit dashboard with statistics
- Report Generator: Report generation interface
- CDM Event Explorer: CDM event browsing
- Policy Decisions Explorer: Policy decision tracking
- Export Interface: Report export interface
Audit Report Generator
Location:client/src/apps/auditor/AuditReportGenerator.tsx
Features:
- Report Configuration: Configure report parameters
- Template Selection: Choose report template
- Section Selection: Include/exclude sections
- Preview: Preview generated report
- Export: Export report in multiple formats
client/src/apps/auditor/
Permissions
All auditor endpoints requireAUDIT_VIEW permission. Export endpoints require AUDIT_EXPORT permission.
Code Reference: app/core/permissions.py
Best Practices
- Regular Reports: Generate reports regularly for compliance
- Date Range Selection: Use appropriate date ranges
- Entity Filtering: Filter by specific entities when needed
- Template Selection: Choose appropriate template for audience
- Export Archiving: Archive exported reports for audit trail
Additional Resources
Last Updated: 2026-01-14
Code Reference:
app/services/audit_report_service.py, app/api/auditor_routes.py, client/src/apps/auditor/