Proje: Okul Platform · Hub: Okul Platform — Architecture

TÜBİTAK AR-GE #7260485 — Database Schema Reference for Data Science

Extracted from the live Okul Platform codebase. All table names, column names, and types are sourced from Laravel migrations and Eloquent models. This document is the ground truth for the data scientist working on the AR-GE project.


Domain 1 — School Profiles

schools

ColumnTypeNotes
idPK
namestringSchool name
descriptiontextRich description
missiontext
visiontext
historytext
psychological_adviceenum
total_studentsintCapacity
class_studentsintStudents per class
school_type_idFK → schools_types
sector_idFK → sectors
franchise_idFK → schools_franchises
customer_idFK → customersB2B owner
campus_idFK
college_idFK
statusenumactive/passive/etc.
school_closedbool
redirect_idFK → schoolsFor merged schools
deleted_attimestampSoft delete

Key relations: hasMany → school_locations, school_contacts, school_comments, school_fees, school_facilities, school_activities, school_learning_languages, school_shifts, school_interactions, school_daily_logs

school_details

Flexible key-value store for school attributes beyond core columns.

ColumnTypeNotes
idPK
type_idintConfig-based key
school_idFK → schools
valuestringAttribute value
deleted_attimestampSoft delete

school_locations

ColumnTypeNotes
school_idFK → schools
location_level_1FK → locationsProvince
location_level_2FK → locationsDistrict
location_level_3FK → locationsNeighbourhood
addressstringFull address
map_latitudedecimalGPS lat
map_longitudedecimalGPS lng
mernis_address_codestringOfficial address code

school_contacts

ColumnTypeNotes
school_idFK → schools
valuestringPhone / email / URL
type_idintConfig: phone, email, fax, web, inbound_number, wp_phone, authorized_name, authorized_email

school_fees

ColumnTypeNotes
school_idFK → schools
gradestringGrade level
fee_type_idFK → configsAnnual/registration/etc.
amountdecimalTuition amount

school_facilities / school_activities / school_learning_languages / school_shifts

Pivot tables linking schools to master data: facilities, activities, languages, shifts.

Reference tables

  • schools_typesid, name, slug (Private, Public, International, etc.)
  • sectorsid, name (K-12, Higher Education, etc.)
  • schools_franchisesid, name
  • locationsid, name, level, parent_id, plate, mernis_code (geographic hierarchy)

Domain 2 — Users & Family Profiles

users

ColumnTypeNotes
idPK
namestring
emailstring unique
passwordstring(60)Hashed
remember_tokenstring

user_details

ColumnTypeNotes
user_idFK → users
phonestring
cityFK → locations
avatarstring
birth_datedate
deleted_attimestampSoft delete

parents

Introduced 2024. Can be linked to a users account or standalone (no login required).

ColumnTypeNotes
idPK
first_namestring
last_namestring
emailstring
parent_typestring
phonestring
notetext
user_idFK → users nullable
kvkkenumConsent status
statusenumactive/inactive
unsubscribebool
email_verified_attimestamp
phone_verified_attimestamp
deleted_attimestampSoft delete

Relations: belongsToMany → families (via family_parent)

students

Introduced 2024.

ColumnTypeNotes
idPK
first_namestring
last_namestring
date_of_birthdateAge derived via accessor
genderchar
class_leveltinyIntGrade
special_conditionstringSpecial needs flag
current_school_idFK → schools nullable
notetext
deleted_attimestampSoft delete

Relations: belongsToMany → families (via family_student)

families

ColumnTypeNotes
idPK
namestringFamily display name
deleted_attimestampSoft delete

Relations: hasMany → parents (via family_parent), students (via family_student), family_notes, family_appointments

Pivot tables

  • family_parent(family_id, parent_id) composite PK
  • family_student(family_id, student_id) composite PK

family_notes

ColumnTypeNotes
family_idFK → families
notetextInternal CRM note
deleted_attimestampSoft delete

Domain 3 — Reviews & Ratings

school_comments

900,000+ rows. Core content for sentiment analysis and RAG knowledge base.

