Work / CPCC Task Automation
CPCC Task Automation
- Problem
- Each week I took attendance, recorded withdrawals and graded programming work for every course by hand, where one missed submission is a wrong record.
- System
- Software that works the college's student and learning systems for me and grades against a rubric, with a real compiler as the final check on code.
- Result
- Running for my own courses since early 2024 and in active development this term. No time-saved figure yet: the timed comparison has not been run.
Last verified running 2026-09-03; in active development during the Fall 2026 term (latest merge 2026-10-17, tests and the student-PII guard green). Built part-time for my own courses at Central Piedmont Community College, where I teach. The dates are the life of the repo, not an engagement.
Scope
There was no client brief: the stakeholder, operator and builder are all me, an instructor at the college. What I fixed in writing before building, and kept in the repo docs since, was the boundary rather than the feature list:
- It reads and writes the live student information system and LMS through a real browser, as me, with my credentials. No shared account, and no LMS or SIS API keys the college did not issue.
- Student code is compiled, never executed.
- Grade write-back to BrightSpace and the sync to the shared withdrawals tracker default to a dry run. Attendance marking in MyColleges writes live, behind the one up-front prompt block that decides the whole run.
- Nothing student-identifying is committed: withdrawal CSVs are kept outside version control (git-ignored); LLM analytics ships with prompt and completion content withheld.
Worked part-time around teaching; nothing here was a paid engagement, and no client outcome is claimed.
Problem
Every week, for each course I teach, I was doing the same pass by hand: open BrightSpace, walk the assignments and quizzes to see who submitted in the window, open MyColleges for the matching section, mark each student present or absent, then check the class list for withdrawals and copy them into a shared tracker. Separately, grading programming submissions meant reading each one against a rubric and writing a feedback document per student.
None of it needs judgment until the end, when a grade is decided. All of it needs care, because a missed submission is a wrong attendance record and a misread withdrawal date is a wrong W-or-S classification. The system replaces that pass.
What broke
Three failures, each of which is now a rule in the repo.
The model floored a grade. gpt-5-mini flagged valid C++ as non-compiling. "Does Not Compile" is a major error in the rubric, so that one false call took the whole grade to the floor. The fix was not a better prompt: a real compiler now decides, and the model's verdict is corrected against it before scoring.
dateparser turned "N/A" into a real date. get_datetime("N/A") returned today's date without raising, so a placeholder cell in a scraped roster or deadline span became a fabricated date that decided drop windows, W-or-S classification, which term a course was filed under, and which weeks got marked present. It first showed up as a crash (a blank deadline span raised ValueError and discarded every course already processed); fixing the crash exposed the silent version, which is worse. The same guard ended up at seven call sites across two pull requests.
The quiz write-back publishes. The assignment evaluation page has a Save Draft button; the quiz Consistent Evaluation page does not. There is nothing to click that holds a quiz score back, so a quiz write-back posts score and feedback to the student immediately. The app now relabels the button, shows a warning when the target URL is a quiz, and the report says "posted" rather than "saved" — but nothing about it is undoable from inside the tool.
Constraints
- Both target systems are live and driven by Selenium through my own browser session, not an API; the D2L API is institution-specific and was not used. A UI change on either side breaks a scraper, so selectors are documented and probed live.
- Quiz grade write-back has no draft state, so it publishes to the student on write. Assignment write-back can save as draft. The two routes cannot be treated the same.
- Login is my own account behind Duo MFA. The tool cannot complete a login on its own; a run waits for me to approve the push, and a Docker Chrome profile persists the session between runs so MFA is not re-prompted every time.
- Student names, IDs, emails, submissions and grades pass through the system. Nothing identifying is committed or sent to LLM analytics; run logs do carry student names, and they stay local and rotated.
- The withdrawals tracker is a shared SharePoint workbook that other people also edit. Two columns belong to a Navigator and are never written.
Architecture
A Python package (cqc_cpcc) with a Streamlit multi-page UI and a CLI over the same core. Four actions: take attendance, process withdrawals, generate feedback, grade against a rubric and write back.
- Run planning (
run_plan.py). Every question a run needs — which courses, the attendance start date, whether to process withdrawals, dry-run or real — is answered once, after login, before the first course tab opens. From there the run is unattended. This is also what stops the Streamlit background thread from blocking on aninput()nobody can see. - Scrapers (
my_colleges.py,brightspace.py). Stateful classes holding the WebDriver: MyColleges for login, the course list, term and drop dates, and recording attendance; BrightSpace for assignment and quiz completions and the withdrawal class list. Explicit waits, stale-element retries, a failing course is isolated (tab closed, failure recorded, remaining courses still run). - Withdrawals (
withdrawals.py,withdrawal_processing.py,attendance_tracker.py). A pure core with no Selenium: records keyed on (course and section, student ID) as strings so leading zeros survive; classification against course start, census date and final drop day; stdlib CSV. Orchestration writes the per-term local CSV before attempting the online sync, so a tracker failure never costs the scrape. The sync sits behind aTrackerAdapter; SharePoint Excel Online is the one implementation. - Grading (
rubric_grading.py,utilities/compiler_gate.py,utilities/AI/). Submissions are fetched from a BrightSpace URL (assignment or quiz route), instructions are read from the assignment editor, and the model returns a structuredRubricAssessmentResult.apply_compile_gateruns immediately beforeapply_backend_scoring; the order is load-bearing because the score is computed from the error list the gate corrects. - Write-back (
utilities/brightspace_writeback.py). Assignment route: click rubric levels, fill the buffered score last, write feedback through the editor's own API plus one real keystroke so TinyMCE marks itself dirty, Save Draft. Quiz route: real keystrokes into the score input, confirm the "final score differs from question points" dialog and refuse the destructive "discard/reset" one, write overall feedback on the Completion Summary view, Update. Feedback can be attached as a per-student.docx(bulk ZIP import on the assignment route) or injected inline. - LLM access (
utilities/AI/openrouter_client.py,openai_client.py). OpenRouter by default with an allowlist of model patterns; OpenAI direct as the fallback path. Structured outputs validated by schema, transient errors retried with backoff, truncated or refused responses raised rather than parsed. - Date guard (
utilities/date.py).looks_like_a_scraped_dateruns beforeget_datetimeon anything scraped or typed. Every real date contains a digit; the placeholders do not.term_for_dateandpurge_empty_and_invalid_datesapply it internally.
Trade-offs
A compiler gate instead of trusting the model on "does not compile" — A compiler is not a matter of opinion, and the model had already floored a grade with a false call. The gate runs the real toolchain (compile() for Python, g++ -fsyntax-only for C++, javac to a temp dir for Java), never executes student code, and treats a missing toolchain or a timeout as "could not verify", never as "does not compile" — conflating those would fail every Java submission on a box without a JDK.
Dry-run defaults on both write paths — The quiz route publishes on write and the assignment route saves a draft, but both navigate, locate the score input and the feedback editor, and log what they would write before either is allowed to write anything. A real write is a deliberate per-run choice, and the dry-run report is the diff I read first.
Per-term local CSV plus a shared-tracker sync with column ownership — The local file is written before the online sync and is the record if the sync fails. The sync reads the workbook first and aborts on a failed or empty read rather than appending blind, writes only the instructor's columns of new rows and never the Navigator's, de-duplicates the local file and the online sheet independently so a row someone typed by hand is never re-added, and re-reads after writing until its own rows appear — SharePoint keeps serving the pre-save workbook for a while.
A dateparser "N/A" guard at every scrape-to-date site rather than a fix inside get_datetime — The parser, get_datetime, is documented and tested to parse natural language like "yesterday", which has no digit either. The guard belongs at the boundary where scraped text becomes a date, so it went there, seven call sites in all, two of them inside term_for_date and purge_empty_and_invalid_dates so their callers inherit it.
OpenRouter with a swappable model allowlist — The model that floored the grade is not the model I want to be locked to. OPENROUTER_ALLOWED_MODELS is a comma-separated list of patterns passed to the auto-router; empty means account defaults; the OpenAI client stays as a direct path. Swapping models is configuration, not a code change.
Evaluation
What I can point at, in order of how much it proves:
- The compiler gate is pinned by tests, including the cases that matter: a false "Does Not Compile" is removed, a missed one is added with real diagnostics, a missing
g++orjavacor a timeout leaves the model's verdict alone, one unverifiable language makes the whole submission unverifiable, and the gate and the all-manual-rubric scoring fix are tested together because a textually clean merge could still ship the wrong score. The toolchain-missing paths run with the compiler stubbed, so the suite behaves the same with and without a JDK. - The date guard is pinned by tests: the placeholders
dateparserwould have accepted are rejected, purged from rosters, and a roster of nothing but placeholders yields no latest date; the custom attendance-date prompt re-prompts on a placeholder instead of accepting it. - The tracker sync is pinned by tests: dry run never appends, a failed or empty read aborts, only the instructor's columns are typed, cells are sanitised against formula injection, and the post-write confirmation re-reads until the rows appear.
- The write-back is pinned by tests: dry run reports without filling or saving on both routes, the save-draft matcher never targets Publish, Update or Retract, and the dialog confirmer excludes the destructive texts.
- CI runs the unit suite with coverage on every pull request and push to master; the integration and end-to-end suites run in separate workflows with the model client mocked or the live tests skipped (the real-API OpenRouter tests are opt-in with a key and are not part of CI). I am not quoting a pass rate or a coverage number here because no results file is committed; the test files are the artifact.
- The dry-run diff is the operational check. Before any real write I run the same job in dry-run mode and read what it says it would do. The live verifications I can date are in the handoff doc: assignment draft write-back on a real unpublished assignment (2026-07-01), quiz write-back posted and then reset (2026-07-09 and 2026-07-10), bulk feedback-file import as draft (2026-07-10). Live writes on the withdrawals tracker touched only a personal test copy.
Result
What runs today: attendance and withdrawals from the CLI or the web app, one up-front prompt block then unattended; rubric grading with the compiler gate in the scoring path; BrightSpace write-back on both routes, dry run first. The operator is me, for my own courses, and it has been since the first commit in early 2024; the compiler gate and the BrightSpace write-back landed on master on 2026-09-02.
Who else used it: nobody. The shared withdrawals tracker had no reader besides me in the period this page covers; the workbook reserves two columns for a Navigator, and the sync never writes them, but no one downstream consumed the rows. This is a system I built for my own job.
What is pending: a timed run against the manual pass, so no time-saving figure is stated here; and a recorded demo. There is no BrightSpace test course with synthetic students, so the demo will run on synthetic submissions with write-back in dry-run mode, and this page will say so when the video is added.
Hand-off
The hand-off artifact is docs/BRIGHTSPACE_AUTOMATION_HANDOFF.md: a kickoff prompt for the next session, the live DOM findings for both BrightSpace routes (which elements hold the score, the feedback editor, the attempt links, and why a plain .click() does not register on a Lit component), the selectors most likely to need re-tuning, and the quick commands, including a selector-probe REPL that attaches to the project's real Selenium session.
Alongside it: docs/ARCHITECTURE.md (module map, data flows, the write-back table, the tracker safety properties), docs/compiler-gate.md (why a missing compiler is not a failing grade), docs/PRODUCT.md (the four features as a user meets them), docs/testing.md (how to run the suite; deliberately no baked-in counts).
Open items, as written in the repo: the per-attempt feedback-attach flow is verified on the quiz route only; quiz instructions came back empty on one quiz and still need tuning; five CodeQL alerts on read_file are documented false positives; SharePoint's download endpoint lags a save, which the re-read confirmation handles but does not remove.
Evidence
| Claim | Artifact | Type | Date |
|---|---|---|---|
| The model flagged valid C++ as non-compiling and floored the grade; a real compiler now decides, and "cannot verify" is never "does not compile". | compiler-gate.md | Public URL | 2026-09-02 |
| Compiler-gate tests cover false-positive removal, missed-error addition, missing toolchain, timeout, and mixed-language cases. | test_compiler_gate.py | Public URL | 2026-09-02 |
| Compile gate, BrightSpace write-back on both routes, the quiz-publishes warning, and Docker login persistence merged to master. | PR #267 | Pull request | 2026-09-02 |
| Assignment draft write-back verified live on a real unpublished assignment; learner match, rubric levels and feedback persistence fixed. | PR #259 | Pull request | 2026-07-02 |
| dateparser resolved "N/A" to a real date without raising; guarded at the scraped-date sites in both scrapers, and the blank-deadline crash that discarded processed courses fixed. | PR #280 | Pull request | 2026-09-02 |
| Three more sites of the same defect (the custom-date prompt, term_for_date, purge_empty_and_invalid_dates), the seventh call site in all, plus the tracker re-read confirmation; the six defects the new tests surfaced. | PR #281 | Pull request | 2026-09-02 |
| looks_like_a_scraped_date is the guard; term_for_date and purge_empty_and_invalid_dates apply it internally. | date.py | Public URL | 2026-09-02 |
| Placeholder dates are rejected and purged; a roster of placeholders yields no latest date. | test_date.py | Public URL | 2026-09-02 |
| The custom attendance-date prompt re-prompts on a placeholder rather than accepting it. | test_run_plan.py | Public URL | 2026-09-02 |
| Tracker sync is dry-run by default, aborts on a failed read, types only the instructor's columns, sanitises cells, and confirms its own rows by re-reading. | test_attendance_tracker.py | Public URL | 2026-09-02 |
| Write-back dry run fills and saves nothing on either route; save-draft never targets Publish; the dialog confirmer excludes destructive texts. | test_brightspace_writeback.py | Public URL | 2026-09-02 |
| The write-back reversibility table, the tracker safety properties, and the compile-never-execute rule as documented. | ARCHITECTURE.md | Public URL | 2026-09-02 |
| Withdrawal processing writes only the instructor's columns; the Navigator's two columns are never touched; local CSVs are git-ignored. | PRODUCT.md | Public URL | 2026-09-02 |
| OpenRouter model allowlist is configuration (OPENROUTER_ALLOWED_MODELS), parsed into auto-router plugins; empty means account defaults. | test_openrouter_plugins.py | Public URL | 2026-04-22 |
| Unit suite runs with coverage on every pull request and push to master. | unit-tests.yml | Public URL | 2026-09-02 |
| Live verifications of both write-back routes, the MFA prompt, and the end-to-end fetch, with dates; the hand-off artifact. | BRIGHTSPACE_AUTOMATION_HANDOFF.md | Public URL | 2026-09-03 |
| First commit of the repository. | Commit 05317a8 | Commit | 2024-02-21 |
| The hosted app is deployed and invite-only (answers with a redirect to Streamlit sign-in). | Streamlit app | Public URL | 2026-09-03 |
| Fall 2026 term work merged mid-term: flag tracker withdrawal rows whose student still attends (#370). | PR #370 | Pull request | 2026-10-13 |
| Fall 2026 term work merged mid-term: remove re-enrolled students from the tracker, opt-in (#382). | PR #382 | Pull request | 2026-10-13 |
| Latest merge: course-aware student feedback, v2 (#392), head 247a25b. | PR #392 | Pull request | 2026-10-17 |
| Unit tests green on head 247a25b. | Run 38994055147 | Public URL | 2026-10-17 |
| Student-PII guard check green on head 247a25b. | Job 117282522291 | Public URL | 2026-10-17 |
No cookies and nothing stored in your browser. A page-view count is sent to analytics; the ?p= token, when present, is passed to the linked page and nowhere else.
