Skip to content

Permanent shift record: op_shift_history + op_shift_time_stats (#759) - #808

Merged
mbhewitt merged 7 commits into
mainfrom
feat/shift-history
Nov 29, 2026
Merged

mbhewitt merged 7 commits into
mainfrom
feat/shift-history

Conversation

@mbhewitt

@mbhewitt mbhewitt commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Roadmap item 2 (#849, #759), rebuilt to Mew's 2026-11-29 spec. Replaces the 2026-10 version (migration 022 → 030).

Tables (migration 030)

  • op_shift_history: one row per volunteer per signup, denormalized. Key = (source, burn_year, source_id, shiftboard_id), because row ids are reused every year. Fields: names at the time, date and day name, start, end, hours, department, category, shift name, alias (Shiftboard subject / position alias), position, instance (event_code / shift_instance) and shift_key, lead/critical/core/off-playa flags, CSP, canceled, checked_in, raw_score + scale + 2–4 score, review notes, details (for app rows: shift type details, position, meal, notes), placeholder and category-guessed flags, and signed_up_at.
  • op_shift_time_stats: one row per shift time per burn year: slots, filled, unfilled, checked in, not checked in, reviewed.

Loader (etl/shift_history.py build)

  • The old Census shiftboard2 wins for 2025 and earlier. Fields are mapped through subject_category, and subjects, times and names are cleaned: double-encoded names fixed, exact duplicate signups dropped.
  • Post-playa app dumps (2024, 2025) add checked-in rows that sb2 never saw. Where check-ins disagree, the volunteer gets the credit. App reviews fill gaps.
  • Rules (CSP, score map, burn_year, unfilled slots) are in the docstring; selftest covers them.

Dry run (scratch copy, burn years 2006–2026)

9,707 signups, 1,220 people, 1,689 shift times. 4 duplicate signups dropped; unknown subjects get a guessed category, flagged. On-playa signups Shiftboard never had: 68 (2024), 19 (2025). Made-up on-playa ids are linked to the real person (linked_from_id).

2026 (Mew 2026-11-29) comes from prod's op_ tables (600 on-playa) plus sb_shifts (347 off-playa). The two sources don't overlap, and signups after 9/14 count toward burn 2027.

Not yet

Prod plan (on Mew's OK)

  1. Apply migration 030.
  2. Copy both tables from the scratch DB over ssh.
  3. Fill playa names from prod sb_pinfo (current names, flagged).
  4. Verify the counts above.

🤖 Generated with Claude Code

mbhewitt and others added 2 commits October 18, 2026 15:23
Read-only, denormalized table plus an idempotent loader for legacy
shiftboard2 (with review_notes ratings), later sb_shifts pulls, and a
season of the op_ tables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mbhewitt

Copy link
Copy Markdown
Owner Author

Clarifying open question 1, the January copy of the old shift table: the history isn't stale either way. The sb-shifts load uses prod sb_shifts, which the Shiftboard ETL refreshes every 4 hours. I checked on 2026-10-20: it was last synced that day and covers 2025-08-24 → 2026-10-07, 701 signups with 278 since Feb. That includes this year's meeting attendance recorded in Shiftboard. A newer legacy copy would only matter for edits made to rows from before Aug 2025.

… adds no-shows and ratings

Shiftboard's coverage report still serves every signup since 2013 (8,956),
more than the legacy shiftboard2 copy frozen in Jan 2026. Make it the main
source and drop the prod sb_shifts gap-fill. shiftboard2 shares Shiftboard's
signup ids (8,631 overlap, 0 mismatched people), so both loads write one
source, 'shiftboard', and the legacy load only adds what Shiftboard doesn't
keep: no-show marks, ratings/notes, role and department, plus the 140
pre-2013 and placeholder rows. Loads are order-independent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mbhewitt

Copy link
Copy Markdown
Owner Author

Idea for discussion, not a decision (from a coordinator, 2026-10-20). Parked until Mew's focused session.

Close out 2026 the way past years were closed. Finish the final import into Shiftboard, then do one final export from Shiftboard, and only after that start the new process. The goal is to never end up with one structure for every year before 2026, a second for 2026, and a third once we're independent of Shiftboard.

This touches the no-write-back decision (2026-10-03), so the import may have to be done by hand in Shiftboard, or that decision revisited. No work has started on it.

@mbhewitt

Copy link
Copy Markdown
Owner Author

From Mew's 2026-11-26 roadmap (item 2): Mew's field list for the permanent shift record has gaps against this PR (volunteer and playa name at the time, canceled flag, checked-in instead of raw noshow, CSP, placeholder flag, separate shift name vs alias, source priority for old shifts). Details and questions are on #759. Suggest not loading on prod until Mew answers those.

Tracking: #849

@mbhewitt

Copy link
Copy Markdown
Owner Author

Mew (2026-11-27): hold. When we start roadmap item 2, we do the Q&A and update this PR to Mew's field list.

mbhewitt and others added 2 commits November 28, 2026 23:03
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
op_shift_history + op_shift_time_stats (migration 030, replaces 022): burn_year
in the key, checked_in, CSP (full day = 8, none recorded = on-playa hours),
2-4 score from both scales, names at the time, placeholders, shift grouping
(event_code / shift_instance), app details incl. meal. Loader merges legacy
shiftboard2 with post-playa app dumps (legacy wins; app adds checked-in rows
sb2 never saw; disagreeing check-ins get the credit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mbhewitt mbhewitt changed the title Permanent shift history table + loader (#759) Permanent shift record: op_shift_history + op_shift_time_stats (#759) Nov 29, 2026
mbhewitt and others added 2 commits November 28, 2026 23:18
…aya signups (#759)

Per Mew 2026-11-29: for <= 2025 sb2 is right except on-playa signups
Shiftboard never had; those are kept with their own check-in state. Made-up
on-playa ids link to the real person by new_shiftboard_id or a unique email
(Rain-Hoper excluded), recorded in linked_from_id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…759)

--sb-shifts reads prod's Shiftboard mirror for signups newer than the
legacy dump; app copies accept checked_in (post-029) and skip rows from
the next burn year.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mbhewitt
mbhewitt merged commit 7975e3a into main Nov 29, 2026
1 check passed
mbhewitt added a commit that referenced this pull request Nov 29, 2026
Mew 2026-11-29: ticket people are chosen from VIS respondents by score;
"lets do scores next". Score from op_shift_history (#808) per the formula
decided on #771 (10/02, 11/11, 11/27), with the old postplaya.php no-show
penalty, Core Crew bonus and decay (Mew 11/27), as of the form's burn year.
Admin-only: shown on the FormEditor answers page (sortable) and its CSV.
Footer 2027.G.00899.C.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant