How chat90278-png/sozappsql2 works
1. Purpose and entry points
SOZAPP SQL2 is a Windows-packaged Python desktop application for contract, delivery, sharing, agenda, reporting, and analysis workflows backed by an STS data store. Runtime starts at app.py; release packaging is defined by STS.spec and produces STS.exe. The principal presentation runtime is Qt, with application UI under src/ui/ and a separate Analysis Center package.
2. Desktop composition and UI boundary
The main desktop shell and primary work surfaces coordinate user actions, dialogs, and service calls. Contract work, agenda views, main-page navigation, and the Analysis Center are distinct UI integrations rather than a web/API layer.
• src/ui/main_window.py
• src/ui/contract/contract_work_window.py
• src/ui/analysis_center_window.py
Long-running save, load/index, and export work is isolated into workers to keep the Qt UI responsive:
• src/workers/contract_save_worker.py
• src/workers/sts_load_worker.py
• src/workers/export_workers.py
3. Contract and delivery domain
Core domain models represent contracts, delivery schedules/coverage, timing, flexible dates, and snapshots. UI edits should pass through this domain/service boundary rather than directly encode business rules in widgets.
• src/domain/models.py
• src/domain/delivery_core.py
• src/domain/contract_timing.py
Delivery reporting and Excel export consume persisted contract/delivery data:
• src/services/platform_delivery_report.py
• src/services/delivery_schedule_excel_exporter.py
4. Persistence, schema lifecycle, and data boundaries
STS persistence is the system-of-record boundary: database access, store abstractions, workbook/Excel handling, and cross-platform contract persistence live in services. Schema upgrade logic and its gate protect startup/use against incompatible database versions.
• src/services/sts_database.py
• src/services/sts_store.py
• src/services/sts_schema_upgrade.py
Related persistence paths include:
• src/services/sts_schema_upgrade_gate.py
• src/services/multiplatform_contract_persistence.py
• src/services/excel_store.py
Control flow is generally UI/worker → services/store → STS database or Excel-backed artifacts → domain-shaped results → UI refresh.
5. Agenda pipeline
Agenda is a dedicated domain subsystem that converts several source types—activity, deadlines, document locks, returned shares, and unknown dates—into a personal/staff agenda. Providers isolate source-specific extraction; context/state repositories and facades assemble user-scoped views.
• src/domain/agenda/providers/base.py
• src/services/agenda_context_factory.py
• src/services/personal_agenda_facade.py
Presentation is surfaced through compact and detail Qt views:
• src/ui/agenda_compact_widget.py
• src/ui/agenda_detail_window.py
6. Sharing, permissions, and audit history
Share lifecycle and merge workflows coordinate assignment/package data, resolution decisions, application of merges, scoped permissions, and history. This is a material transactional boundary because it changes shared contract-related state and exposes audit/history UI.
• src/services/share_merge_service.py
• src/services/share_merge_apply_service.py
• src/services/share_lifecycle_service.py
Authorization and historical activity are separated from widgets:
• src/auth.py
• src/share_permissions.py
• src/services/activity_history_query.py
7. Analysis Center and exports
analysis_center/ is a self-contained analytical/dashboard subsystem: it loads data, defines metrics and filters, executes analysis, persists dashboards/custom libraries, renders Qt dashboards, and exports results to Excel.
• analysis_center/analysis_engine.py
• analysis_center/analysis_dashboard_service.py
• analysis_center/analysis_repository.py
Its main UI and export boundary are:
• analysis_center/analysis_qt_window.py
• analysis_center/analysis_excel_export.py
• analysis_center/analysis_excel_export_qt.py
8. Runtime operations
The application includes crash logging and performance telemetry/tracking, with release-oriented CI workflows validating integration, schema upgrades, timing changes, and performance behavior.
• src/core/crash_logger.py
• src/services/perf_tracker.py
• .github/workflows/analysis-integration.yml
Main entry points: sts_store.py STS store · app.py Application entry · main_window.py Main desktop shell · contract_work_window.py Contract workspace
Components 23
Desktop runtime
- Application entry · Starts the packaged desktop application.
app.py - Windows package · Builds STS.exe.
STS.spec - Main desktop shell
src/ui/main_window.py - Contract workspace
src/ui/contract/contract_work_window.py - Background workers · Runs save, load/index, and export work off the UI thread.
src/workers/contract_save_worker.py
Domain and persistence
- Contract and delivery domain · Models contracts, schedules, coverage, timing, and snapshots.
src/domain/models.py - Delivery rules
src/domain/delivery_core.py - STS store · Store abstraction for contract data.
src/services/sts_store.py - Schema upgrade gate · Blocks use of incompatible database versions.
src/services/sts_schema_upgrade_gate.py - Schema upgrades
src/services/sts_schema_upgrade.py - STS database
src/services/sts_database.py - Delivery reports and Excel
src/services/delivery_schedule_excel_exporter.py
Agenda and sharing
- Personal agenda facade · Assembles user-scoped agenda views from source providers.
src/services/personal_agenda_facade.py - Agenda context · Builds provider context and state.
src/services/agenda_context_factory.py - Agenda views · Compact and detailed agenda presentation.
src/ui/agenda_compact_widget.py - Share lifecycle
src/services/share_lifecycle_service.py - Share merge · Resolves and applies shared-state merge decisions.
src/services/share_merge_service.py - Share permissions
src/share_permissions.py
Analysis Center
- Analysis dashboard
analysis_center/analysis_qt_window.py - Dashboard service · Coordinates dashboards, metrics, filters, and analysis execution.
analysis_center/analysis_dashboard_service.py - Analysis repository · Persists dashboards and custom libraries.
analysis_center/analysis_repository.py - Analysis Excel export
analysis_center/analysis_excel_export.py
Other components
- Crash and performance tracking
src/core/crash_logger.py
Connections 28
- Windows package → Application entry: packages
- Application entry → Main desktop shell: starts
- Application entry → Schema upgrade gate: checks at startup
- Schema upgrade gate → Schema upgrades: upgrades when needed
- Schema upgrades → STS database: migrates
- Main desktop shell → Contract workspace: opens
- Contract workspace → Background workers: dispatches work
- Background workers → STS store: saves and loads
- Contract workspace → Contract and delivery domain: edits through
- Contract and delivery domain → Delivery rules: applies delivery rules
- STS store → STS database: reads and writes
- STS store → Contract and delivery domain: returns shaped data
- Background workers → Delivery reports and Excel: runs exports
- Delivery reports and Excel → STS store: reads persisted data
- Main desktop shell → Agenda views: hosts
- Agenda views → Personal agenda facade: requests agenda
- Personal agenda facade → Agenda context: builds context
- Agenda context → STS store: loads source state
- Contract workspace → Share lifecycle: manages shares
- Share lifecycle → Share merge: coordinates merges
- Share merge → Share permissions: enforces scope
- Share merge → STS store: updates shared state
- Main desktop shell → Analysis dashboard: opens
- Analysis dashboard → Dashboard service: requests dashboards
- Dashboard service → Analysis repository: loads and saves dashboards
- Dashboard service → STS store: analyzes data
- Analysis dashboard → Analysis Excel export: exports results
- Application entry → Crash and performance tracking: reports runtime events