ColumnTypeNotes
idPK
school_idFK → schools
user_idFK → users nullableLogged-in commenter
user_type_idFK → users_types
commenter_namestringDisplay name (may be hidden)
commenter_emailstring
commenttext (utf8mb4)Positive review body
comment_negativetextNegative review body
student_namestring
student_date_of_birthdate
comment_rateenum(1-5)Star rating
do_recommendenumRecommend flag
rated_upintUpvotes
rated_downintDownvotes
show_home_pageboolFeatured flag
statusenumpending/approved/rejected
approved_byFK → usersModerator
approved_attimestamp
approved_typeenumpositive/negative/critical
rejected_attimestamp
reject_stagestring
reject_notetextRejection reason
lead_statusstring
registration_statusstring
hidden_commenter_namestringAnonymized name
replied_idFK → school_comments selfParent comment (for replies)
deleted_attimestampSoft delete

Relations: belongsTo School, User (commenter), User (approver); self-join for threaded replies

Data science notes:

  • Use status = 'approved' for training data
  • comment + comment_negative = dual-field review (positive + negative aspects separately)
  • comment_rate (1-5) + do_recommend usable as label signals
  • replied_id enables reply threading — filter nulls for root reviews

Domain 4 — Leads & Inquiries

leads

145,000+ per year. Primary conversion signal for both B2C and B2B agents.

ColumnTypeNotes
idPK
school_idFK → schoolsTarget school
user_idFK → users nullableLogged-in user
namestringLead contact name
emailstring
phonestring
student_classstringGrade level of interest
date_of_birthdateStudent DOB
student_namestring
refstringSource: lead-pool / college-page / school-profile / article-content / school-listing
refererstringHTTP referer URL
typeenumoffer / early-registration / scholarship
messagetextFree-text inquiry
agentFK → usersAssigned sales agent
approved_byFK → users
approved_typeenumoffer/early-registration/scholarship
approved_status_idFK → configs
contact_referenceenumcall / form
statusstringPipeline status
lead_pool_idFK → lead_pool_formsIf originated from pool
pipeline_idstringPipedrive pipeline
stage_idstringPipedrive stage
reason_of_rejecttext
transmitted_authorizedenumiletilen/yetkili
customer_viewed_attimestampWhen school viewed this lead
entry_methodstring
is_lead_plusboolPremium lead flag
deleted_attimestampSoft delete

Data science notes:

  • ref is the acquisition channel — critical for funnel analysis
  • type + approved_type = intent classification ground truth
  • customer_viewed_at usable as engagement signal for B2B agent
  • is_lead_plus marks premium leads — separate model needed

lead_pool_forms

Parent requests not yet matched to a specific school.

ColumnTypeNotes
user_idFK → users nullable
name, email, phonestringContact
school_type_idFK → schools_typesPreference
messagetextFree-text need
student_classstring
date_of_birthdate
location_level_1/2/3FK → locationsGeographic preference
amount_range_min/maxdecimalBudget range
status_idFK → configs
typestring
deleted_attimestampSoft delete

Domain 5 — Behavioral & Interaction Data

school_daily_logs

Aggregated daily metrics per school. Primary source for engagement trend analysis.

ColumnTypeNotes
school_idFK → schools
page_viewintProfile page views
phone_viewintPhone number reveal clicks
call_phoneintClick-to-call events
fee_viewintFee/tuition section opens
lead_countintLeads generated that day
is_customerboolIs the school a paying customer
datedateAggregation date
wp_clickintWhatsApp button clicks
site_clickintWebsite link clicks
google_clickintGoogle Maps / directions clicks

Data science notes:

  • No timestamps — batch-inserted nightly
  • Key engagement funnel: page_viewphone_view / fee_viewwp_click / call_phonelead_count
  • is_customer allows A/B comparison between paying vs. non-paying schools
  • Join with schools on school_id to enrich with type, location, sector

school_interactions

CRM interaction log between sales team and schools.

ColumnTypeNotes
school_idFK → schools
user_idFK → usersSales agent
connection_type_idFK → configsCall/email/visit/etc.
reason_idFK → configsWhy contacted
result_idFK → configsOutcome
notetextInteraction notes
interaction_type_idint
reminder_timetimestampFollow-up reminder
note_visible_for_customerboolCustomer-visible flag
pinned_attimestampPinned interactions
deleted_attimestampSoft delete

Relations: hasMany → SchoolInteractionTopic (discussion topics per interaction)

user_favorites

ColumnTypeNotes
user_idFK → users
school_idFK → schools
deleted_attimestampSoft delete

Data science note: Explicit positive signal. Rare but high-confidence preference indicator.

user_logs

ColumnTypeNotes
ip_addressstring
user_agentstringBrowser/device
urlstringPage visited
created_attimestamp

