Data Models
This section documents every Django model in ChargeSol with full field specifications, relationships, and constraints.
Entity-Relationship Diagram
erDiagram
User ||--o{ Lead : "submits (OEM) / handles (CentralOps)"
User ||--|| Role : "has"
User }o--o| Zone : "assigned to"
User ||--o{ TeamMembership : "belongs to"
Team ||--o{ TeamMembership : "contains"
Team }o--|| Zone : "operates in"
Lead ||--o{ LeadDocument : "has"
Lead }o--|| LeadSource : "came from"
Lead ||--o| Survey : "has"
Survey ||--o{ SurveyAssignment : "assigned to"
Survey ||--o| SurveyReport : "produces"
Survey ||--o{ SurveyMedia : "has"
SurveyAssignment }o--|| Team : "performed by"
Survey ||--o| Installation : "leads to"
Installation ||--o{ InstallationAssignment : "assigned to"
Installation ||--o| InstallationReport : "produces"
Installation ||--o{ InstallationMedia : "has"
InstallationAssignment }o--|| Team : "performed by"
Installation ||--o{ MaterialAllocation : "requires"
MaterialAllocation }o--|| Material : "of"
Material ||--o{ MaterialStock : "stocked as"
MaterialStock }o--|| Zone : "located in"
Installation ||--o{ ProcurementRequest : "triggers"
ProcurementRequest }o--o| Vendor : "fulfilled by"
ProcurementRequest ||--o| VendorPayment : "paid via"
VendorPayment }o--|| Vendor : "paid to"
Installation ||--o{ JobPayout : "generates"
JobPayout }o--|| Team : "paid to"
Team ||--o| PaymentSchedule : "follows"
Installation ||--o| ClosurePack : "closed by"
ClosurePack }o--|| SurveyReport : "includes"
ClosurePack }o--|| InstallationReport : "includes"
Survey ||--o{ EmergencyEvent : "triggers"
Installation ||--o{ EmergencyEvent : "triggers"
EmergencyEvent ||--o{ BackupSearch : "searches"
EmergencyEvent ||--o| EmergencyAssignment : "resolved by"
EmergencyEvent ||--o| PriorityReschedule : "resolved by"
User ||--o{ Notification : "receives"
Notification }o--o| NotificationTemplate : "uses"
User ||--o{ CallLog : "makes"
Model Summary
Model |
App |
Purpose |
|---|---|---|
User |
accounts |
System user with role, zone, availability |
Role |
accounts |
System role (7 types) |
Team |
accounts |
Field team with zone and specialization |
TeamMembership |
accounts |
User-Team join table |
Zone |
accounts |
Geographic service area |
Lead |
leads |
Installation request from OEM |
LeadSource |
leads |
Lead origin channel |
LeadDocument |
leads |
Customer-uploaded files |
Survey |
surveys |
Scheduled site survey |
SurveyAssignment |
surveys |
Team assigned to survey |
SurveyReport |
surveys |
Site assessment report |
SurveyMedia |
surveys |
Survey photos/videos |
Installation |
installations |
Scheduled charger installation |
InstallationAssignment |
installations |
Team assigned to installation |
InstallationReport |
installations |
Post-installation record |
InstallationMedia |
installations |
Installation photos/videos |
Material |
procurement |
Catalog item (charger, cable, etc.) |
MaterialStock |
procurement |
Zone inventory level |
MaterialAllocation |
procurement |
Material reserved for installation |
ProcurementRequest |
procurement |
Local purchase request |
Vendor |
procurement |
Local supplier |
VendorPayment |
finance |
Payment to vendor |
JobPayout |
finance |
Payment to field team |
PaymentSchedule |
finance |
Team payout frequency |
ClosurePack |
reporting |
Installation closure bundle |
WeeklyReport |
reporting |
Weekly OEM report |
MonthlyReport |
reporting |
Monthly OEM report |
ReportSubmission |
reporting |
Report delivery tracking |
Notification |
notifications |
Message sent to user |
NotificationTemplate |
notifications |
Reusable message template |
CallLog |
notifications |
Phone call record |
DeliveryReceipt |
notifications |
Message delivery confirmation |
EmergencyEvent |
emergency |
Team unavailability event |
BackupSearch |
emergency |
Backup team search log |
EmergencyAssignment |
emergency |
Backup team reassignment |
PriorityReschedule |
emergency |
Rescheduled appointment |