You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: quote Retention column in KPIs query and coerce pg string counts to numbers for Recharts
* fix: use exact case-sensitive column names in LLM schema prompt to prevent Postgres quoting errors
* feat: update methodology page — remove impl refs, add worked examples
- Remove Script and Table header badges (internal details)
- Remove 'Data Source' section (table names, script paths not user-facing)
- Replace raw db field names in sub-score tables with plain English labels
- Remove input_features column reference from Transparency card
- Add 'Worked Examples' section with Maria T. (High, 0.699) and Jordan M. (Low, 0.386)
- Each example: inputs table, step-by-step sub-score math, color-coded final score
Closes#59
- cohort: NUMERIC year only (e.g., 2019, 2020) — NOT a string like "2024-Fall"
111
-
- cohort_term: Term name (e.g., "Fall", "Spring", "Summer")
112
-
- To filter by "Fall 2023", use: WHERE cohort = 2023 AND cohort_term = 'Fall'
113
-
- student_age: INTEGER field — use direct numeric comparisons (e.g., student_age >= 25)
115
+
- Column names with uppercase letters MUST be double-quoted in PostgreSQL SQL or the query will fail.
116
+
CORRECT: WHERE "Cohort" = 2023 AND "Cohort_Term" = 'Fall'
117
+
INCORRECT: WHERE cohort = 2023 AND cohort_term = 'Fall'
118
+
- "Cohort": NUMERIC year only (e.g., 2019, 2020) — NOT a string like "2024-Fall"
119
+
- "Cohort_Term": Term name (e.g., "Fall", "Spring", "Summer")
120
+
- To filter by "Fall 2023", use: WHERE "Cohort" = 2023 AND "Cohort_Term" = 'Fall'
121
+
- "Student_Age": INTEGER field — use direct numeric comparisons (e.g., "Student_Age" >= 25)
122
+
- Lowercase ML columns (retention_probability, at_risk_alert, etc.) do NOT need quoting.
114
123
- Use standard PostgreSQL syntax — no backtick quoting, no cross-database references
115
124
116
125
IMPORTANT QUERY INTERPRETATION RULES:
117
126
118
127
1. METRIC SELECTION:
119
128
- ONLY include a metric if the user explicitly asks for retention, persistence, GPA, credits, etc.
120
129
- If user asks to "segment", "compare", "show", "count", or "list" students → use COUNT(*) and NO specific metric
121
-
- "retention" → AVG(retention) as retention_rate
122
-
- "persistence" or "completion" → AVG(persistence) as completion_rate
123
-
- "GPA" → AVG(gpa_group_year_1) as gpa
124
-
- "credits" → AVG(number_of_credits_earned_year_1) as credits_earned
130
+
- "retention" → AVG("Retention") as retention_rate
131
+
- "persistence" or "completion" → AVG("Persistence") as completion_rate
132
+
- "GPA" → AVG("GPA_Group_Year_1") as gpa
133
+
- "credits" → AVG("Number_of_Credits_Earned_Year_1") as credits_earned
125
134
- Otherwise → COUNT(*) as count
126
135
127
136
2. GROUPING & SEGMENTATION:
128
137
- "segment by X" or "compare X" → GROUP BY X column
129
138
- "by age", "age groups", "segment by age" → Use CASE statement to create age groups:
130
139
CASE
131
-
WHEN student_age < 25 THEN 'Under 25'
132
-
WHEN student_age >= 25 THEN '25 and Over'
140
+
WHEN "Student_Age" < 25 THEN 'Under 25'
141
+
WHEN "Student_Age" >= 25 THEN '25 and Over'
133
142
END AS age_group
134
-
- "by gender" → GROUP BY gender
135
-
- "by race" → GROUP BY race
136
-
- "by cohort" → GROUP BY cohort
137
-
- "by term" → GROUP BY cohort_term
143
+
- "by gender" → GROUP BY "Gender"
144
+
- "by race" → GROUP BY "Race"
145
+
- "by cohort" → GROUP BY "Cohort"
146
+
- "by term" → GROUP BY "Cohort_Term"
138
147
139
148
3. FILTERS:
140
-
- "2023 cohort" → WHERE cohort = 2023
141
-
- "Fall 2023" or "2023 Fall" → WHERE cohort = 2023 AND cohort_term = 'Fall'
142
-
- Age filters: use numeric comparisons directly (e.g., student_age >= 25)
149
+
- "2023 cohort" → WHERE "Cohort" = 2023
150
+
- "Fall 2023" or "2023 Fall" → WHERE "Cohort" = 2023 AND "Cohort_Term" = 'Fall'
151
+
- Age filters: use numeric comparisons directly (e.g., "Student_Age" >= 25)
143
152
144
153
4. VISUALIZATION:
145
154
- Comparing groups (age, gender, race) → "bar"
@@ -163,7 +172,7 @@ Generate a query plan with:
163
172
EXAMPLE for "segment students over 25 and under 25 in 2023 cohort":
164
173
{
165
174
"vizType": "bar",
166
-
"sql": "SELECT CASE WHEN student_age < 25 THEN 'Under 25' ELSE '25 and Over' END AS age_group, COUNT(*) as count FROM student_level_with_predictions WHERE cohort = 2023 GROUP BY age_group ORDER BY age_group",
175
+
"sql": "SELECT CASE WHEN \"Student_Age\" < 25 THEN 'Under 25' ELSE '25 and Over' END AS age_group, COUNT(*) as count FROM student_level_with_predictions WHERE \"Cohort\" = 2023 GROUP BY age_group ORDER BY age_group",
0 commit comments