ai_eee_sql_gen / schema.json
laudes's picture
Upload schema.json
b841990 verified
{
"agent_absences": {
"comment": "Records instances when agents are absent from classes",
"columns": [
{
"name": "absence_id",
"data_type": "integer",
"comment": "Unique internal absence ID"
},
{
"name": "agent_id",
"data_type": "integer",
"comment": "Reference to the absent agent"
},
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class affected by the absence"
},
{
"name": "absence_date",
"data_type": "date",
"comment": "Date of the agent's absence"
},
{
"name": "reported_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the absence was reported"
},
{
"name": "reason",
"data_type": "text",
"comment": "Reason for the agent's absence"
}
],
"foreign_keys": [
{
"column": "agent_id",
"references": {
"table": "agents",
"column": "agent_id"
}
},
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
}
]
},
"agent_notes": {
"comment": "Stores historical notes and remarks about agents",
"columns": [
{
"name": "note_id",
"data_type": "integer",
"comment": "Unique internal note ID"
},
{
"name": "agent_id",
"data_type": "integer",
"comment": "Reference to the agent"
},
{
"name": "note_date",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the note was created"
},
{
"name": "note",
"data_type": "text",
"comment": "Content of the note regarding the agent"
}
],
"foreign_keys": [
{
"column": "agent_id",
"references": {
"table": "agents",
"column": "agent_id"
}
}
]
},
"agent_orders": {
"comment": "Stores order information related to agents and classes",
"columns": [
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the order record was last updated"
},
{
"name": "agent_id",
"data_type": "integer",
"comment": "Reference to the agent"
},
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the order record was created"
},
{
"name": "order_id",
"data_type": "integer",
"comment": "Unique internal order ID"
},
{
"name": "class_time",
"data_type": "time without time zone",
"comment": "Time when the class is scheduled"
},
{
"name": "order_hours",
"data_type": "integer",
"comment": "Number of hours linked to the agent's order for a specific class"
},
{
"name": "order_number",
"data_type": "character varying",
"comment": "Valid order number associated with the agent"
},
{
"name": "class_days",
"data_type": "character varying",
"comment": "Days when the class is scheduled"
}
],
"foreign_keys": [
{
"column": "agent_id",
"references": {
"table": "agents",
"column": "agent_id"
}
},
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
}
]
},
"agent_products": {
"comment": "Associates agents with the products they are trained to teach",
"columns": [
{
"name": "agent_id",
"data_type": "integer",
"comment": "Reference to the agent"
},
{
"name": "product_id",
"data_type": "integer",
"comment": "Reference to the product the agent is trained in"
},
{
"name": "trained_start_date",
"data_type": "date",
"comment": "Start date when the agent began training in the product"
},
{
"name": "trained_end_date",
"data_type": "date",
"comment": "End date when the agent finished training in the product"
}
],
"foreign_keys": [
{
"column": "agent_id",
"references": {
"table": "agents",
"column": "agent_id"
}
},
{
"column": "product_id",
"references": {
"table": "products",
"column": "product_id"
}
}
]
},
"agent_qa_visits": {
"comment": "Records QA visits involving agents and classes",
"columns": [
{
"name": "visit_id",
"data_type": "integer",
"comment": "Unique internal QA visit ID"
},
{
"name": "agent_id",
"data_type": "integer",
"comment": "Reference to the agent"
},
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class"
},
{
"name": "visit_date",
"data_type": "date",
"comment": "Date of the QA visit"
},
{
"name": "qa_report_id",
"data_type": "integer",
"comment": "Reference to the associated QA report"
}
],
"foreign_keys": [
{
"column": "agent_id",
"references": {
"table": "agents",
"column": "agent_id"
}
},
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
},
{
"column": "qa_report_id",
"references": {
"table": "qa_reports",
"column": "qa_report_id"
}
}
]
},
"agent_replacements": {
"comment": "Records instances of agent replacements in classes",
"columns": [
{
"name": "replacement_id",
"data_type": "integer",
"comment": "Unique internal replacement ID"
},
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class"
},
{
"name": "original_agent_id",
"data_type": "integer",
"comment": "Reference to the original agent"
},
{
"name": "replacement_agent_id",
"data_type": "integer",
"comment": "Reference to the replacement agent"
},
{
"name": "start_date",
"data_type": "date",
"comment": "Date when the replacement starts"
},
{
"name": "end_date",
"data_type": "date",
"comment": "Date when the replacement ends"
},
{
"name": "reason",
"data_type": "text",
"comment": "Reason for the agent's replacement"
}
],
"foreign_keys": [
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
},
{
"column": "original_agent_id",
"references": {
"table": "agents",
"column": "agent_id"
}
},
{
"column": "replacement_agent_id",
"references": {
"table": "agents",
"column": "agent_id"
}
}
]
},
"agents": {
"comment": "Stores information about agents (instructors or facilitators)",
"columns": [
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the agent record was last updated"
},
{
"name": "residential_town_id",
"data_type": "integer",
"comment": "Reference to the town where the agent lives"
},
{
"name": "preferred_working_area_1",
"data_type": "integer",
"comment": "Agent's first preferred working area"
},
{
"name": "preferred_working_area_2",
"data_type": "integer",
"comment": "Agent's second preferred working area"
},
{
"name": "preferred_working_area_3",
"data_type": "integer",
"comment": "Agent's third preferred working area"
},
{
"name": "sace_registration_date",
"data_type": "date",
"comment": "Date when the agent's SACE registration became effective"
},
{
"name": "sace_expiry_date",
"data_type": "date",
"comment": "Expiry date of the agent's provisional SACE registration"
},
{
"name": "quantum_assesment",
"data_type": "numeric",
"comment": "Agent's competence score in Communications (percentage)"
},
{
"name": "agent_training_date",
"data_type": "date",
"comment": "Date when the agent received induction training"
},
{
"name": "signed_agreement",
"data_type": "boolean",
"comment": "Indicates if the agent has a signed agreement (true) or not (false)"
},
{
"name": "signed_agreement_date",
"data_type": "date",
"comment": "Date when the agent signed the agreement"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the agent record was created"
},
{
"name": "agent_id",
"data_type": "integer",
"comment": "Unique internal agent ID"
},
{
"name": "residential_postal_code",
"data_type": "character varying",
"comment": "Postal code of the agent's residential area"
},
{
"name": "bank_branch_code",
"data_type": "character varying",
"comment": "Branch code of the agent's bank"
},
{
"name": "bank_account_number",
"data_type": "character varying",
"comment": "Agent's bank account number"
},
{
"name": "agent_notes",
"data_type": "text",
"comment": "Notes regarding the agent's performance, issues, or other relevant information"
},
{
"name": "highest_qualification",
"data_type": "character varying",
"comment": "Highest qualification the agent has achieved"
},
{
"name": "sace_registration_number",
"data_type": "character varying",
"comment": "Agent's SACE (South African Council for Educators) registration number"
},
{
"name": "first_name",
"data_type": "character varying",
"comment": "Agent's first name"
},
{
"name": "initials",
"data_type": "character varying",
"comment": "Agent's initials"
},
{
"name": "surname",
"data_type": "character varying",
"comment": "Agent's surname"
},
{
"name": "gender",
"data_type": "character varying",
"comment": "Agent's gender"
},
{
"name": "race",
"data_type": "character varying",
"comment": "Agent's race; options include 'African', 'Coloured', 'White', 'Indian'"
},
{
"name": "sa_id_no",
"data_type": "character varying",
"comment": "Agent's South African ID number"
},
{
"name": "passport_number",
"data_type": "character varying",
"comment": "Agent's passport number if they are a foreigner"
},
{
"name": "tel_number",
"data_type": "character varying",
"comment": "Agent's primary telephone number"
},
{
"name": "email_address",
"data_type": "character varying",
"comment": "Agent's email address"
},
{
"name": "residential_address_line",
"data_type": "character varying",
"comment": "Agent's residential street address"
},
{
"name": "residential_suburb",
"data_type": "character varying",
"comment": "Agent's residential suburb"
},
{
"name": "bank_name",
"data_type": "character varying",
"comment": "Name of the agent's bank"
}
],
"foreign_keys": [
{
"column": "preferred_working_area_1",
"references": {
"table": "locations",
"column": "location_id"
}
},
{
"column": "preferred_working_area_2",
"references": {
"table": "locations",
"column": "location_id"
}
},
{
"column": "preferred_working_area_3",
"references": {
"table": "locations",
"column": "location_id"
}
},
{
"column": "residential_town_id",
"references": {
"table": "locations",
"column": "location_id"
}
}
]
},
"attendance_records": {
"comment": "Associates learners with their attendance status on specific dates",
"columns": [
{
"name": "register_id",
"data_type": "integer",
"comment": "Reference to the attendance register"
},
{
"name": "learner_id",
"data_type": "integer",
"comment": "Reference to the learner"
},
{
"name": "status",
"data_type": "character varying",
"comment": "Attendance status of the learner (e.g., 'Present', 'Absent')"
}
],
"foreign_keys": [
{
"column": "learner_id",
"references": {
"table": "learners",
"column": "learner_id"
}
},
{
"column": "register_id",
"references": {
"table": "attendance_registers",
"column": "register_id"
}
}
]
},
"attendance_registers": {
"comment": "Records attendance registers for classes",
"columns": [
{
"name": "register_id",
"data_type": "integer",
"comment": "Unique internal attendance register ID"
},
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class"
},
{
"name": "date",
"data_type": "date",
"comment": "Date of the attendance"
},
{
"name": "agent_id",
"data_type": "integer",
"comment": "Reference to the agent who conducted the attendance"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the attendance register was created"
},
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the attendance register was last updated"
}
],
"foreign_keys": [
{
"column": "agent_id",
"references": {
"table": "agents",
"column": "agent_id"
}
},
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
}
]
},
"class_agents": {
"comment": "Associates agents with classes they facilitate, including their roles and durations",
"columns": [
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class"
},
{
"name": "agent_id",
"data_type": "integer",
"comment": "Reference to the agent facilitating the class"
},
{
"name": "start_date",
"data_type": "date",
"comment": "Date when the agent started facilitating the class"
},
{
"name": "end_date",
"data_type": "date",
"comment": "Date when the agent stopped facilitating the class"
},
{
"name": "role",
"data_type": "character varying",
"comment": "Role of the agent in the class (e.g., 'Original', 'Backup', 'Replacement')"
}
],
"foreign_keys": [
{
"column": "agent_id",
"references": {
"table": "agents",
"column": "agent_id"
}
},
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
}
]
},
"class_notes": {
"comment": "Stores historical notes and remarks about classes",
"columns": [
{
"name": "note_id",
"data_type": "integer",
"comment": "Unique internal note ID"
},
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class"
},
{
"name": "note_date",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the note was created"
},
{
"name": "note",
"data_type": "text",
"comment": "Content of the note regarding the class"
}
],
"foreign_keys": [
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
}
]
},
"class_schedules": {
"comment": "Stores scheduling information for classes",
"columns": [
{
"name": "schedule_id",
"data_type": "integer",
"comment": "Unique internal schedule ID"
},
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class"
},
{
"name": "start_time",
"data_type": "time without time zone",
"comment": "Class start time"
},
{
"name": "end_time",
"data_type": "time without time zone",
"comment": "Class end time"
},
{
"name": "day_of_week",
"data_type": "character varying",
"comment": "Day of the week when the class occurs (e.g., 'Monday')"
}
],
"foreign_keys": [
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
}
]
},
"class_subjects": {
"comment": "Associates classes with the subjects or products being taught",
"columns": [
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class"
},
{
"name": "product_id",
"data_type": "integer",
"comment": "Reference to the subject or product taught in the class"
}
],
"foreign_keys": [
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
},
{
"column": "product_id",
"references": {
"table": "products",
"column": "product_id"
}
}
]
},
"classes": {
"comment": "Stores information about classes, including scheduling and associations",
"columns": [
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the class record was last updated"
},
{
"name": "client_id",
"data_type": "integer",
"comment": "Reference to the client associated with the class"
},
{
"name": "stop_date",
"data_type": "date",
"comment": "Date when the class stopped"
},
{
"name": "restart_date",
"data_type": "date",
"comment": "Date when the class restarted"
},
{
"name": "seta_funded",
"data_type": "boolean",
"comment": "Indicates if the project is SETA funded (true) or not (false)"
},
{
"name": "exam_class",
"data_type": "boolean",
"comment": "Indicates if this is an exam project (true) or not (false)"
},
{
"name": "project_supervisor_id",
"data_type": "integer",
"comment": "Reference to the project supervisor managing the class"
},
{
"name": "delivery_date",
"data_type": "date",
"comment": "Date when materials or resources must be delivered to the class"
},
{
"name": "collection_date",
"data_type": "date",
"comment": "Date when portfolios or materials must be collected from the class"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the class record was created"
},
{
"name": "class_id",
"data_type": "integer",
"comment": "Unique internal class ID"
},
{
"name": "class_town_id",
"data_type": "integer",
"comment": "Reference to the town where the class takes place"
},
{
"name": "original_start_date",
"data_type": "date",
"comment": "Original start date of the class"
},
{
"name": "class_site_name",
"data_type": "character varying",
"comment": "Name of the class or site"
},
{
"name": "class_address_line",
"data_type": "character varying",
"comment": "Street address where the class takes place"
},
{
"name": "class_suburb",
"data_type": "character varying",
"comment": "Suburb where the class takes place"
},
{
"name": "class_notes",
"data_type": "text",
"comment": "Notes about the class; important information to remember"
},
{
"name": "class_postal_code",
"data_type": "character varying",
"comment": "Postal code of the class location"
},
{
"name": "class_type",
"data_type": "character varying",
"comment": "Type of class; determines the 'rules' (e.g., 'Employed', 'Community')"
},
{
"name": "class_status",
"data_type": "character varying",
"comment": "Status of the class (e.g., 'New', 'Restarted', 'Stopped')"
},
{
"name": "exam_type",
"data_type": "character varying",
"comment": "Type of exam associated with the class"
},
{
"name": "seta",
"data_type": "character varying",
"comment": "Name of the SETA (Sector Education and Training Authority) the client belongs to"
}
],
"foreign_keys": [
{
"column": "class_town_id",
"references": {
"table": "locations",
"column": "location_id"
}
},
{
"column": "client_id",
"references": {
"table": "clients",
"column": "client_id"
}
},
{
"column": "project_supervisor_id",
"references": {
"table": "users",
"column": "user_id"
}
}
]
},
"client_communications": {
"comment": "Stores records of communications with clients",
"columns": [
{
"name": "client_id",
"data_type": "integer",
"comment": "Reference to the client"
},
{
"name": "communication_date",
"data_type": "timestamp without time zone",
"comment": "Date and time when the communication occurred"
},
{
"name": "user_id",
"data_type": "integer",
"comment": "Reference to the user who communicated with the client"
},
{
"name": "communication_id",
"data_type": "integer",
"comment": "Unique internal communication ID"
},
{
"name": "subject",
"data_type": "character varying",
"comment": "Subject of the communication"
},
{
"name": "communication_type",
"data_type": "character varying",
"comment": "Type of communication (e.g., 'Email', 'Phone Call')"
},
{
"name": "content",
"data_type": "text",
"comment": "Content or summary of the communication"
}
],
"foreign_keys": [
{
"column": "client_id",
"references": {
"table": "clients",
"column": "client_id"
}
},
{
"column": "user_id",
"references": {
"table": "users",
"column": "user_id"
}
}
]
},
"client_contact_persons": {
"comment": "Stores contact person information for clients",
"columns": [
{
"name": "contact_id",
"data_type": "integer",
"comment": "Unique internal contact person ID"
},
{
"name": "client_id",
"data_type": "integer",
"comment": "Reference to the client"
},
{
"name": "first_name",
"data_type": "character varying",
"comment": "First name of the contact person"
},
{
"name": "surname",
"data_type": "character varying",
"comment": "Surname of the contact person"
},
{
"name": "email",
"data_type": "character varying",
"comment": "Email address of the contact person"
},
{
"name": "cellphone_number",
"data_type": "character varying",
"comment": "Cellphone number of the contact person"
},
{
"name": "tel_number",
"data_type": "character varying",
"comment": "Landline number of the contact person"
},
{
"name": "position",
"data_type": "character varying",
"comment": "Position or role of the contact person at the client company"
}
],
"foreign_keys": [
{
"column": "client_id",
"references": {
"table": "clients",
"column": "client_id"
}
}
]
},
"clients": {
"comment": "Stores information about clients (companies or organizations)",
"columns": [
{
"name": "client_id",
"data_type": "integer",
"comment": "Unique internal client ID"
},
{
"name": "branch_of",
"data_type": "integer",
"comment": "Reference to the parent client if this client is a branch"
},
{
"name": "town_id",
"data_type": "integer",
"comment": "Reference to the town where the client is located"
},
{
"name": "financial_year_end",
"data_type": "date",
"comment": "Date of the client's financial year-end"
},
{
"name": "bbbee_verification_date",
"data_type": "date",
"comment": "Date of the client's BBBEE verification"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the client record was created"
},
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the client record was last updated"
},
{
"name": "postal_code",
"data_type": "character varying",
"comment": "Postal code of the client's location"
},
{
"name": "client_name",
"data_type": "character varying",
"comment": "Name of the client company or organization"
},
{
"name": "seta",
"data_type": "character varying",
"comment": "SETA the client belongs to"
},
{
"name": "company_registration_number",
"data_type": "character varying",
"comment": "Company registration number of the client"
},
{
"name": "address_line",
"data_type": "character varying",
"comment": "Client's street address"
},
{
"name": "suburb",
"data_type": "character varying",
"comment": "Suburb where the client is located"
},
{
"name": "client_status",
"data_type": "character varying",
"comment": "Current status of the client (e.g., 'Active Client', 'Lost Client')"
}
],
"foreign_keys": [
{
"column": "branch_of",
"references": {
"table": "clients",
"column": "client_id"
}
},
{
"column": "town_id",
"references": {
"table": "locations",
"column": "location_id"
}
}
]
},
"collections": {
"comment": "Records collections made from classes",
"columns": [
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the collection record was created"
},
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the collection record was last updated"
},
{
"name": "collection_date",
"data_type": "date",
"comment": "Date when the collection is scheduled or occurred"
},
{
"name": "collection_id",
"data_type": "integer",
"comment": "Unique internal collection ID"
},
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class"
},
{
"name": "items",
"data_type": "text",
"comment": "Items collected from the class"
},
{
"name": "status",
"data_type": "character varying",
"comment": "Collection status (e.g., 'Pending', 'Collected')"
}
],
"foreign_keys": [
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
}
]
},
"deliveries": {
"comment": "Records deliveries made to classes",
"columns": [
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the delivery record was created"
},
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the delivery record was last updated"
},
{
"name": "delivery_date",
"data_type": "date",
"comment": "Date when the delivery is scheduled or occurred"
},
{
"name": "delivery_id",
"data_type": "integer",
"comment": "Unique internal delivery ID"
},
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class"
},
{
"name": "items",
"data_type": "text",
"comment": "Items included in the delivery"
},
{
"name": "status",
"data_type": "character varying",
"comment": "Delivery status (e.g., 'Pending', 'Delivered')"
}
],
"foreign_keys": [
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
}
]
},
"employers": {
"comment": "Stores information about employers or sponsors of learners",
"columns": [
{
"name": "employer_id",
"data_type": "integer",
"comment": "Unique internal employer ID"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the employer record was created"
},
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the employer record was last updated"
},
{
"name": "employer_name",
"data_type": "character varying",
"comment": "Name of the employer or sponsoring organization"
}
],
"foreign_keys": []
},
"exam_results": {
"comment": "Stores detailed exam results for learners",
"columns": [
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the exam result was last updated"
},
{
"name": "exam_id",
"data_type": "integer",
"comment": "Reference to the exam"
},
{
"name": "learner_id",
"data_type": "integer",
"comment": "Reference to the learner"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the exam result was created"
},
{
"name": "result_id",
"data_type": "integer",
"comment": "Unique internal exam result ID"
},
{
"name": "mock_exam_number",
"data_type": "integer",
"comment": "Number of the mock exam (e.g., 1, 2, 3)"
},
{
"name": "score",
"data_type": "numeric",
"comment": "Learner's score in the exam"
},
{
"name": "exam_date",
"data_type": "date",
"comment": "Date when the exam was taken"
},
{
"name": "subject",
"data_type": "character varying",
"comment": "Subject of the exam"
},
{
"name": "result",
"data_type": "character varying",
"comment": "Exam result (e.g., 'Pass', 'Fail')"
}
],
"foreign_keys": [
{
"column": "exam_id",
"references": {
"table": "exams",
"column": "exam_id"
}
},
{
"column": "learner_id",
"references": {
"table": "learners",
"column": "learner_id"
}
}
]
},
"exams": {
"comment": "Stores exam results for learners",
"columns": [
{
"name": "exam_id",
"data_type": "integer",
"comment": "Unique internal exam ID"
},
{
"name": "learner_id",
"data_type": "integer",
"comment": "Reference to the learner"
},
{
"name": "product_id",
"data_type": "integer",
"comment": "Reference to the product or subject"
},
{
"name": "exam_date",
"data_type": "date",
"comment": "Date when the exam was taken"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the exam record was created"
},
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the exam record was last updated"
},
{
"name": "score",
"data_type": "numeric",
"comment": "Learner's score in the exam"
},
{
"name": "exam_type",
"data_type": "character varying",
"comment": "Type of exam (e.g., 'Mock', 'Final')"
},
{
"name": "result",
"data_type": "character varying",
"comment": "Exam result (e.g., 'Pass', 'Fail')"
}
],
"foreign_keys": [
{
"column": "learner_id",
"references": {
"table": "learners",
"column": "learner_id"
}
},
{
"column": "product_id",
"references": {
"table": "products",
"column": "product_id"
}
}
]
},
"files": {
"comment": "Stores references to files associated with various entities",
"columns": [
{
"name": "file_id",
"data_type": "integer",
"comment": "Unique internal file ID"
},
{
"name": "owner_id",
"data_type": "integer",
"comment": "ID of the owner entity"
},
{
"name": "uploaded_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the file was uploaded"
},
{
"name": "owner_type",
"data_type": "character varying",
"comment": "Type of entity that owns the file (e.g., 'Learner', 'Class', 'Agent')"
},
{
"name": "file_path",
"data_type": "character varying",
"comment": "File path or URL to the stored file"
},
{
"name": "file_type",
"data_type": "character varying",
"comment": "Type of file (e.g., 'Scanned Portfolio', 'QA Report')"
}
],
"foreign_keys": []
},
"history": {
"comment": "Records historical changes and actions performed on entities",
"columns": [
{
"name": "action_date",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the action occurred"
},
{
"name": "user_id",
"data_type": "integer",
"comment": "Reference to the user who performed the action"
},
{
"name": "entity_id",
"data_type": "integer",
"comment": "ID of the entity"
},
{
"name": "history_id",
"data_type": "integer",
"comment": "Unique internal history ID"
},
{
"name": "changes",
"data_type": "jsonb",
"comment": "Details of the changes made, stored in JSON format"
},
{
"name": "action",
"data_type": "character varying",
"comment": "Type of action performed (e.g., 'Created', 'Updated', 'Deleted')"
},
{
"name": "entity_type",
"data_type": "character varying",
"comment": "Type of entity the history record refers to (e.g., 'Learner', 'Agent', 'Class')"
}
],
"foreign_keys": [
{
"column": "user_id",
"references": {
"table": "users",
"column": "user_id"
}
}
]
},
"learner_products": {
"comment": "Associates learners with the products they are enrolled in",
"columns": [
{
"name": "learner_id",
"data_type": "integer",
"comment": "Reference to the learner"
},
{
"name": "product_id",
"data_type": "integer",
"comment": "Reference to the product the learner is enrolled in"
},
{
"name": "start_date",
"data_type": "date",
"comment": "Start date of the learner's enrollment in the product"
},
{
"name": "end_date",
"data_type": "date",
"comment": "End date of the learner's enrollment in the product"
}
],
"foreign_keys": [
{
"column": "learner_id",
"references": {
"table": "learners",
"column": "learner_id"
}
},
{
"column": "product_id",
"references": {
"table": "products",
"column": "product_id"
}
}
]
},
"learner_progressions": {
"comment": "Tracks the progression of learners between products",
"columns": [
{
"name": "progression_id",
"data_type": "integer",
"comment": "Unique internal progression ID"
},
{
"name": "learner_id",
"data_type": "integer",
"comment": "Reference to the learner"
},
{
"name": "from_product_id",
"data_type": "integer",
"comment": "Reference to the initial product"
},
{
"name": "to_product_id",
"data_type": "integer",
"comment": "Reference to the new product after progression"
},
{
"name": "progression_date",
"data_type": "date",
"comment": "Date when the learner progressed to the new product"
},
{
"name": "notes",
"data_type": "text",
"comment": "Additional notes regarding the progression"
}
],
"foreign_keys": [
{
"column": "from_product_id",
"references": {
"table": "products",
"column": "product_id"
}
},
{
"column": "learner_id",
"references": {
"table": "learners",
"column": "learner_id"
}
},
{
"column": "to_product_id",
"references": {
"table": "products",
"column": "product_id"
}
}
]
},
"learners": {
"comment": "Stores personal, educational, and assessment information about learners",
"columns": [
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the learner record was last updated"
},
{
"name": "city_town_id",
"data_type": "integer",
"comment": "Reference to the city or town where the learner lives"
},
{
"name": "province_region_id",
"data_type": "integer",
"comment": "Reference to the province/region where the learner lives"
},
{
"name": "placement_assessment_date",
"data_type": "date",
"comment": "Date when the learner took the placement assessment"
},
{
"name": "employment_status",
"data_type": "boolean",
"comment": "Indicates if the learner is employed (true) or not (false)"
},
{
"name": "employer_id",
"data_type": "integer",
"comment": "Reference to the learner's employer or sponsor"
},
{
"name": "disability_status",
"data_type": "boolean",
"comment": "Indicates if the learner has a disability (true) or not (false)"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the learner record was created"
},
{
"name": "learner_id",
"data_type": "integer",
"comment": "Unique internal learner ID"
},
{
"name": "alternative_tel_number",
"data_type": "character varying",
"comment": "Learner's alternative contact number"
},
{
"name": "email_address",
"data_type": "character varying",
"comment": "Learner's email address"
},
{
"name": "address_line_1",
"data_type": "character varying",
"comment": "First line of learner's physical address"
},
{
"name": "address_line_2",
"data_type": "character varying",
"comment": "Second line of learner's physical address"
},
{
"name": "scanned_portfolio",
"data_type": "character varying",
"comment": "File path or URL to the learner's scanned portfolio in PDF format"
},
{
"name": "placement_level",
"data_type": "character varying",
"comment": "Learner's initial placement level in Communications (e.g., 'CL1b', 'CL1', 'CL2')"
},
{
"name": "postal_code",
"data_type": "character varying",
"comment": "Postal code of the learner's area"
},
{
"name": "highest_qualification",
"data_type": "character varying",
"comment": "Highest qualification the learner has achieved"
},
{
"name": "assessment_status",
"data_type": "character varying",
"comment": "Assessment status; indicates if the learner was assessed ('Assessed', 'Not Assessed')"
},
{
"name": "first_name",
"data_type": "character varying",
"comment": "Learner's first name"
},
{
"name": "initials",
"data_type": "character varying",
"comment": "Learner's initials"
},
{
"name": "surname",
"data_type": "character varying",
"comment": "Learner's surname"
},
{
"name": "gender",
"data_type": "character varying",
"comment": "Learner's gender"
},
{
"name": "race",
"data_type": "character varying",
"comment": "Learner's race; options include 'African', 'Coloured', 'White', 'Indian'"
},
{
"name": "sa_id_no",
"data_type": "character varying",
"comment": "Learner's South African ID number"
},
{
"name": "passport_number",
"data_type": "character varying",
"comment": "Learner's passport number if they are a foreigner"
},
{
"name": "tel_number",
"data_type": "character varying",
"comment": "Learner's primary telephone number"
}
],
"foreign_keys": [
{
"column": "city_town_id",
"references": {
"table": "locations",
"column": "location_id"
}
},
{
"column": "employer_id",
"references": {
"table": "employers",
"column": "employer_id"
}
},
{
"column": "province_region_id",
"references": {
"table": "locations",
"column": "location_id"
}
}
]
},
"locations": {
"comment": "Stores geographical location data for addresses",
"columns": [
{
"name": "location_id",
"data_type": "integer",
"comment": "Unique internal location ID"
},
{
"name": "longitude",
"data_type": "numeric",
"comment": "Geographical longitude coordinate"
},
{
"name": "latitude",
"data_type": "numeric",
"comment": "Geographical latitude coordinate"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the location record was created"
},
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the location record was last updated"
},
{
"name": "suburb",
"data_type": "character varying",
"comment": "Suburb name"
},
{
"name": "town",
"data_type": "character varying",
"comment": "Town name"
},
{
"name": "province",
"data_type": "character varying",
"comment": "Province name"
},
{
"name": "postal_code",
"data_type": "character varying",
"comment": "Postal code"
}
],
"foreign_keys": []
},
"products": {
"comment": "Stores information about educational products or courses",
"columns": [
{
"name": "product_id",
"data_type": "integer",
"comment": "Unique internal product ID"
},
{
"name": "product_duration",
"data_type": "integer",
"comment": "Total duration of the product in hours"
},
{
"name": "learning_area_duration",
"data_type": "integer",
"comment": "Duration of each learning area in hours"
},
{
"name": "parent_product_id",
"data_type": "integer",
"comment": "Reference to a parent product for hierarchical structuring"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the product record was created"
},
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the product record was last updated"
},
{
"name": "product_notes",
"data_type": "text",
"comment": "Notes or additional information about the product"
},
{
"name": "product_name",
"data_type": "character varying",
"comment": "Name of the product or course"
},
{
"name": "product_rules",
"data_type": "text",
"comment": "Rules or guidelines associated with the product"
},
{
"name": "learning_area",
"data_type": "character varying",
"comment": "Learning areas covered by the product (e.g., 'Communication', 'Numeracy')"
},
{
"name": "product_flags",
"data_type": "text",
"comment": "Flags or alerts for the product (e.g., attendance thresholds)"
},
{
"name": "reporting_structure",
"data_type": "text",
"comment": "Structure of progress reports for the product"
}
],
"foreign_keys": [
{
"column": "parent_product_id",
"references": {
"table": "products",
"column": "product_id"
}
}
]
},
"progress_reports": {
"comment": "Stores progress reports for learners in specific classes and products",
"columns": [
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the progress report was last updated"
},
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class"
},
{
"name": "learner_id",
"data_type": "integer",
"comment": "Reference to the learner"
},
{
"name": "product_id",
"data_type": "integer",
"comment": "Reference to the product or subject"
},
{
"name": "progress_percentage",
"data_type": "numeric",
"comment": "Learner's progress percentage in the product"
},
{
"name": "report_date",
"data_type": "date",
"comment": "Date when the progress report was generated"
},
{
"name": "report_id",
"data_type": "integer",
"comment": "Unique internal progress report ID"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the progress report was created"
},
{
"name": "remarks",
"data_type": "text",
"comment": "Additional remarks or comments"
}
],
"foreign_keys": [
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
},
{
"column": "learner_id",
"references": {
"table": "learners",
"column": "learner_id"
}
},
{
"column": "product_id",
"references": {
"table": "products",
"column": "product_id"
}
}
]
},
"qa_reports": {
"comment": "Stores QA (Quality Assurance) reports for classes and agents",
"columns": [
{
"name": "qa_report_id",
"data_type": "integer",
"comment": "Unique internal QA report ID"
},
{
"name": "class_id",
"data_type": "integer",
"comment": "Reference to the class"
},
{
"name": "agent_id",
"data_type": "integer",
"comment": "Reference to the agent"
},
{
"name": "report_date",
"data_type": "date",
"comment": "Date when the QA report was created"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the QA report was created"
},
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the QA report was last updated"
},
{
"name": "report_file",
"data_type": "character varying",
"comment": "File path or URL to the QA report"
},
{
"name": "notes",
"data_type": "text",
"comment": "Additional notes or observations from the QA report"
}
],
"foreign_keys": [
{
"column": "agent_id",
"references": {
"table": "agents",
"column": "agent_id"
}
},
{
"column": "class_id",
"references": {
"table": "classes",
"column": "class_id"
}
}
]
},
"user_permissions": {
"comment": "Grants specific permissions to users",
"columns": [
{
"name": "permission_id",
"data_type": "integer",
"comment": "Unique internal permission ID"
},
{
"name": "user_id",
"data_type": "integer",
"comment": "Reference to the user"
},
{
"name": "permission",
"data_type": "character varying",
"comment": "Specific permission granted to the user"
}
],
"foreign_keys": [
{
"column": "user_id",
"references": {
"table": "users",
"column": "user_id"
}
}
]
},
"user_roles": {
"comment": "Defines roles and associated permissions for users",
"columns": [
{
"name": "role_id",
"data_type": "integer",
"comment": "Unique internal role ID"
},
{
"name": "permissions",
"data_type": "jsonb",
"comment": "Permissions associated with the role, stored in JSON format"
},
{
"name": "role_name",
"data_type": "character varying",
"comment": "Name of the role (e.g., 'Admin', 'Project Supervisor')"
}
],
"foreign_keys": []
},
"users": {
"comment": "Stores system user information",
"columns": [
{
"name": "user_id",
"data_type": "integer",
"comment": "Unique internal user ID"
},
{
"name": "created_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the user record was created"
},
{
"name": "updated_at",
"data_type": "timestamp without time zone",
"comment": "Timestamp when the user record was last updated"
},
{
"name": "email",
"data_type": "character varying",
"comment": "User's email address"
},
{
"name": "cellphone_number",
"data_type": "character varying",
"comment": "User's cellphone number"
},
{
"name": "role",
"data_type": "character varying",
"comment": "User's role in the system, e.g., 'Admin', 'Project Supervisor'"
},
{
"name": "password_hash",
"data_type": "character varying",
"comment": "Hashed password for user authentication"
},
{
"name": "first_name",
"data_type": "character varying",
"comment": "User's first name"
},
{
"name": "surname",
"data_type": "character varying",
"comment": "User's surname"
}
],
"foreign_keys": []
}
}