How kalvium23/ak64_salespulse__kalvium-community works
Purpose and entry points
A Python analytics workspace for B2B sales/CRM data: customers, deals, activities, and email history are processed into sales-performance, funnel, behavioral, anomaly, and KPI outputs. Main operational entry points are pipeline.py, app.py, and the Streamlit-style multipage dashboard under pages/. A second frontend implementation exists under frontend/.
Dashboard and user-facing layer
The primary UI is organized around a shell plus analytical pages: app.py, components/header.py, and components/sidebar.py provide application composition; pages/1_Pipeline_Analytics.py, pages/2_Sales_Performance.py, and pages/4_Behaviour_Analytics.py expose domain views. The alternate dashboard surface is frontend/dashboard_app.py with frontend/kpi_dashboard.py. UI consumes locally processed datasets and analysis services rather than a declared backend API.
Data ingestion and canonical processing
Raw CSV/JSON sources enter from data/raw/ and CRM-shaped sources from data/raw_new/. The processing layer produces durable CSV artifacts in data/processed/, notably data/processed/master_salespulse.csv, data/processed/merged_customer_orders.csv, and cleaned CRM tables. Pipeline stages are implemented as independently executable scripts, with orchestration-oriented paths pipeline.py, scripts/salespulse_pipeline.py, and scripts/data_workflow.py.
Data quality and feature pipeline
Data preparation is a staged file-based boundary: intake/schema validation, cleaning, typing, deduplication, missing-value handling, and features transform raw data into analysis-ready tables. Core stages reside in scripts/ingest_data.py, scripts/validate_intake.py, and scripts/feature_engineering.py; related outputs are materialized rather than dynamically queried. Validation artifacts and audit reports are written under output/, allowing downstream analysis to use inspected datasets.
Sales, CRM, and behavioral analytics
Domain modules calculate business-facing insights over processed CRM and transaction data. crm_manager.py and deal_predictor.py cover CRM/deal-oriented logic; behaviour_analytics.py handles behavioral analysis; email_analyzer.py handles communication history. Segmentation and funnel analysis are represented by scripts/behavioural_analysis_user_segmentation.py, scripts/funnel_analysis.py, and their persisted outputs such as data/processed/segment_summary_ranked.csv.
KPI, anomaly, and narrative/reporting layer
KPI calculations are centralized in kpis/kpi_functions.py, with reference definitions and validation targets in kpis/kpi_reference.md and kpis/kpi_validation_targets.json. Risk/investigation processing is supported by scripts/anomaly_detection_risk.py and scripts/root_cause_investigation.py. Outputs flow into exports and reports through report_generator.py, export_functions.py, and output/, including CSV, JSON, HTML, PDF, and text deliverables. AI coaching and alerting are separate integration points in ai_coaching.py and alert_config.py.
SQL analytics and infrastructure boundary
The repository supports a relational-database analytics path alongside file-based processing. Query definitions live in queries/; reusable database abstractions appear in database/views/vw_active_customers.sql and database/aggregations/agg_daily_metrics.sql; database_manager.py and scripts/sql_environment_database_integration.py bridge Python to database operations. Database credentials and API keys are expected from environment configuration (.env.example), not committed source. CI validation is defined in .github/workflows/validate.yml and pipeline automation in .github/workflows/pipeline.yml.
Main entry points: 1_Pipeline_Analytics.py Analytical pages · report_generator.py Reports and exports · ingest_data.py Intake and validation · crm_manager.py CRM and deal analytics
Components 21
Dashboard surfaces
- Primary dashboard shell
app.py - Analytical pages · Pipeline, sales performance, and behavior views.
pages/1_Pipeline_Analytics.py - Dashboard components
components/header.py - Alternate dashboard
frontend/dashboard_app.py
File data pipeline
- Raw sources · Sales and CRM source files.
- CRM-shaped sources
- Pipeline orchestrator
pipeline.py - Intake and validation
scripts/ingest_data.py - Clean and feature pipeline · Types, deduplication, missing values, and features.
scripts/feature_engineering.py - Processed datasets · Canonical analysis-ready tables.
- Validation artifacts
Analytics and reporting
- CRM and deal analytics
crm_manager.py - Behavior analytics
behaviour_analytics.py - Segmentation and funnel
scripts/funnel_analysis.py - Email analysis
email_analyzer.py - KPI calculations
kpis/kpi_functions.py - Risk investigation
scripts/anomaly_detection_risk.py - Reports and exports · Produces CSV, JSON, HTML, PDF, and text deliverables.
report_generator.py - AI coaching and alerts
ai_coaching.py
SQL analytics path
- SQL queries and models · Reusable queries, views, and aggregations.
- Database bridge
database_manager.py
Connections 27
- Raw sources → Pipeline orchestrator: orchestrated input
- CRM-shaped sources → Pipeline orchestrator: orchestrated input
- Pipeline orchestrator → Intake and validation: runs
- Intake and validation → Clean and feature pipeline: validated data
- Intake and validation → Validation artifacts: audit reports
- Clean and feature pipeline → Processed datasets: materializes
- Processed datasets → CRM and deal analytics: CRM tables
- Processed datasets → Behavior analytics: activity data
- Processed datasets → Segmentation and funnel: customer and deal data
- Processed datasets → Email analysis: email history
- Processed datasets → KPI calculations: metrics inputs
- Processed datasets → Risk investigation: investigation inputs
- Segmentation and funnel → Processed datasets: segment outputs
- CRM and deal analytics → Reports and exports: insights
- Behavior analytics → Reports and exports: insights
- KPI calculations → Reports and exports: KPI outputs
- Risk investigation → Reports and exports: findings
- Risk investigation → AI coaching and alerts: risk signals
- Processed datasets → Primary dashboard shell: local datasets
- CRM and deal analytics → Analytical pages: domain analysis
- Behavior analytics → Analytical pages: behavior views
- KPI calculations → Analytical pages: metrics
- Primary dashboard shell → Analytical pages: hosts
- Dashboard components → Primary dashboard shell: composes
- Processed datasets → Alternate dashboard: local datasets
- SQL queries and models → Database bridge: executed through
- Database bridge → Processed datasets: relational analytics path