#!/usr/bin/env python3
"""Summarise language programme outcomes by course: retention, pass rate, level gain, attendance, satisfaction.
CSV columns: student, course, status (completed / withdrawn / continuing), start_level, end_level (CEFR, + allowed,
or blank), passed (yes/no), attendance (%), satisfaction (1-5); only student, course and status are required.
Level gain counts half-steps: A2 -> A2+ = 0.5, A2 -> B1 = 1.
Findings (thresholds can be changed):
PM001 high retention below --retention % (default 75): withdrawn / (completed + withdrawn)
PM002 medium pass rate below --pass % (default 75) among completers
PM003 medium median level gain of completers is zero
PM004 low mean attendance below --attendance % (default 80)
PM005 low mean satisfaction below 3.5 / 5
PM006 info fewer than 10 students: treat percentages with caution
Usage:
python program_metrics.py students.csv [--retention 75] [--pass 75] [--attendance 80]
Exit codes: 0 no high findings, 1 high findings, 2 read error or bad CSV.
"""
import argparse
import csv
import statistics
import sys
from collections import defaultdict
LEVELS = {"PRE-A1": 0, "A1": 1, "A2": 2, "B1": 3, "B2": 4, "C1": 5, "C2": 6}
def level(s):
s = (s or "").strip().upper()
if not s:
return None
return LEVELS[s.rstrip("+")] + (0.5 if s.endswith("+") else 0)
def num(s):
try:
return float(str(s).strip().rstrip("%"))
except ValueError:
return None
def main():
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("csv")
ap.add_argument("--retention", type=float, default=75)
ap.add_argument("--pass", dest="pass_", type=float, default=75)
ap.add_argument("--attendance", type=float, default=80)
a = ap.parse_args()
try:
with open(a.csv, newline="", encoding="utf-8-sig") as fh:
rows = list(csv.DictReader(fh))
if not rows or not {"student", "course", "status"} <= set(rows[0]):
raise ValueError("needs student, course and status columns")
by = defaultdict(list)
for r in rows:
r["_gain"] = (level(r.get("end_level")) - level(r.get("start_level"))
if level(r.get("end_level")) is not None and level(r.get("start_level")) is not None else None)
by[r["course"].strip()].append(r)
except (OSError, csv.Error, ValueError, KeyError) as e:
print(f"error: {e}", file=sys.stderr)
return 2
f = []
print("| Course | n | Retention | Pass | Median gain | Attendance | Satisfaction |")
print("|--------|---|-----------|------|-------------|------------|--------------|")
for course, rs in sorted(by.items()):
st = [r["status"].strip().lower() for r in rs]
done, gone = st.count("completed"), st.count("withdrawn")
ret = 100 * done / (done + gone) if done + gone else None
comp = [r for r in rs if r["status"].strip().lower() == "completed"]
passed = [r for r in comp if (r.get("passed") or "").strip().lower() in ("yes", "y", "true", "1")]
pas = 100 * len(passed) / len(comp) if comp and any(r.get("passed") for r in comp) else None
gains = [r["_gain"] for r in comp if r["_gain"] is not None]
gain = statistics.median(gains) if gains else None
att = [x for x in (num(r.get("attendance")) for r in rs) if x is not None]
sat = [x for x in (num(r.get("satisfaction")) for r in rs) if x is not None]
att_m = statistics.mean(att) if att else None
sat_m = statistics.mean(sat) if sat else None
fmt = lambda v, s="": "-" if v is None else f"{v:.0f}{s}" if s == "%" else f"{v:g}{s}"
print(f"| {course} | {len(rs)} | {fmt(ret, '%')} | {fmt(pas, '%')} | {fmt(gain)} | {fmt(att_m, '%')} | "
f"{'-' if sat_m is None else f'{sat_m:.1f}'} |")
if ret is not None and ret < a.retention:
f.append(("PM001", "high", f"{course}: retention {ret:.0f}% ({gone} withdrew) is below {a.retention:g}%"))
if pas is not None and pas < a.pass_:
f.append(("PM002", "medium", f"{course}: pass rate {pas:.0f}% is below {a.pass_:g}%"))
if gain is not None and gain <= 0:
f.append(("PM003", "medium", f"{course}: median level gain of completers is {gain:g}"))
if att_m is not None and att_m < a.attendance:
f.append(("PM004", "low", f"{course}: mean attendance {att_m:.0f}% is below {a.attendance:g}%"))
if sat_m is not None and sat_m < 3.5:
f.append(("PM005", "low", f"{course}: mean satisfaction {sat_m:.1f}/5"))
if len(rs) < 10:
f.append(("PM006", "info", f"{course}: only {len(rs)} students; percentages are unstable"))
print()
order = {"high": 0, "medium": 1, "low": 2, "info": 3}
for code, sev, msg in sorted(f, key=lambda x: (order[x[1]], x[0])):
print(f"{code} [{sev}] {msg}")
return 1 if any(x[1] == "high" for x in f) else 0
if __name__ == "__main__":
sys.exit(main())
academic-english-eap-course-planner
Plan English for Academic Purposes (EAP) courses: pre-sessional, in-sessional, foundation, IELTS preparation and discipline-specific EAP, with syllabus strands (academic reading, lecture listening and note-taking, essay and report writing, paraphrase, summary and synthesis, referencing and plagiarism, seminars and presentations, academic vocabulary, critical thinking), a 10-week pre-sessional outline, exit assessment, IELTS-CEFR alignment and academic style (formality, hedging, cohesion, reporting verbs). Estimates study hours and weeks to close an IELTS gap from overall or per-skill scores (IELTS rounding, minimum per skill, priority skills, feasibility before a deadline), and checks learner texts for contractions, informal words with academic alternatives, unhedged claims, 'you', And/But/So starts, rhetorical questions and missing citations.
actfl-proficiency-curriculum-mapper
Map world language curricula to the ACTFL framework: proficiency levels (Novice, Intermediate, Advanced, Superior, Distinguished with sublevels), functions, contexts, text types and accuracy, proficiency vs performance, the three modes of communication (interpretive, interpersonal, presentational), the 5 Cs World-Readiness Standards, backward-designed thematic units with Integrated Performance Assessments, typical programme targets and FSI time estimates. Looks up approximate ACTFL-CEFR-ILR equivalences with what each level can do, and checks a unit map for missing modes, rehearsed skits mislabelled as interpersonal, translation or word lists as interpretive tasks, and units without an integrated performance assessment.
adult-literacy-esl-lesson-builder
Build lessons for adult ESL learners who are developing literacy (LESLLA learners: pre-literate, non-literate, semi-literate, literate in a non-Roman script): learner profiles and sensitive initial assessment, principles (oral language first, known to new, systematic phonics with adult-relevant text, repetition, classroom skills, respect for experience), a lesson routine (oral warm-up, review, new grapheme, blending, segmenting, decodable text, writing, functional literacy, Language Experience Approach), a phonics sequence for adults, sight words, functional literacy targets (forms, signs, medicine labels) and portfolio assessment. Checks whether a reading text is decodable with the letter-sound patterns and sight words taught so far, catching untaught digraphs, listing non-decodable words with the untaught part, and suggesting the most useful next patterns.
authentic-material-lesson-adapter
Turn authentic material (news articles, podcasts, videos, songs, menus, timetables, adverts, social media posts, forms, infographics) into language lessons by grading the task rather than the text. Selects texts for interest, relevance, exploitability, coverage, cultural load and rights; finds the 4-6 words to pre-teach, words to gloss on the page and words learners can ignore, plus names and cultural references to explain, with reading time by level; and builds a lesson shape (lead-in, pre-teach, gist or scanning, graded detail task, language focus on chunks and register, response) with task ideas per material type and level from A1 to C1. Covers copyright, fair dealing and fair use, Creative Commons and attribution.
can-do-statement-writer
Write and review can-do statements for language courses, units, lessons and learner self-assessment, CEFR or NCSSFL-ACTFL style: action (observable verb) + text or situation + level-specific conditions, learner ('I can') and descriptor ('Can') versions, progressions of one activity from A1 to C1, and coverage of reception, production, interaction and mediation. Includes a verb bank by mode and level and condition and text-type banks. Lints statements for teacher-centred phrasing, knowledge instead of use (learn, know, understand the passive), missing context, two skills in one statement, vague quality words, grammar items as outcomes, overlong statements and missing modes in a set.
cefr-aligned-syllabus-builder
Build language course syllabuses aligned to the CEFR (A1-C2, plus levels, Companion Volume 2020): entry and exit levels, guided learning hours and course length (with an L1-distance adjustment), syllabus type (topic, functional-notional, task-based, skills-based, multi-strand), unit-by-unit can-do outcomes, grammar from a core inventory by level, vocabulary, functions, pronunciation, balance of reception, production, interaction and mediation, recycling and assessment points. Checks a syllabus for units without can-do statements, core grammar for the level not covered, items above the course level, skills missing from most units and units with no vocabulary or functions.