Skip to content

Recurring schedule rules: tables, migration, nightly materializer #144

Open

Description

@tabedzki

🤖 AI text below 🤖

Part of the cross-repo work on recurring rig schedules (date ranges and weekday/weekend-only subjects). The full design and the tracking checklist are in BrainCOGS/tech_calendar_streamlit#125.

What this repo needs

# Change Notes
P1 Add ScheduleRule (+ Day part), ScheduleRuleException and LabClosure to u19_pipeline/scheduler.py; add -> [nullable] ScheduleRule (rule_id) to Schedule rule_id NULL means the row was made by hand or by the legacy copy-forward job
P2 Idempotent migration that declares the tables and runs ALTER TABLE schedule ADD rule_id … FK DataJoint does not alter existing tables. Run on u19_test_ first.
P3 u19_pipeline/utils/schedule_rules.py: expand rules, detect conflicts, and plan inserts/updates/deletes over a rolling window Pure logic; tested without a database
P4 schedule_check_alert: don't count planned rest days as a suspicious drop Otherwise a weekday-only cohort sets it off every Friday
P5 Nightly materialize_schedule cron job Must run after U19-pipeline-matlab's populate_schedule_for_tomorrow
P6 Deployment order: run the migration before deploying code that imports u19_pipeline.scheduler Importing the module declares any missing tables, which needs CREATE rights
P7 schedule_check_alert hardcodes u19_scheduler Use the configured prefix
P8 Schedule declares the subject NOT NULL, but the app writes NULL subjects Make the definition match the live table

Pull request coverage

Open

Closed without merging

Activity

  1. added
    enhancement
    on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions