File size: 8,468 Bytes
909cddd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
## Request
IMPORTANT ! Use the "Database Schema" below

Here’s a list describing what I want you to asist me with:

1. **Generate Demo Data**: Create demo data for a PostgreSQL database with at least 25 entries per table, considering the relationships between the tables.
   
2. **Focus on South African Context**: The demo data must reflect South African specifics, such as:
   - South African names for agents, clients, and learners.
   - South African locations (cities and towns) for agents, clients, and class sites.
   - South African phone numbers (+27 format).
   - Realistic South African ID numbers.

3. **Tables to Include**: Populate demo data for the following 13 tables:
   - **agents**
   - **clients**
   - **classes**
   - **learners**
   - **assessments**
   - **progressions**
   - **tasks**
   - **deliveries**
   - **events**
   - **reports**
   - **agent_assignments**
   - **agent_availability**
   - **agent_work_history**

4. **SQL Format**: The data should be returned in SQL `INSERT INTO` statements with multiple rows, following a format like:
   ```sql
   INSERT INTO agents (name, email, phone, specialization, experience, current_workload, location, status, created_at, updated_at) VALUES
   ('Thabo Mokoena', 'thabo.mokoena@example.co.za', '+27831234567', 'Math Tutor', 5, 3, 'Johannesburg', 'Active', NOW(), NOW()),
   ('Naledi Khumalo', 'naledi.khumalo@example.co.za', '+27836543210', 'Science Instructor', 8, 2, 'Pretoria', 'Active', NOW(), NOW());
   ```

5. **Ensure Data Consistency**: The generated data should respect the foreign key relationships between the tables, ensuring that IDs referenced in one table (e.g., class_id) exist in the appropriate related table.

6. **Provide the Data as a Downloadable SQL File**: Finally, package the SQL insertions for all 13 tables into a downloadable `.sql` file.



## Database Schema:

Table agent_availability (Comment: None):
  - id (integer) (Comment: None)
  - agent_id (integer) (Comment: None)
  - available_date (date) (Comment: None)
  - availability_status (character varying) (Comment: None)
  - reason (text) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
Table agent_work_history (Comment: None):
  - id (integer) (Comment: None)
  - agent_id (integer) (Comment: None)
  - class_id (integer) (Comment: None)
  - task_id (integer) (Comment: None)
  - start_date (date) (Comment: None)
  - end_date (date) (Comment: None)
  - role (character varying) (Comment: None)
  - performance_notes (text) (Comment: None)
  - reassignment_id (integer) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
  Foreign Keys:
    - class_id references classes(id)
    - task_id references tasks(id)
Table agents (Comment: None):
  - id (integer) (Comment: None)
  - name (character varying) (Comment: None)
  - email (character varying) (Comment: None)
  - phone (character varying) (Comment: None)
  - specialization (character varying) (Comment: None)
  - experience (integer) (Comment: None)
  - current_workload (integer) (Comment: None)
  - location (character varying) (Comment: None)
  - status (character varying) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
  - sms (character varying) (Comment: None)
Table assessments (Comment: None):
  - id (integer) (Comment: None)
  - class_id (integer) (Comment: None)
  - assessment_type (character varying) (Comment: None)
  - assessment_date (date) (Comment: None)
  - result (character varying) (Comment: None)
  - assessor_name (character varying) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
  Foreign Keys:
    - class_id references classes(id)
Table classes (Comment: None):
  - id (integer) (Comment: None)
  - client_id (integer) (Comment: None)
  - site (character varying) (Comment: None)
  - start_date (date) (Comment: None)
  - end_date (date) (Comment: None)
  - status (character varying) (Comment: None)
  - attendance_status (character varying) (Comment: None)
  - progression_status (character varying) (Comment: None)
  - subject (character varying) (Comment: None)
  - phase (character varying) (Comment: None)
  - marketer (character varying) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
Table clients (Comment: None):
  - id (integer) (Comment: None)
  - name (character varying) (Comment: None)
  - contact_person (character varying) (Comment: None)
  - email (character varying) (Comment: None)
  - phone (character varying) (Comment: None)
  - address (text) (Comment: None)
  - status (character varying) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
Table deliveries (Comment: None):
  - id (integer) (Comment: None)
  - class_id (integer) (Comment: None)
  - delivery_type (character varying) (Comment: None)
  - delivery_date (date) (Comment: None)
  - status (character varying) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
  Foreign Keys:
    - class_id references classes(id)
Table events (Comment: None):
  - id (integer) (Comment: None)
  - name (character varying) (Comment: None)
  - client_id (integer) (Comment: None)
  - class_id (integer) (Comment: None)
  - event_type (character varying) (Comment: None)
  - event_date (date) (Comment: None)
  - reminder_date (date) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
  Foreign Keys:
    - class_id references classes(id)
Table learners (Comment: None):
  - id (integer) (Comment: None)
  - name (character varying) (Comment: None)
  - gender (character varying) (Comment: None)
  - race (character varying) (Comment: None)
  - id_number (character varying) (Comment: None)
  - class_id (integer) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
  Foreign Keys:
    - class_id references classes(id)
Table progressions (Comment: None):
  - id (integer) (Comment: None)
  - class_id (integer) (Comment: None)
  - learner_id (integer) (Comment: None)
  - progression_level (character varying) (Comment: None)
  - completion_date (date) (Comment: None)
  - status (character varying) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
  Foreign Keys:
    - class_id references classes(id)
    - learner_id references learners(id)
Table reports (Comment: None):
  - id (integer) (Comment: None)
  - report_type (character varying) (Comment: None)
  - related_class_id (integer) (Comment: None)
  - related_client_id (integer) (Comment: None)
  - content (text) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
  Foreign Keys:
    - related_class_id references classes(id)
Table tasks (Comment: None):
  - id (integer) (Comment: None)
  - event_id (integer) (Comment: None)
  - description (text) (Comment: None)
  - due_date (date) (Comment: None)
  - status (character varying) (Comment: None)
  - assigned_to (character varying) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
  Foreign Keys:
    - event_id references events(id)
Table agent_assignments (Comment: None):
  - id (integer) (Comment: None)
  - agent_id (integer) (Comment: None)
  - class_id (integer) (Comment: None)
  - task_id (integer) (Comment: None)
  - assignment_date (date) (Comment: None)
  - reassigned_agent_id (integer) (Comment: None)
  - reassignment_date (date) (Comment: None)
  - reassignment_reason (text) (Comment: None)
  - status (character varying) (Comment: None)
  - created_at (timestamp without time zone) (Comment: None)
  - updated_at (timestamp without time zone) (Comment: None)
  Foreign Keys:
    - class_id references classes(id)
    - task_id references tasks(id)