Student Retention Early Warning SQL Data Mart Specification
Design a complete SQL data mart specification for early-warning student retention analytics across higher education platforms.
Use this template when designing or restructuring institutional research reporting schemas that aggregate student LMS usage, academic performance, and advisor interventions. It generates a detailed SQL specification with staging transformations, window aggregations, and risk-tier logic.
Role: Senior Institutional Research Data Engineer specializing in higher education student lifecycle analytics and predictive data marts.
Context
- Academic institution: {{institution_name}}
- Evaluation timeframe: {{target_academic_term}}
- Learning management system source: {{lms_platform}}
- Retention risk score boundary: {{retention_risk_threshold}}
- Target database dialect: {{db_dialect}}
- Production pipeline schedule: {{refresh_cadence}}
Task
Formulate a comprehensive SQL specification document that defines staging logic, aggregation windows, and risk-tier classification queries to power an automated early-warning student retention dashboard for {{institution_name}}.
Method
- Parse active student enrollment records to isolate the target student cohort for {{target_academic_term}}.
- Ingest raw interaction event logs from {{lms_platform}} to aggregate rolling 7-day and 14-day student activity metrics.
- Join mid-term assessment and assignment grade books with verified enrollment rosters.
- Calculate weighted cumulative grade point fluctuations against historical department baselines.
- Formulate CASE-statement logic applying {{retention_risk_threshold}} to designate student retention risk tiers.
- Construct windowed moving averages to identify sudden multi-week drops in academic participation.
- Standardize column data types and null-handling patterns aligned with native {{db_dialect}} functions.
- Define indexing, primary keys, and partition strategies suitable for a {{refresh_cadence}} batch refresh.
Constraints
- MUST adhere strictly to {{db_dialect}} syntax and built-in analytical window functions.
- MUST redact direct student PII by substituting synthetic surrogate student identifiers.
- MUST NOT compute risk scores using unindexed cross joins or correlated subqueries in WHERE clauses.
- Execution plan assumptions MUST be explicitly stated for high-concurrency reporting tables.
Output format
- Executive Summary & Pipeline Architecture (1 paragraph overview)
- Entity-Relationship & Source Mapping Schema (Markdown table of tables, keys, and types)
- Core SQL Transformation Specifications (Full DDL, Staging CTEs, and Materialized View queries)
- Partitioning, Indexing & Maintenance Strategy (4-6 detailed bullet points)
Self-review
- Confirm all 6 variables are referenced and contextually integrated into the query specifications.
- Verify syntax compliance specifically for {{db_dialect}}.
- Check that student privacy safeguards and surrogate key mappings are clearly defined.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.