activity_log

ColumnTypeNotes
user_idFK → users
content_idintEntity ID
content_typestringEntity type (polymorphic)
actionstringcreate/update/delete/etc.
descriptionstring
detailstextFull payload
developerboolInternal flag
ip_addressstring
user_agentstring

Domain 6 — B2B Customers (School Organizations)

customers

Institutional customers — school networks and individual schools with subscriptions.

ColumnTypeNotes
idPK
namestringOrganization name
is_individualenumIndividual vs. corporate
email, phone, gsm, webstringContacts
billing_address, billing_office, billing_nostringBilling
tc_nostringTax ID
location_level_1/2FK → locations
statusstring
auth_person1_name/phone/emailstringPrimary contact
auth_person2_name/phone/emailstringSecondary contact
erp_codestringERP integration key
segmentsJSONSegmentation labels
is_key_accountboolVIP flag
association_idFKSchool association membership
deleted_attimestampSoft delete

Relations: hasMany → schools, customer_users, customer_agreements

customer_agreements

ColumnTypeNotes
customer_idFK → customers
agreement_typeenumfixed / regular / zero_tax_arge / subscription
pricedecimal
is_recurringbool
tax_amountdecimal
productsJSONContracted services list
product_argeJSONAR-GE specific products
financial_statusstring
statusstringactive/rejected/etc.
agreement_datedate
deleted_attimestampSoft delete

customer_users

ColumnTypeNotes
customer_idFK → customers
user_idFK → users
rolestringAdmin role within customer
is_activebool

Domain 7 — Appointments

family_appointments

Parent-school meeting scheduling. Introduced 2024.

ColumnTypeNotes
customer_user_idFK → usersSchool-side user
school_idFK → schools
family_idFK → families
parent_idFK → parents
student_idFK → students
result_idFK → configsOutcome
notetext
starts_ontimestamp
ends_ontimestamp
approved_attimestamp
rejected_attimestamp
reject_notetext
sent_attimestampNotification sent
seen_attimestampNotification seen
deleted_attimestampSoft delete

sales_school_appointments

Internal sales team → school visit scheduling.

ColumnTypeNotes
user_idFK → usersSales agent
school_idFK → schools
appointment_datedate
result_idFK → configsVisit outcome
is_renewboolRenewal visit flag
reminder_attimestamp

Key Relationships for ML Modeling

users ─────────────── user_details
  │                   user_favorites → schools
  │                   user_logs
  │
  ├── parents ──────── family_parent ─── families ── family_student ─── students
  │
  ├── leads ─────────────────────────────────────────── schools
  │     └── lead_pool_forms
  │
  └── school_comments ──────────────────────────────── schools

schools ─────────────── school_locations → locations
  │                     school_contacts
  │                     school_fees
  │                     school_details
  │                     school_facilities/activities/shifts/languages
  │                     school_daily_logs   (time-series)
  │                     school_interactions (CRM log)
  │
  └── customers ──────── customer_agreements
                         customer_users → users

AR-GE ComponentPrimary TablesLabels / Signals
Embedding / Vector DBschools + school_details + school_comments (approved)— (unsupervised)
Knowledge Gap Detectionleads.message, lead_pool_forms.message, school_comments.commentleads.status (converted vs. dropped)
B2C Counseling Agentlead_pool_forms, user_favorites, school_commentsleads.school_id (chosen school)
B2B Coaching Agentschool_daily_logs, school_interactions, customer_agreementsleads.customer_viewed_at, lead_count
Feature Store (behavioral)school_daily_logs, user_logs, user_favorites, leads.refConversion events
HITL / Expert Knowledgeschool_interactions.note, family_notes, school_comments.reject_noteHuman-validated labels
Predictive Analyticsschool_daily_logs (time-series), leads (monthly), customer_agreementsRevenue / churn signals

Data Quality Notes

  • All main entities use soft deletes (deleted_at) — always filter WHERE deleted_at IS NULL unless doing retention analysis
  • school_comments: only use status = 'approved' for training to avoid noise from rejected/pending reviews
  • leads: ref column is nullable in older records — gap in pre-2022 data
  • parents / students / families: tables introduced ~2024, limited historical depth
  • school_daily_logs: no id column — composite key on (school_id, date). No soft delete.
  • Revisionable pattern: school_interactions, leads, customers, customer_agreements all track change history in a revisions table — usable for temporal modeling