{"id": "train-00000", "domain": "clinic", "pattern": "reminder", "batch": false, "sop": "Each day at 6pm, find every patient in the Visits sheet whose appointment is in three days and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Don't mention the diagnosis. At most 100 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 18:00\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 3 days and status == \"booked\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, a reminder from the clinic: your appointment is in three days at {time_of(r.starts)}.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00001", "domain": "clinic", "pattern": "reminder", "batch": false, "sop": "Daily at 8:30am, find every patient in the Visits sheet whose appointment is in a week and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Then mark them notified. Don't mention the diagnosis. At most 30 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 08:30\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 7 days and status == \"booked\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.patient}, a reminder from the clinic: your appointment is in a week at {time_of(r.starts)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00002", "domain": "clinic", "pattern": "reminder", "batch": false, "sop": "Every day at 8am, find every patient in the Visits sheet whose appointment is in three days and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Keep the diagnosis out of the message. At most 50 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 08:00\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 3 days and status == \"booked\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.patient}, a reminder from the clinic: your appointment is in three days at {time_of(r.starts)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00003", "domain": "clinic", "pattern": "reminder", "batch": false, "sop": "Every Friday at 4pm, find every patient in the Visits sheet whose appointment is in a week and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Then mark them notified. Never include their diagnosis. At most 50 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every friday at 16:00\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 7 days and status == \"booked\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, a reminder from the clinic: your appointment is in a week at {time_of(r.starts)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00004", "domain": "clinic", "pattern": "reminder", "batch": false, "sop": "On Fridays at 5:30pm, find every patient in the Visits sheet whose appointment is in a week and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Keep the diagnosis out of the message. At most 30 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every friday at 17:30\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 7 days and status == \"booked\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, a reminder from the clinic: your appointment is in a week at {time_of(r.starts)}.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00005", "domain": "clinic", "pattern": "reminder", "batch": false, "sop": "Every day at 11am, find every patient in the Visits sheet whose appointment is in two days and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Then mark them reminded. Never include their diagnosis. At most 30 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 11:00\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 2 days and status == \"booked\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, a reminder from the clinic: your appointment is in two days at {time_of(r.starts)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00006", "domain": "clinic", "pattern": "reminder", "batch": true, "sop": "Daily at 10am, find every patient in the Visits sheet whose appointment is in a week and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Don't mention the diagnosis. At most 20 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 10:00\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 7 days and status == \"booked\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.patient default 'there'}, a reminder from the clinic: your appointment is in a week at {time_of(r.starts)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00007", "domain": "clinic", "pattern": "reminder", "batch": true, "sop": "On Fridays at 8am, find every patient in the Visits sheet whose appointment is tomorrow and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Don't mention the diagnosis. At most 20 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every friday at 08:00\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.patient default 'there'}, a reminder from the clinic: your appointment is tomorrow at {time_of(r.starts)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00008", "domain": "clinic", "pattern": "reminder", "batch": true, "sop": "On Tuesdays at 5:30pm, find every patient in the Visits sheet whose appointment is tomorrow and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Don't mention the diagnosis. At most 20 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every tuesday at 17:30\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.patient}, a reminder from the clinic: your appointment is tomorrow at {time_of(r.starts)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00009", "domain": "clinic", "pattern": "reminder", "batch": true, "sop": "Daily at 6pm, find every patient in the Visits sheet whose appointment is in a week and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Then mark them reminded. Keep the diagnosis out of the message. At most 50 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 50 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 18:00\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 7 days and status == \"booked\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.patient}, a reminder from the clinic: your appointment is in a week at {time_of(r.starts)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00010", "domain": "clinic", "pattern": "reminder", "batch": true, "sop": "Each Monday at 4pm, find every patient in the Visits sheet whose appointment is tomorrow and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Then mark them notified. Keep the diagnosis out of the message. At most 100 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every monday at 16:00\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.patient default 'there'}, a reminder from the clinic: your appointment is tomorrow at {time_of(r.starts)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00011", "domain": "clinic", "pattern": "reminder", "batch": true, "sop": "Each Thursday at 5:30pm, find every patient in the Visits sheet whose appointment is in a week and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Then mark them reminded. Keep the diagnosis out of the message. At most 30 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 7 days and status == \"booked\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.patient default 'there'}, a reminder from the clinic: your appointment is in a week at {time_of(r.starts)}.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00012", "domain": "clinic", "pattern": "reminder", "batch": true, "sop": "Daily at 5:30pm, find every patient in the Visits sheet whose appointment is in a week and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Don't mention the diagnosis. At most 100 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 17:30\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 7 days and status == \"booked\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.patient}, a reminder from the clinic: your appointment is in a week at {time_of(r.starts)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00013", "domain": "clinic", "pattern": "followup", "batch": false, "sop": "Every day at 8:30am, look for patients marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 08:30\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 1 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00014", "domain": "clinic", "pattern": "followup", "batch": false, "sop": "Each morning at 11am, look for patients marked \"no-show\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 11:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 7 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00015", "domain": "clinic", "pattern": "followup", "batch": false, "sop": "Daily at 11am, look for patients marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 11:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 1 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.patient}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00016", "domain": "clinic", "pattern": "followup", "batch": false, "sop": "Daily at 9am, look for patients marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 09:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 1 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00017", "domain": "clinic", "pattern": "followup", "batch": false, "sop": "On Thursdays at 11am, look for patients marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 2 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00018", "domain": "clinic", "pattern": "followup", "batch": false, "sop": "Each morning at 8am, look for patients marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 08:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 1 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.patient}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00019", "domain": "clinic", "pattern": "followup", "batch": false, "sop": "Every Thursday at 8am, look for patients marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every thursday at 08:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 1 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.patient}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00020", "domain": "clinic", "pattern": "followup", "batch": true, "sop": "Every Friday at 11am, look for patients marked \"no-show\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every friday at 11:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 3 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.patient default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00021", "domain": "clinic", "pattern": "followup", "batch": true, "sop": "Every day at 8am, look for patients marked \"no-show\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the diagnosis out of the message.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 08:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 7 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.patient default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00022", "domain": "clinic", "pattern": "followup", "batch": true, "sop": "Daily at 5:30pm, look for patients marked \"no-show\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Keep the diagnosis out of the message.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 17:30\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 7 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.patient}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00023", "domain": "clinic", "pattern": "followup", "batch": true, "sop": "Each day at 4pm, look for patients marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 16:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 2 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.patient default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00024", "domain": "clinic", "pattern": "followup", "batch": true, "sop": "Each morning at 8am, look for patients marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Keep the diagnosis out of the message.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 08:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 1 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.patient}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00025", "domain": "clinic", "pattern": "followup", "batch": true, "sop": "Daily at 8:30am, look for patients marked \"no-show\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 08:30\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 7 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.patient}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00026", "domain": "clinic", "pattern": "followup", "batch": true, "sop": "On Tuesdays at 8am, look for patients marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every tuesday at 08:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 2 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.patient}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00027", "domain": "clinic", "pattern": "followup", "batch": true, "sop": "Each Wednesday at 10am, look for patients marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 2 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.patient default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00028", "domain": "clinic", "pattern": "lapsed", "batch": false, "sop": "Every Thursday at 5:30pm, find patients whose starts was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by starts first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00029", "domain": "clinic", "pattern": "lapsed", "batch": false, "sop": "Every day at 6pm, find patients whose starts was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 18:00\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by starts first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.patient}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00030", "domain": "clinic", "pattern": "lapsed", "batch": false, "sop": "Every Friday at 8:30am, find patients whose starts was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every friday at 08:30\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by starts first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00031", "domain": "clinic", "pattern": "lapsed", "batch": false, "sop": "Every day at 5:30pm, find patients whose starts was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 17:30\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by starts first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00032", "domain": "clinic", "pattern": "lapsed", "batch": false, "sop": "Each day at 6pm, find patients whose starts was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 18:00\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by starts first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00033", "domain": "clinic", "pattern": "lapsed", "batch": false, "sop": "Each morning at 10am, find patients whose starts was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 10:00\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by starts first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00034", "domain": "clinic", "pattern": "lapsed", "batch": false, "sop": "Every day at 10am, find patients whose starts was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 10:00\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by starts first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00035", "domain": "clinic", "pattern": "lapsed", "batch": true, "sop": "Each morning at 11am, find patients whose starts was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Keep the diagnosis out of the message.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 11:00\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by starts first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.patient}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00036", "domain": "clinic", "pattern": "lapsed", "batch": true, "sop": "Every day at 9am, find patients whose starts was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 09:00\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by starts first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.patient}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00037", "domain": "clinic", "pattern": "lapsed", "batch": true, "sop": "Each Monday at 5:30pm, find patients whose starts was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every monday at 17:30\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by starts first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.patient default 'there'}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00038", "domain": "clinic", "pattern": "lapsed", "batch": true, "sop": "Each morning at 10am, find patients whose starts was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 10:00\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by starts first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.patient default 'there'}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00039", "domain": "clinic", "pattern": "lapsed", "batch": true, "sop": "Every Tuesday at 8:30am, find patients whose starts was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every tuesday at 08:30\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by starts first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.patient default 'there'}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00040", "domain": "clinic", "pattern": "lapsed", "batch": true, "sop": "Each morning at 9am, find patients whose starts was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 09:00\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by starts first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.patient default 'there'}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00041", "domain": "clinic", "pattern": "lapsed", "batch": true, "sop": "Daily at 11am, find patients whose starts was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 11:00\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by starts first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.patient}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00042", "domain": "clinic", "pattern": "lapsed", "batch": true, "sop": "Each Wednesday at 8:30am, find patients whose starts was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every wednesday at 08:30\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by starts first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.patient}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00043", "domain": "clinic", "pattern": "summary", "batch": false, "sop": "Each Wednesday at 4pm, count the patients in Visits whose status is \"booked\", and send the numbers to me only. Don't message any patients.", "policy": "policy ClinicPolicy {\n allow read Visits(status, copay, patient, phone)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicDailySummary {\n about \"Tell the owner how many patients are booked\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every wednesday at 16:00\n\n let all = fetch Visits\n let these = filter all where status == \"booked\"\n let n = summarize count of these\n notify owner \"Booked patients today: {n}\"\n}"} {"id": "train-00044", "domain": "clinic", "pattern": "summary", "batch": false, "sop": "Every day at 4pm, count the patients in Visits whose status is \"no-show\" and the total copay, and send the numbers to me only. Don't message any patients. If there are none, don't bother me.", "policy": "policy ClinicPolicy {\n allow read Visits(status, copay, patient, phone)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicDailySummary {\n about \"Tell the owner how many patients are no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 16:00\n\n let all = fetch Visits\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n let total = summarize sum copay of these\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients: {n}, total copay: {total}\"\n}"} {"id": "train-00045", "domain": "clinic", "pattern": "summary", "batch": false, "sop": "Daily at 9am, count the patients in Visits whose status is \"no-show\", and send the numbers to me only. Don't message any patients.", "policy": "policy ClinicPolicy {\n allow read Visits(status, copay, patient, phone)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicDailySummary {\n about \"Tell the owner how many patients are no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 09:00\n\n let all = fetch Visits\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n notify owner \"No-show patients today: {n}\"\n}"} {"id": "train-00046", "domain": "clinic", "pattern": "summary", "batch": false, "sop": "Each morning at 11am, count the patients in Visits whose status is \"done\" and the total copay, and send the numbers to me only. Don't message any patients. If there are none, don't bother me.", "policy": "policy ClinicPolicy {\n allow read Visits(status, copay, patient, phone, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicDailySummary {\n about \"Tell the owner how many patients are done\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 11:00\n\n let all = fetch Visits\n let these = filter all where status == \"done\"\n let n = summarize count of these\n let total = summarize sum copay of these\n if n == 0 {\n stop \"no done patients\"\n }\n notify owner \"Done patients: {n}, total copay: {total}\"\n}"} {"id": "train-00047", "domain": "clinic", "pattern": "summary", "batch": false, "sop": "Daily at 5:30pm, count the patients in Visits whose status is \"done\", and send the numbers to me only. Don't message any patients.", "policy": "policy ClinicPolicy {\n allow read Visits(status, copay, patient, phone, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicDailySummary {\n about \"Tell the owner how many patients are done\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 17:30\n\n let all = fetch Visits\n let these = filter all where status == \"done\"\n let n = summarize count of these\n notify owner \"Done patients today: {n}\"\n}"} {"id": "train-00048", "domain": "clinic", "pattern": "summary", "batch": false, "sop": "On Thursdays at 10am, count the patients in Visits whose status is \"no-show\" and the total copay, and send the numbers to me only. Don't message any patients. If there are none, don't bother me.", "policy": "policy ClinicPolicy {\n allow read Visits(status, copay, patient, phone)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicDailySummary {\n about \"Tell the owner how many patients are no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Visits\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n let total = summarize sum copay of these\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients: {n}, total copay: {total}\"\n}"} {"id": "train-00049", "domain": "clinic", "pattern": "summary", "batch": false, "sop": "Every day at 6pm, count the patients in Visits whose status is \"no-show\" and the total copay, and send the numbers to me only. Don't message any patients. If there are none, don't bother me.", "policy": "policy ClinicPolicy {\n allow read Visits(status, copay, patient, phone, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicDailySummary {\n about \"Tell the owner how many patients are no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 18:00\n\n let all = fetch Visits\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n let total = summarize sum copay of these\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients: {n}, total copay: {total}\"\n}"} {"id": "train-00050", "domain": "clinic", "pattern": "summary", "batch": false, "sop": "Each Monday at 8:30am, count the patients in Visits whose status is \"no-show\" and the total copay, and send the numbers to me only. Don't message any patients. If there are none, don't bother me.", "policy": "policy ClinicPolicy {\n allow read Visits(status, copay, patient, phone)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicDailySummary {\n about \"Tell the owner how many patients are no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every monday at 08:30\n\n let all = fetch Visits\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n let total = summarize sum copay of these\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients: {n}, total copay: {total}\"\n}"} {"id": "train-00051", "domain": "clinic", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy ClinicRefundPolicy {\n allow read RefundRequests(request_id, patient, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $240 per day\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure ClinicRefunds {\n about \"Handle refund requests within limits\"\n policy ClinicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00052", "domain": "clinic", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy ClinicRefundPolicy {\n allow read RefundRequests(request_id, patient, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $75 per action\n limit refund $375 per day\n refund without approval up to $10\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure ClinicRefunds {\n about \"Handle refund requests within limits\"\n policy ClinicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00053", "domain": "clinic", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy ClinicRefundPolicy {\n allow read RefundRequests(request_id, patient, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $500 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure ClinicRefunds {\n about \"Handle refund requests within limits\"\n policy ClinicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00054", "domain": "clinic", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy ClinicRefundPolicy {\n allow read RefundRequests(request_id, patient, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $50 per action\n limit refund $250 per day\n refund without approval up to $20\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure ClinicRefunds {\n about \"Handle refund requests within limits\"\n policy ClinicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.patient}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00055", "domain": "clinic", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy ClinicRefundPolicy {\n allow read RefundRequests(request_id, patient, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $50 per action\n limit refund $300 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure ClinicRefunds {\n about \"Handle refund requests within limits\"\n policy ClinicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00056", "domain": "clinic", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy ClinicRefundPolicy {\n allow read RefundRequests(request_id, patient, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure ClinicRefunds {\n about \"Handle refund requests within limits\"\n policy ClinicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.patient}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00057", "domain": "clinic", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy ClinicRefundPolicy {\n allow read RefundRequests(request_id, patient, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $200 per day\n refund without approval up to $15\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure ClinicRefunds {\n about \"Handle refund requests within limits\"\n policy ClinicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00058", "domain": "clinic", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy ClinicRefundPolicy {\n allow read RefundRequests(request_id, patient, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $500 per day\n refund without approval up to $15\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure ClinicRefunds {\n about \"Handle refund requests within limits\"\n policy ClinicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, patient: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00059", "domain": "clinic", "pattern": "confirm_new", "batch": false, "sop": "When a new appointment is added to Visits: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (i need to ok every message), put it on the Rooms calendar for 45 minutes, and mark it confirmed. Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, copay)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow calendar Rooms\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\ncalendar Rooms \"Rooms\"", "program": "procedure ClinicConfirmNewAppointment {\n about \"Confirm a new appointment and add it to the calendar\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n calendar Rooms \"Rooms\"\n trigger when new row r in Visits\n\n if r.starts < now() + 12 hours {\n notify owner \"Short-notice appointment for {r.patient} at {r.starts}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your appointment with the clinic is confirmed for {r.starts}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Rooms { title: \"{r.patient}\", at: r.starts, length: 45 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00060", "domain": "clinic", "pattern": "confirm_new", "batch": false, "sop": "When a new appointment is added to Visits: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Rooms calendar for 60 minutes, and mark it confirmed. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, copay, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 09:00 and 21:00\n allow calendar Rooms\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\ncalendar Rooms \"Rooms\"", "program": "procedure ClinicConfirmNewAppointment {\n about \"Confirm a new appointment and add it to the calendar\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n calendar Rooms \"Rooms\"\n trigger when new row r in Visits\n\n if r.starts < now() + 12 hours {\n notify owner \"Short-notice appointment for {r.patient} at {r.starts}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your appointment with the clinic is confirmed for {r.starts}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Rooms { title: \"{r.patient}\", at: r.starts, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00061", "domain": "clinic", "pattern": "confirm_new", "batch": false, "sop": "When a new appointment is added to Visits: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (nothing goes out until i've approved it), put it on the Rooms calendar for 30 minutes, and mark it confirmed. Keep the diagnosis out of the message.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, copay, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow calendar Rooms\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\ncalendar Rooms \"Rooms\"", "program": "procedure ClinicConfirmNewAppointment {\n about \"Confirm a new appointment and add it to the calendar\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n calendar Rooms \"Rooms\"\n trigger when new row r in Visits\n\n if r.starts < now() + 2 hours {\n notify owner \"Short-notice appointment for {r.patient} at {r.starts}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your appointment with the clinic is confirmed for {r.starts}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Rooms { title: \"{r.patient}\", at: r.starts, length: 30 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00062", "domain": "clinic", "pattern": "confirm_new", "batch": false, "sop": "When a new appointment is added to Visits: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (i want to approve each message first), put it on the Rooms calendar for 90 minutes, and mark it confirmed. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, copay, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow calendar Rooms\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\ncalendar Rooms \"Rooms\"", "program": "procedure ClinicConfirmNewAppointment {\n about \"Confirm a new appointment and add it to the calendar\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n calendar Rooms \"Rooms\"\n trigger when new row r in Visits\n\n if r.starts < now() + 2 hours {\n notify owner \"Short-notice appointment for {r.patient} at {r.starts}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your appointment with the clinic is confirmed for {r.starts}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Rooms { title: \"{r.patient}\", at: r.starts, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00063", "domain": "clinic", "pattern": "confirm_new", "batch": false, "sop": "When a new appointment is added to Visits: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (i want to approve each message first), put it on the Rooms calendar for 90 minutes, and mark it confirmed. Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, copay)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 18:00\n allow calendar Rooms\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\ncalendar Rooms \"Rooms\"", "program": "procedure ClinicConfirmNewAppointment {\n about \"Confirm a new appointment and add it to the calendar\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n calendar Rooms \"Rooms\"\n trigger when new row r in Visits\n\n if r.starts < now() + 12 hours {\n notify owner \"Short-notice appointment for {r.patient} at {r.starts}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your appointment with the clinic is confirmed for {r.starts}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Rooms { title: \"{r.patient}\", at: r.starts, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00064", "domain": "clinic", "pattern": "confirm_new", "batch": false, "sop": "When a new appointment is added to Visits: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (show me the messages for approval first), put it on the Rooms calendar for 45 minutes, and mark it confirmed. Keep the diagnosis out of the message.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, copay, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow calendar Rooms\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\ncalendar Rooms \"Rooms\"", "program": "procedure ClinicConfirmNewAppointment {\n about \"Confirm a new appointment and add it to the calendar\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n calendar Rooms \"Rooms\"\n trigger when new row r in Visits\n\n if r.starts < now() + 2 hours {\n notify owner \"Short-notice appointment for {r.patient} at {r.starts}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your appointment with the clinic is confirmed for {r.starts}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Rooms { title: \"{r.patient}\", at: r.starts, length: 45 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00065", "domain": "clinic", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Visits, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Keep the diagnosis out of the message.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger when new row r in Visits\n\n let first = draft sms to r.phone: \"Hi {r.patient}, thanks for choosing the clinic! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Visits\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.patient default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00066", "domain": "clinic", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Visits, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger when new row r in Visits\n\n let first = draft sms to r.phone: \"Hi {r.patient default 'there'}, thanks for choosing the clinic! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Visits\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.patient default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00067", "domain": "clinic", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Visits, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger when new row r in Visits\n\n let first = draft sms to r.phone: \"Hi {r.patient default 'there'}, thanks for choosing the clinic! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Visits\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.patient default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00068", "domain": "clinic", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Visits, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger when new row r in Visits\n\n let first = draft sms to r.phone: \"Hi {r.patient default 'there'}, thanks for choosing the clinic! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Visits\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.patient default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00069", "domain": "clinic", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Visits, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger when new row r in Visits\n\n let first = draft sms to r.phone: \"Hi {r.patient}, thanks for choosing the clinic! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Visits\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.patient default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00070", "domain": "clinic", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Visits, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger when new row r in Visits\n\n let first = draft sms to r.phone: \"Hi {r.patient default 'there'}, thanks for choosing the clinic! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Visits\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.patient default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00071", "domain": "clinic", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Visits, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger when new row r in Visits\n\n let first = draft sms to r.phone: \"Hi {r.patient default 'there'}, thanks for choosing the clinic! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Visits\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.patient default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00072", "domain": "clinic", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Visits, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Keep the diagnosis out of the message.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, status)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger when new row r in Visits\n\n let first = draft sms to r.phone: \"Hi {r.patient default 'there'}, thanks for choosing the clinic! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Visits\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.patient}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00073", "domain": "clinic", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Never include their diagnosis. No more than 50.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, come back to the clinic! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00074", "domain": "clinic", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Don't mention the diagnosis. No more than 100.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.patient}, come back to the clinic! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00075", "domain": "clinic", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Never include their diagnosis. No more than 100.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, come back to the clinic! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00076", "domain": "clinic", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Never include their diagnosis. No more than 50.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, come back to the clinic! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00077", "domain": "clinic", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Never include their diagnosis. No more than 100.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.patient}, come back to the clinic! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00078", "domain": "clinic", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Never include their diagnosis. No more than 100.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.patient}, come back to the clinic! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00079", "domain": "clinic", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Never include their diagnosis. No more than 50.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, come back to the clinic! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00080", "domain": "clinic", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Keep the diagnosis out of the message. No more than 50.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.patient default 'there'}, come back to the clinic! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00081", "domain": "clinic", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the diagnosis out of the message. No more than 50.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.patient default 'there'}, come back to the clinic! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00082", "domain": "clinic", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Don't mention the diagnosis. No more than 100.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.patient default 'there'}, come back to the clinic! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00083", "domain": "clinic", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the diagnosis out of the message. No more than 100.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.patient default 'there'}, come back to the clinic! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00084", "domain": "clinic", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Keep the diagnosis out of the message. No more than 100.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.patient default 'there'}, come back to the clinic! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00085", "domain": "clinic", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Never include their diagnosis. No more than 100.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.patient default 'there'}, come back to the clinic! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00086", "domain": "clinic", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Never include their diagnosis. No more than 100.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.patient}, come back to the clinic! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00087", "domain": "dental", "pattern": "reminder", "batch": false, "sop": "Every day at 4pm, find every patient in the Patients sheet whose cleaning is in a week and whose status is \"booked\". Send each one a text reminder. Nothing goes out until I've approved it. Never include their medical history. At most 20 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 16:00\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 7 days and status == \"booked\"\n for each r in due up to 20 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, a reminder from the office: your cleaning is in a week at {time_of(r.next_visit)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00088", "domain": "dental", "pattern": "reminder", "batch": false, "sop": "Daily at 9am, find every patient in the Patients sheet whose cleaning is in a week and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Don't mention the medical history. At most 30 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 09:00\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 7 days and status == \"booked\"\n for each r in due up to 30 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, a reminder from the office: your cleaning is in a week at {time_of(r.next_visit)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00089", "domain": "dental", "pattern": "reminder", "batch": false, "sop": "Each day at 4pm, find every patient in the Patients sheet whose cleaning is in two days and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Don't mention the medical history. At most 50 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 16:00\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 2 days and status == \"booked\"\n for each r in due up to 50 {\n let m = draft sms to r.mobile: \"Hi {r.name}, a reminder from the office: your cleaning is in two days at {time_of(r.next_visit)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00090", "domain": "dental", "pattern": "reminder", "batch": false, "sop": "Every Friday at 5:30pm, find every patient in the Patients sheet whose cleaning is in two days and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Keep the medical history out of the message. At most 100 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every friday at 17:30\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 2 days and status == \"booked\"\n for each r in due up to 100 {\n let m = draft sms to r.mobile: \"Hi {r.name}, a reminder from the office: your cleaning is in two days at {time_of(r.next_visit)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00091", "domain": "dental", "pattern": "reminder", "batch": false, "sop": "Every day at 5:30pm, find every patient in the Patients sheet whose cleaning is tomorrow and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Keep the medical history out of the message. At most 30 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 17:30\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 1 day and status == \"booked\"\n for each r in due up to 30 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, a reminder from the office: your cleaning is tomorrow at {time_of(r.next_visit)}.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00092", "domain": "dental", "pattern": "reminder", "batch": false, "sop": "Daily at 4pm, find every patient in the Patients sheet whose cleaning is in three days and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Don't mention the medical history. At most 50 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 16:00\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 3 days and status == \"booked\"\n for each r in due up to 50 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, a reminder from the office: your cleaning is in three days at {time_of(r.next_visit)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00093", "domain": "dental", "pattern": "reminder", "batch": false, "sop": "Daily at 4pm, find every patient in the Patients sheet whose cleaning is in three days and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Never include their medical history. At most 20 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 16:00\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 3 days and status == \"booked\"\n for each r in due up to 20 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, a reminder from the office: your cleaning is in three days at {time_of(r.next_visit)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00094", "domain": "dental", "pattern": "reminder", "batch": false, "sop": "Every day at 8:30am, find every patient in the Patients sheet whose cleaning is in a week and whose status is \"booked\". Send each one a text reminder. Nothing goes out until I've approved it. Don't mention the medical history. At most 50 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 08:30\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 7 days and status == \"booked\"\n for each r in due up to 50 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, a reminder from the office: your cleaning is in a week at {time_of(r.next_visit)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00095", "domain": "dental", "pattern": "reminder", "batch": true, "sop": "Daily at 11am, find every patient in the Patients sheet whose cleaning is tomorrow and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Then mark them reminded. Keep the medical history out of the message. At most 30 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 11:00\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 30 sms to r.mobile: \"Hi {r.name}, a reminder from the office: your cleaning is tomorrow at {time_of(r.next_visit)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00096", "domain": "dental", "pattern": "reminder", "batch": true, "sop": "Every day at 8:30am, find every patient in the Patients sheet whose cleaning is in three days and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Don't mention the medical history. At most 30 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 08:30\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 3 days and status == \"booked\"\n let msgs = draft each r in due up to 30 sms to r.mobile: \"Hi {r.name}, a reminder from the office: your cleaning is in three days at {time_of(r.next_visit)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00097", "domain": "dental", "pattern": "reminder", "batch": true, "sop": "Daily at 8am, find every patient in the Patients sheet whose cleaning is tomorrow and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Never include their medical history. At most 100 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 08:00\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 100 sms to r.mobile: \"Hi {r.name}, a reminder from the office: your cleaning is tomorrow at {time_of(r.next_visit)}.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00098", "domain": "dental", "pattern": "reminder", "batch": true, "sop": "Each Thursday at 9am, find every patient in the Patients sheet whose cleaning is in three days and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Then mark them reminded. Don't mention the medical history. At most 30 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every thursday at 09:00\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 3 days and status == \"booked\"\n let msgs = draft each r in due up to 30 sms to r.mobile: \"Hi {r.name default 'there'}, a reminder from the office: your cleaning is in three days at {time_of(r.next_visit)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00099", "domain": "dental", "pattern": "reminder", "batch": true, "sop": "Every day at 8:30am, find every patient in the Patients sheet whose cleaning is in two days and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Don't mention the medical history. At most 100 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 100 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 08:30\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 2 days and status == \"booked\"\n let msgs = draft each r in due up to 100 sms to r.mobile: \"Hi {r.name}, a reminder from the office: your cleaning is in two days at {time_of(r.next_visit)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00100", "domain": "dental", "pattern": "reminder", "batch": true, "sop": "Each Friday at 8am, find every patient in the Patients sheet whose cleaning is tomorrow and whose status is \"booked\". Send each one a text reminder. Nothing goes out until I've approved it. Then mark them reminded. Keep the medical history out of the message. At most 50 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 50 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every friday at 08:00\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 50 sms to r.mobile: \"Hi {r.name default 'there'}, a reminder from the office: your cleaning is tomorrow at {time_of(r.next_visit)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00101", "domain": "dental", "pattern": "reminder", "batch": true, "sop": "Each day at 6pm, find every patient in the Patients sheet whose cleaning is in three days and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Keep the medical history out of the message. At most 100 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 18:00\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 3 days and status == \"booked\"\n let msgs = draft each r in due up to 100 sms to r.mobile: \"Hi {r.name default 'there'}, a reminder from the office: your cleaning is in three days at {time_of(r.next_visit)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00102", "domain": "dental", "pattern": "reminder", "batch": true, "sop": "Each day at 6pm, find every patient in the Patients sheet whose cleaning is tomorrow and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Don't mention the medical history. At most 50 per run.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalCleaningReminders {\n about \"Remind each patient about their cleaning\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 18:00\n\n let all = fetch Patients\n let due = filter all where date_of(next_visit) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 50 sms to r.mobile: \"Hi {r.name}, a reminder from the office: your cleaning is tomorrow at {time_of(r.next_visit)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00103", "domain": "dental", "pattern": "followup", "batch": false, "sop": "Every day at 8am, look for patients marked \"no-show\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 08:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 3 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00104", "domain": "dental", "pattern": "followup", "batch": false, "sop": "On Mondays at 4pm, look for patients marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every monday at 16:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 2 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00105", "domain": "dental", "pattern": "followup", "batch": false, "sop": "Each morning at 9am, look for patients marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 09:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 2 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.mobile: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00106", "domain": "dental", "pattern": "followup", "batch": false, "sop": "Every day at 8am, look for patients marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Don't mention the medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 08:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 1 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.mobile: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00107", "domain": "dental", "pattern": "followup", "batch": false, "sop": "Every Tuesday at 4pm, look for patients marked \"no-show\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Don't mention the medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every tuesday at 16:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 7 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00108", "domain": "dental", "pattern": "followup", "batch": false, "sop": "Each morning at 10am, look for patients marked \"no-show\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 10:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 7 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.mobile: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00109", "domain": "dental", "pattern": "followup", "batch": false, "sop": "On Tuesdays at 6pm, look for patients marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 1 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00110", "domain": "dental", "pattern": "followup", "batch": false, "sop": "Every Thursday at 5:30pm, look for patients marked \"no-show\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 7 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00111", "domain": "dental", "pattern": "followup", "batch": true, "sop": "Each day at 4pm, look for patients marked \"no-show\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 40 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 16:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 3 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.mobile: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00112", "domain": "dental", "pattern": "followup", "batch": true, "sop": "Each morning at 8am, look for patients marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 08:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 1 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.mobile: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00113", "domain": "dental", "pattern": "followup", "batch": true, "sop": "Each morning at 9am, look for patients marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 09:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 2 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.mobile: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00114", "domain": "dental", "pattern": "followup", "batch": true, "sop": "Daily at 4pm, look for patients marked \"no-show\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 16:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 3 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.mobile: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00115", "domain": "dental", "pattern": "followup", "batch": true, "sop": "Every Tuesday at 9am, look for patients marked \"no-show\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every tuesday at 09:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 7 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.mobile: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00116", "domain": "dental", "pattern": "followup", "batch": true, "sop": "Daily at 4pm, look for patients marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 16:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 1 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.mobile: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00117", "domain": "dental", "pattern": "followup", "batch": true, "sop": "Each Monday at 9am, look for patients marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every monday at 09:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 1 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.mobile: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00118", "domain": "dental", "pattern": "lapsed", "batch": false, "sop": "Daily at 6pm, find patients whose next visit was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 18:00\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by next_visit first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.mobile: \"Hi {r.name}, it's been a while! We'd love to see you again at the office.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00119", "domain": "dental", "pattern": "lapsed", "batch": false, "sop": "Each morning at 8:30am, find patients whose next visit was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 08:30\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by next_visit first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the office.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00120", "domain": "dental", "pattern": "lapsed", "batch": false, "sop": "Each morning at 8:30am, find patients whose next visit was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 08:30\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by next_visit first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.mobile: \"Hi {r.name}, it's been a while! We'd love to see you again at the office.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00121", "domain": "dental", "pattern": "lapsed", "batch": false, "sop": "Daily at 5:30pm, find patients whose next visit was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 17:30\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by next_visit first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.mobile: \"Hi {r.name}, it's been a while! We'd love to see you again at the office.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00122", "domain": "dental", "pattern": "lapsed", "batch": false, "sop": "Each morning at 11am, find patients whose next visit was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 11:00\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by next_visit first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.mobile: \"Hi {r.name}, it's been a while! We'd love to see you again at the office.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00123", "domain": "dental", "pattern": "lapsed", "batch": false, "sop": "Each day at 4pm, find patients whose next visit was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 16:00\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by next_visit first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the office.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00124", "domain": "dental", "pattern": "lapsed", "batch": false, "sop": "Every day at 9am, find patients whose next visit was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 09:00\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by next_visit first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.mobile: \"Hi {r.name}, it's been a while! We'd love to see you again at the office.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00125", "domain": "dental", "pattern": "lapsed", "batch": true, "sop": "On Mondays at 11am, find patients whose next visit was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every monday at 11:00\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by next_visit first 15\n let msgs = draft each r in oldest up to 15 sms to r.mobile: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the office.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00126", "domain": "dental", "pattern": "lapsed", "batch": true, "sop": "Each day at 5:30pm, find patients whose next visit was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Show me the messages for approval first. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 17:30\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by next_visit first 10\n let msgs = draft each r in oldest up to 10 sms to r.mobile: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the office.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00127", "domain": "dental", "pattern": "lapsed", "batch": true, "sop": "On Thursdays at 8:30am, find patients whose next visit was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by next_visit first 20\n let msgs = draft each r in oldest up to 20 sms to r.mobile: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the office.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00128", "domain": "dental", "pattern": "lapsed", "batch": true, "sop": "Every Monday at 9am, find patients whose next visit was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Show me the messages for approval first. Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every monday at 09:00\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by next_visit first 10\n let msgs = draft each r in oldest up to 10 sms to r.mobile: \"Hi {r.name}, it's been a while! We'd love to see you again at the office.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00129", "domain": "dental", "pattern": "lapsed", "batch": true, "sop": "Every day at 10am, find patients whose next visit was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 10:00\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by next_visit first 10\n let msgs = draft each r in oldest up to 10 sms to r.mobile: \"Hi {r.name}, it's been a while! We'd love to see you again at the office.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00130", "domain": "dental", "pattern": "lapsed", "batch": true, "sop": "Each day at 5:30pm, find patients whose next visit was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Don't mention the medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 17:30\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by next_visit first 10\n let msgs = draft each r in oldest up to 10 sms to r.mobile: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the office.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00131", "domain": "dental", "pattern": "lapsed", "batch": true, "sop": "Each day at 4pm, find patients whose next visit was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 16:00\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by next_visit first 20\n let msgs = draft each r in oldest up to 20 sms to r.mobile: \"Hi {r.name}, it's been a while! We'd love to see you again at the office.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00132", "domain": "dental", "pattern": "lapsed", "batch": true, "sop": "Every Thursday at 9am, find patients whose next visit was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every thursday at 09:00\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by next_visit first 20\n let msgs = draft each r in oldest up to 20 sms to r.mobile: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the office.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00133", "domain": "dental", "pattern": "summary", "batch": false, "sop": "Each Monday at 6pm, count the patients in Patients whose status is \"done\" and the total balance, and send the numbers to me only. Don't message any patients. If there are none, don't bother me.", "policy": "policy DentalPolicy {\n allow read Patients(status, balance, name, mobile, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalDailySummary {\n about \"Tell the owner how many patients are done\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every monday at 18:00\n\n let all = fetch Patients\n let these = filter all where status == \"done\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no done patients\"\n }\n notify owner \"Done patients: {n}, total balance: {total}\"\n}"} {"id": "train-00134", "domain": "dental", "pattern": "summary", "batch": false, "sop": "Daily at 8:30am, count the patients in Patients whose status is \"no-show\" and the total balance, and send the numbers to me only. Don't message any patients. If there are none, don't bother me.", "policy": "policy DentalPolicy {\n allow read Patients(status, balance, name, mobile, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalDailySummary {\n about \"Tell the owner how many patients are no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 08:30\n\n let all = fetch Patients\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients: {n}, total balance: {total}\"\n}"} {"id": "train-00135", "domain": "dental", "pattern": "summary", "batch": false, "sop": "Every day at 5:30pm, count the patients in Patients whose status is \"done\", and send the numbers to me only. Don't message any patients.", "policy": "policy DentalPolicy {\n allow read Patients(status, balance, name, mobile)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalDailySummary {\n about \"Tell the owner how many patients are done\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 17:30\n\n let all = fetch Patients\n let these = filter all where status == \"done\"\n let n = summarize count of these\n notify owner \"Done patients today: {n}\"\n}"} {"id": "train-00136", "domain": "dental", "pattern": "summary", "batch": false, "sop": "Every Thursday at 10am, count the patients in Patients whose status is \"done\" and the total balance, and send the numbers to me only. Don't message any patients. If there are none, don't bother me.", "policy": "policy DentalPolicy {\n allow read Patients(status, balance, name, mobile, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalDailySummary {\n about \"Tell the owner how many patients are done\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Patients\n let these = filter all where status == \"done\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no done patients\"\n }\n notify owner \"Done patients: {n}, total balance: {total}\"\n}"} {"id": "train-00137", "domain": "dental", "pattern": "summary", "batch": false, "sop": "Daily at 6pm, count the patients in Patients whose status is \"booked\" and the total balance, and send the numbers to me only. Don't message any patients. If there are none, don't bother me.", "policy": "policy DentalPolicy {\n allow read Patients(status, balance, name, mobile)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalDailySummary {\n about \"Tell the owner how many patients are booked\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 18:00\n\n let all = fetch Patients\n let these = filter all where status == \"booked\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no booked patients\"\n }\n notify owner \"Booked patients: {n}, total balance: {total}\"\n}"} {"id": "train-00138", "domain": "dental", "pattern": "summary", "batch": false, "sop": "Every day at 8:30am, count the patients in Patients whose status is \"booked\", and send the numbers to me only. Don't message any patients.", "policy": "policy DentalPolicy {\n allow read Patients(status, balance, name, mobile, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalDailySummary {\n about \"Tell the owner how many patients are booked\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 08:30\n\n let all = fetch Patients\n let these = filter all where status == \"booked\"\n let n = summarize count of these\n notify owner \"Booked patients today: {n}\"\n}"} {"id": "train-00139", "domain": "dental", "pattern": "summary", "batch": false, "sop": "Each morning at 10am, count the patients in Patients whose status is \"done\", and send the numbers to me only. Don't message any patients.", "policy": "policy DentalPolicy {\n allow read Patients(status, balance, name, mobile, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalDailySummary {\n about \"Tell the owner how many patients are done\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 10:00\n\n let all = fetch Patients\n let these = filter all where status == \"done\"\n let n = summarize count of these\n notify owner \"Done patients today: {n}\"\n}"} {"id": "train-00140", "domain": "dental", "pattern": "summary", "batch": false, "sop": "Every Friday at 4pm, count the patients in Patients whose status is \"no-show\", and send the numbers to me only. Don't message any patients.", "policy": "policy DentalPolicy {\n allow read Patients(status, balance, name, mobile, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalDailySummary {\n about \"Tell the owner how many patients are no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every friday at 16:00\n\n let all = fetch Patients\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n notify owner \"No-show patients today: {n}\"\n}"} {"id": "train-00141", "domain": "dental", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy DentalRefundPolicy {\n allow read RefundRequests(request_id, name, mobile, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.mobile\n limit refund $100 per action\n limit refund $500 per day\n refund without approval up to $10\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure DentalRefunds {\n about \"Handle refund requests within limits\"\n policy DentalRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.mobile: \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00142", "domain": "dental", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy DentalRefundPolicy {\n allow read RefundRequests(request_id, name, mobile, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.mobile\n limit refund $75 per action\n limit refund $225 per day\n refund without approval up to $10\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure DentalRefunds {\n about \"Handle refund requests within limits\"\n policy DentalRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00143", "domain": "dental", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $50, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy DentalRefundPolicy {\n allow read RefundRequests(request_id, name, mobile, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.mobile\n limit refund $50 per action\n limit refund $250 per day\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure DentalRefunds {\n about \"Handle refund requests within limits\"\n policy DentalRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00144", "domain": "dental", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy DentalRefundPolicy {\n allow read RefundRequests(request_id, name, mobile, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.mobile\n limit refund $50 per action\n limit refund $300 per day\n refund without approval up to $10\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure DentalRefunds {\n about \"Handle refund requests within limits\"\n policy DentalRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00145", "domain": "dental", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy DentalRefundPolicy {\n allow read RefundRequests(request_id, name, mobile, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.mobile\n limit refund $75 per action\n limit refund $225 per day\n refund without approval up to $20\n limit sends 30 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure DentalRefunds {\n about \"Handle refund requests within limits\"\n policy DentalRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.mobile: \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00146", "domain": "dental", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy DentalRefundPolicy {\n allow read RefundRequests(request_id, name, mobile, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.mobile\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $20\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure DentalRefunds {\n about \"Handle refund requests within limits\"\n policy DentalRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00147", "domain": "dental", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy DentalRefundPolicy {\n allow read RefundRequests(request_id, name, mobile, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.mobile\n limit refund $50 per action\n limit refund $300 per day\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure DentalRefunds {\n about \"Handle refund requests within limits\"\n policy DentalRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.mobile: \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00148", "domain": "dental", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the patient know (I approve that message too).", "policy": "policy DentalRefundPolicy {\n allow read RefundRequests(request_id, name, mobile, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.mobile\n limit refund $50 per action\n limit refund $250 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure DentalRefunds {\n about \"Handle refund requests within limits\"\n policy DentalRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, mobile: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.mobile: \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00149", "domain": "dental", "pattern": "confirm_new", "batch": false, "sop": "When a new cleaning is added to Patients: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (i want to approve each message first), put it on the Chairs calendar for 90 minutes, and mark it confirmed. Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, balance)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow calendar Chairs\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\ncalendar Chairs \"Chairs\"", "program": "procedure DentalConfirmNewCleaning {\n about \"Confirm a new cleaning and add it to the calendar\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n calendar Chairs \"Chairs\"\n trigger when new row r in Patients\n\n if r.next_visit < now() + 24 hours {\n notify owner \"Short-notice cleaning for {r.name} at {r.next_visit}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.mobile: \"Hi {r.name}, your cleaning with the office is confirmed for {r.next_visit}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Chairs { title: \"{r.name}\", at: r.next_visit, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00150", "domain": "dental", "pattern": "confirm_new", "batch": false, "sop": "When a new cleaning is added to Patients: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Chairs calendar for 30 minutes, and mark it confirmed. Don't mention the medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, balance)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow calendar Chairs\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\ncalendar Chairs \"Chairs\"", "program": "procedure DentalConfirmNewCleaning {\n about \"Confirm a new cleaning and add it to the calendar\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n calendar Chairs \"Chairs\"\n trigger when new row r in Patients\n\n if r.next_visit < now() + 24 hours {\n notify owner \"Short-notice cleaning for {r.name} at {r.next_visit}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.mobile: \"Hi {r.name}, your cleaning with the office is confirmed for {r.next_visit}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Chairs { title: \"{r.name}\", at: r.next_visit, length: 30 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00151", "domain": "dental", "pattern": "confirm_new", "batch": false, "sop": "When a new cleaning is added to Patients: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Chairs calendar for 60 minutes, and mark it confirmed. Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, balance, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 09:00 and 21:00\n allow calendar Chairs\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\ncalendar Chairs \"Chairs\"", "program": "procedure DentalConfirmNewCleaning {\n about \"Confirm a new cleaning and add it to the calendar\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n calendar Chairs \"Chairs\"\n trigger when new row r in Patients\n\n if r.next_visit < now() + 2 hours {\n notify owner \"Short-notice cleaning for {r.name} at {r.next_visit}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, your cleaning with the office is confirmed for {r.next_visit}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Chairs { title: \"{r.name}\", at: r.next_visit, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00152", "domain": "dental", "pattern": "confirm_new", "batch": false, "sop": "When a new cleaning is added to Patients: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (i want to approve each message first), put it on the Chairs calendar for 60 minutes, and mark it confirmed. Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, balance)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 07:30 and 19:00\n allow calendar Chairs\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\ncalendar Chairs \"Chairs\"", "program": "procedure DentalConfirmNewCleaning {\n about \"Confirm a new cleaning and add it to the calendar\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n calendar Chairs \"Chairs\"\n trigger when new row r in Patients\n\n if r.next_visit < now() + 12 hours {\n notify owner \"Short-notice cleaning for {r.name} at {r.next_visit}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.mobile: \"Hi {r.name}, your cleaning with the office is confirmed for {r.next_visit}.\"\n let ok = request approval of m from owner timeout 1 day else stop \"confirmation not approved\"\n send ok\n let ev = book Chairs { title: \"{r.name}\", at: r.next_visit, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00153", "domain": "dental", "pattern": "confirm_new", "batch": false, "sop": "When a new cleaning is added to Patients: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Chairs calendar for 90 minutes, and mark it confirmed. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, balance, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow calendar Chairs\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\ncalendar Chairs \"Chairs\"", "program": "procedure DentalConfirmNewCleaning {\n about \"Confirm a new cleaning and add it to the calendar\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n calendar Chairs \"Chairs\"\n trigger when new row r in Patients\n\n if r.next_visit < now() + 2 hours {\n notify owner \"Short-notice cleaning for {r.name} at {r.next_visit}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, your cleaning with the office is confirmed for {r.next_visit}.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Chairs { title: \"{r.name}\", at: r.next_visit, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00154", "domain": "dental", "pattern": "confirm_new", "batch": false, "sop": "When a new cleaning is added to Patients: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (i want to approve each message first), put it on the Chairs calendar for 30 minutes, and mark it confirmed. Don't mention the medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, balance)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow calendar Chairs\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\ncalendar Chairs \"Chairs\"", "program": "procedure DentalConfirmNewCleaning {\n about \"Confirm a new cleaning and add it to the calendar\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n calendar Chairs \"Chairs\"\n trigger when new row r in Patients\n\n if r.next_visit < now() + 24 hours {\n notify owner \"Short-notice cleaning for {r.name} at {r.next_visit}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, your cleaning with the office is confirmed for {r.next_visit}.\"\n let ok = request approval of m from owner timeout 1 day else stop \"confirmation not approved\"\n send ok\n let ev = book Chairs { title: \"{r.name}\", at: r.next_visit, length: 30 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00155", "domain": "dental", "pattern": "confirm_new", "batch": false, "sop": "When a new cleaning is added to Patients: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Chairs calendar for 60 minutes, and mark it confirmed. Don't mention the medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, balance, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow calendar Chairs\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\ncalendar Chairs \"Chairs\"", "program": "procedure DentalConfirmNewCleaning {\n about \"Confirm a new cleaning and add it to the calendar\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n calendar Chairs \"Chairs\"\n trigger when new row r in Patients\n\n if r.next_visit < now() + 12 hours {\n notify owner \"Short-notice cleaning for {r.name} at {r.next_visit}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, your cleaning with the office is confirmed for {r.next_visit}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Chairs { title: \"{r.name}\", at: r.next_visit, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00156", "domain": "dental", "pattern": "confirm_new", "batch": false, "sop": "When a new cleaning is added to Patients: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (i need to ok every message), put it on the Chairs calendar for 30 minutes, and mark it confirmed. Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, balance)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow calendar Chairs\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\ncalendar Chairs \"Chairs\"", "program": "procedure DentalConfirmNewCleaning {\n about \"Confirm a new cleaning and add it to the calendar\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n calendar Chairs \"Chairs\"\n trigger when new row r in Patients\n\n if r.next_visit < now() + 2 hours {\n notify owner \"Short-notice cleaning for {r.name} at {r.next_visit}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, your cleaning with the office is confirmed for {r.next_visit}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Chairs { title: \"{r.name}\", at: r.next_visit, length: 30 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00157", "domain": "dental", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Patients, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger when new row r in Patients\n\n let first = draft sms to r.mobile: \"Hi {r.name default 'there'}, thanks for choosing the office! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Patients\n let now_r = find all where mobile == r.mobile else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.mobile: \"Hi {now_r.name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00158", "domain": "dental", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Patients, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, status, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger when new row r in Patients\n\n let first = draft sms to r.mobile: \"Hi {r.name default 'there'}, thanks for choosing the office! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Patients\n let now_r = find all where mobile == r.mobile else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.mobile: \"Hi {now_r.name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00159", "domain": "dental", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Patients, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Keep the medical history out of the message.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, status, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger when new row r in Patients\n\n let first = draft sms to r.mobile: \"Hi {r.name default 'there'}, thanks for choosing the office! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Patients\n let now_r = find all where mobile == r.mobile else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.mobile: \"Hi {now_r.name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00160", "domain": "dental", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Patients, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, status, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger when new row r in Patients\n\n let first = draft sms to r.mobile: \"Hi {r.name default 'there'}, thanks for choosing the office! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Patients\n let now_r = find all where mobile == r.mobile else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.mobile: \"Hi {now_r.name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00161", "domain": "dental", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Patients, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, status, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger when new row r in Patients\n\n let first = draft sms to r.mobile: \"Hi {r.name}, thanks for choosing the office! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Patients\n let now_r = find all where mobile == r.mobile else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.mobile: \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00162", "domain": "dental", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Patients, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger when new row r in Patients\n\n let first = draft sms to r.mobile: \"Hi {r.name default 'there'}, thanks for choosing the office! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Patients\n let now_r = find all where mobile == r.mobile else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.mobile: \"Hi {now_r.name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00163", "domain": "dental", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Patients, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger when new row r in Patients\n\n let first = draft sms to r.mobile: \"Hi {r.name default 'there'}, thanks for choosing the office! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Patients\n let now_r = find all where mobile == r.mobile else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.mobile: \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00164", "domain": "dental", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Don't mention the medical history. No more than 50.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, come back to the office! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00165", "domain": "dental", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Never include their medical history. No more than 50.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.mobile: \"Hi {r.name}, come back to the office! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00166", "domain": "dental", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Never include their medical history. No more than 50.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, come back to the office! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00167", "domain": "dental", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Don't mention the medical history. No more than 50.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, come back to the office! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00168", "domain": "dental", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Never include their medical history. No more than 100.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.mobile: \"Hi {r.name}, come back to the office! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00169", "domain": "dental", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Never include their medical history. No more than 50.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, come back to the office! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00170", "domain": "dental", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Keep the medical history out of the message. No more than 50.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.mobile: \"Hi {r.name}, come back to the office! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00171", "domain": "dental", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Don't mention the medical history. No more than 50.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, come back to the office! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00172", "domain": "dental", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Never include their medical history. No more than 50.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.mobile: \"Hi {r.name default 'there'}, come back to the office! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00173", "domain": "dental", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Don't mention the medical history. No more than 50.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.mobile: \"Hi {r.name}, come back to the office! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00174", "domain": "dental", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Never include their medical history. No more than 100.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.mobile: \"Hi {r.name default 'there'}, come back to the office! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00175", "domain": "dental", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Keep the medical history out of the message. No more than 50.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.mobile: \"Hi {r.name default 'there'}, come back to the office! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00176", "domain": "dental", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Never include their medical history. No more than 50.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.mobile: \"Hi {r.name}, come back to the office! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00177", "domain": "dental", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Don't mention the medical history. No more than 100.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.mobile: \"Hi {r.name default 'there'}, come back to the office! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00178", "domain": "dental", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose next visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Never include their medical history. No more than 100.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DentalOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Patients\n let targets = filter all where status == \"cancelled\" and days_between(next_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.mobile: \"Hi {r.name}, come back to the office! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00179", "domain": "tutoring", "pattern": "reminder", "batch": false, "sop": "Daily at 8am, find every student in the Students sheet whose session is in three days and whose status is \"scheduled\". Send each one a email reminder. Nothing goes out until I've approved it. Never include their learning notes. At most 50 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 3 days and status == \"scheduled\"\n for each r in due up to 50 {\n let m = draft email to r.parent_email subject \"Your session in three days\": \"Hi {r.student default 'there'}, a reminder from the center: your session is in three days at {time_of(r.next_session)}.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00180", "domain": "tutoring", "pattern": "reminder", "batch": false, "sop": "On Fridays at 4pm, find every student in the Students sheet whose session is tomorrow and whose status is \"scheduled\". Send each one a email reminder. Let me check the messages before they go out. Don't mention the learning notes. At most 30 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every friday at 16:00\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 1 day and status == \"scheduled\"\n for each r in due up to 30 {\n let m = draft email to r.parent_email subject \"Your session tomorrow\": \"Hi {r.student}, a reminder from the center: your session is tomorrow at {time_of(r.next_session)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00181", "domain": "tutoring", "pattern": "reminder", "batch": false, "sop": "On Fridays at 8:30am, find every student in the Students sheet whose session is in three days and whose status is \"scheduled\". Send each one a email reminder. Show me the messages for approval first. Never include their learning notes. At most 50 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every friday at 08:30\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 3 days and status == \"scheduled\"\n for each r in due up to 50 {\n let m = draft email to r.parent_email subject \"Your session in three days\": \"Hi {r.student default 'there'}, a reminder from the center: your session is in three days at {time_of(r.next_session)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00182", "domain": "tutoring", "pattern": "reminder", "batch": false, "sop": "Daily at 10am, find every student in the Students sheet whose session is tomorrow and whose status is \"scheduled\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them reminded. Keep the learning notes out of the message. At most 100 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 1 day and status == \"scheduled\"\n for each r in due up to 100 {\n let m = draft email to r.parent_email subject \"Your session tomorrow\": \"Hi {r.student}, a reminder from the center: your session is tomorrow at {time_of(r.next_session)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00183", "domain": "tutoring", "pattern": "reminder", "batch": false, "sop": "Each Monday at 9am, find every student in the Students sheet whose session is tomorrow and whose status is \"scheduled\". Send each one a email reminder. Let me check the messages before they go out. Then mark them notified. Keep the learning notes out of the message. At most 100 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every monday at 09:00\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 1 day and status == \"scheduled\"\n for each r in due up to 100 {\n let m = draft email to r.parent_email subject \"Your session tomorrow\": \"Hi {r.student}, a reminder from the center: your session is tomorrow at {time_of(r.next_session)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00184", "domain": "tutoring", "pattern": "reminder", "batch": false, "sop": "Each Wednesday at 6pm, find every student in the Students sheet whose session is tomorrow and whose status is \"scheduled\". Send each one a email reminder. I want to approve each message first. Never include their learning notes. At most 20 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every wednesday at 18:00\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 1 day and status == \"scheduled\"\n for each r in due up to 20 {\n let m = draft email to r.parent_email subject \"Your session tomorrow\": \"Hi {r.student}, a reminder from the center: your session is tomorrow at {time_of(r.next_session)}.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00185", "domain": "tutoring", "pattern": "reminder", "batch": false, "sop": "On Mondays at 9am, find every student in the Students sheet whose session is in a week and whose status is \"scheduled\". Send each one a email reminder. I want to approve each message first. Keep the learning notes out of the message. At most 20 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every monday at 09:00\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 7 days and status == \"scheduled\"\n for each r in due up to 20 {\n let m = draft email to r.parent_email subject \"Your session in a week\": \"Hi {r.student}, a reminder from the center: your session is in a week at {time_of(r.next_session)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00186", "domain": "tutoring", "pattern": "reminder", "batch": true, "sop": "Every day at 5:30pm, find every student in the Students sheet whose session is in three days and whose status is \"scheduled\". Send each one a email reminder. Show me the messages for approval first. Then mark them reminded. Keep the learning notes out of the message. At most 30 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 3 days and status == \"scheduled\"\n let msgs = draft each r in due up to 30 email to r.parent_email subject \"Your session in three days\": \"Hi {r.student}, a reminder from the center: your session is in three days at {time_of(r.next_session)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00187", "domain": "tutoring", "pattern": "reminder", "batch": true, "sop": "Each Monday at 9am, find every student in the Students sheet whose session is tomorrow and whose status is \"scheduled\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Keep the learning notes out of the message. At most 30 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every monday at 09:00\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 1 day and status == \"scheduled\"\n let msgs = draft each r in due up to 30 email to r.parent_email subject \"Your session tomorrow\": \"Hi {r.student}, a reminder from the center: your session is tomorrow at {time_of(r.next_session)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00188", "domain": "tutoring", "pattern": "reminder", "batch": true, "sop": "On Mondays at 9am, find every student in the Students sheet whose session is in two days and whose status is \"scheduled\". Send each one a email reminder. Nothing goes out until I've approved it. Never include their learning notes. At most 30 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every monday at 09:00\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 2 days and status == \"scheduled\"\n let msgs = draft each r in due up to 30 email to r.parent_email subject \"Your session in two days\": \"Hi {r.student}, a reminder from the center: your session is in two days at {time_of(r.next_session)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00189", "domain": "tutoring", "pattern": "reminder", "batch": true, "sop": "Each day at 6pm, find every student in the Students sheet whose session is in two days and whose status is \"scheduled\". Send each one a email reminder. Let me check the messages before they go out. Then mark them reminded. Never include their learning notes. At most 100 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 2 days and status == \"scheduled\"\n let msgs = draft each r in due up to 100 email to r.parent_email subject \"Your session in two days\": \"Hi {r.student default 'there'}, a reminder from the center: your session is in two days at {time_of(r.next_session)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00190", "domain": "tutoring", "pattern": "reminder", "batch": true, "sop": "Every day at 8:30am, find every student in the Students sheet whose session is in three days and whose status is \"scheduled\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them reminded. Keep the learning notes out of the message. At most 50 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 50 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 3 days and status == \"scheduled\"\n let msgs = draft each r in due up to 50 email to r.parent_email subject \"Your session in three days\": \"Hi {r.student default 'there'}, a reminder from the center: your session is in three days at {time_of(r.next_session)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00191", "domain": "tutoring", "pattern": "reminder", "batch": true, "sop": "Daily at 4pm, find every student in the Students sheet whose session is in three days and whose status is \"scheduled\". Send each one a email reminder. Let me check the messages before they go out. Then mark them notified. Keep the learning notes out of the message. At most 100 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 100 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 3 days and status == \"scheduled\"\n let msgs = draft each r in due up to 100 email to r.parent_email subject \"Your session in three days\": \"Hi {r.student default 'there'}, a reminder from the center: your session is in three days at {time_of(r.next_session)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00192", "domain": "tutoring", "pattern": "reminder", "batch": true, "sop": "Daily at 5:30pm, find every student in the Students sheet whose session is tomorrow and whose status is \"scheduled\". Send each one a email reminder. Let me check the messages before they go out. Then mark them reminded. Don't mention the learning notes. At most 100 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 1 day and status == \"scheduled\"\n let msgs = draft each r in due up to 100 email to r.parent_email subject \"Your session tomorrow\": \"Hi {r.student default 'there'}, a reminder from the center: your session is tomorrow at {time_of(r.next_session)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00193", "domain": "tutoring", "pattern": "reminder", "batch": true, "sop": "Every day at 5:30pm, find every student in the Students sheet whose session is in two days and whose status is \"scheduled\". Send each one a email reminder. I need to OK every message. Keep the learning notes out of the message. At most 100 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 2 days and status == \"scheduled\"\n let msgs = draft each r in due up to 100 email to r.parent_email subject \"Your session in two days\": \"Hi {r.student}, a reminder from the center: your session is in two days at {time_of(r.next_session)}.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00194", "domain": "tutoring", "pattern": "followup", "batch": false, "sop": "Every Tuesday at 6pm, look for students marked \"missed\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 2 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00195", "domain": "tutoring", "pattern": "followup", "batch": false, "sop": "Every Tuesday at 4pm, look for students marked \"missed\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Don't mention the learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every tuesday at 16:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 3 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00196", "domain": "tutoring", "pattern": "followup", "batch": false, "sop": "On Tuesdays at 6pm, look for students marked \"missed\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Never include their learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 2 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00197", "domain": "tutoring", "pattern": "followup", "batch": false, "sop": "On Fridays at 9am, look for students marked \"missed\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Never include their learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every friday at 09:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 2 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00198", "domain": "tutoring", "pattern": "followup", "batch": false, "sop": "Each morning at 9am, look for students marked \"missed\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 1 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00199", "domain": "tutoring", "pattern": "followup", "batch": false, "sop": "Every Friday at 4pm, look for students marked \"missed\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every friday at 16:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 1 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00200", "domain": "tutoring", "pattern": "followup", "batch": true, "sop": "Every day at 5:30pm, look for students marked \"missed\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Never include their learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 3 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00201", "domain": "tutoring", "pattern": "followup", "batch": true, "sop": "Every Tuesday at 8am, look for students marked \"missed\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every tuesday at 08:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 3 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00202", "domain": "tutoring", "pattern": "followup", "batch": true, "sop": "Every day at 6pm, look for students marked \"missed\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 2 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00203", "domain": "tutoring", "pattern": "followup", "batch": true, "sop": "Every day at 5:30pm, look for students marked \"missed\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 3 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00204", "domain": "tutoring", "pattern": "followup", "batch": true, "sop": "Daily at 9am, look for students marked \"missed\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 3 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00205", "domain": "tutoring", "pattern": "followup", "batch": true, "sop": "On Mondays at 9am, look for students marked \"missed\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every monday at 09:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 2 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00206", "domain": "tutoring", "pattern": "followup", "batch": true, "sop": "Daily at 6pm, look for students marked \"missed\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 7 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00207", "domain": "tutoring", "pattern": "followup", "batch": true, "sop": "Every day at 6pm, look for students marked \"missed\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 2 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00208", "domain": "tutoring", "pattern": "lapsed", "batch": false, "sop": "On Wednesdays at 8am, find students whose next session was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every wednesday at 08:00\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by next_session first 20\n for each r in oldest up to 20 {\n let m = draft email to r.parent_email subject \"We miss you\": \"Hi {r.student}, it's been a while! We'd love to see you again at the center.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00209", "domain": "tutoring", "pattern": "lapsed", "batch": false, "sop": "Each day at 6pm, find students whose next session was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by next_session first 10\n for each r in oldest up to 10 {\n let m = draft email to r.parent_email subject \"We miss you\": \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the center.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00210", "domain": "tutoring", "pattern": "lapsed", "batch": false, "sop": "Every day at 8:30am, find students whose next session was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by next_session first 15\n for each r in oldest up to 15 {\n let m = draft email to r.parent_email subject \"We miss you\": \"Hi {r.student}, it's been a while! We'd love to see you again at the center.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00211", "domain": "tutoring", "pattern": "lapsed", "batch": false, "sop": "On Fridays at 8:30am, find students whose next session was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every friday at 08:30\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by next_session first 20\n for each r in oldest up to 20 {\n let m = draft email to r.parent_email subject \"We miss you\": \"Hi {r.student}, it's been a while! We'd love to see you again at the center.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00212", "domain": "tutoring", "pattern": "lapsed", "batch": false, "sop": "Every Thursday at 5:30pm, find students whose next session was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Never include their learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by next_session first 20\n for each r in oldest up to 20 {\n let m = draft email to r.parent_email subject \"We miss you\": \"Hi {r.student}, it's been a while! We'd love to see you again at the center.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00213", "domain": "tutoring", "pattern": "lapsed", "batch": false, "sop": "Daily at 9am, find students whose next session was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by next_session first 15\n for each r in oldest up to 15 {\n let m = draft email to r.parent_email subject \"We miss you\": \"Hi {r.student}, it's been a while! We'd love to see you again at the center.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00214", "domain": "tutoring", "pattern": "lapsed", "batch": false, "sop": "Each Thursday at 11am, find students whose next session was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Never include their learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by next_session first 10\n for each r in oldest up to 10 {\n let m = draft email to r.parent_email subject \"We miss you\": \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the center.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00215", "domain": "tutoring", "pattern": "lapsed", "batch": false, "sop": "On Thursdays at 8:30am, find students whose next session was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by next_session first 20\n for each r in oldest up to 20 {\n let m = draft email to r.parent_email subject \"We miss you\": \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the center.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00216", "domain": "tutoring", "pattern": "lapsed", "batch": true, "sop": "Every Monday at 10am, find students whose next session was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Don't mention the learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every monday at 10:00\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by next_session first 15\n let msgs = draft each r in oldest up to 15 email to r.parent_email subject \"We miss you\": \"Hi {r.student}, it's been a while! We'd love to see you again at the center.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00217", "domain": "tutoring", "pattern": "lapsed", "batch": true, "sop": "On Fridays at 11am, find students whose next session was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every friday at 11:00\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by next_session first 15\n let msgs = draft each r in oldest up to 15 email to r.parent_email subject \"We miss you\": \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the center.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00218", "domain": "tutoring", "pattern": "lapsed", "batch": true, "sop": "Every Tuesday at 11am, find students whose next session was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Don't mention the learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every tuesday at 11:00\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by next_session first 15\n let msgs = draft each r in oldest up to 15 email to r.parent_email subject \"We miss you\": \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the center.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00219", "domain": "tutoring", "pattern": "lapsed", "batch": true, "sop": "Daily at 9am, find students whose next session was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by next_session first 20\n let msgs = draft each r in oldest up to 20 email to r.parent_email subject \"We miss you\": \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the center.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00220", "domain": "tutoring", "pattern": "lapsed", "batch": true, "sop": "Every Tuesday at 10am, find students whose next session was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every tuesday at 10:00\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by next_session first 15\n let msgs = draft each r in oldest up to 15 email to r.parent_email subject \"We miss you\": \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the center.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00221", "domain": "tutoring", "pattern": "lapsed", "batch": true, "sop": "Each Tuesday at 11am, find students whose next session was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Don't mention the learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every tuesday at 11:00\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by next_session first 10\n let msgs = draft each r in oldest up to 10 email to r.parent_email subject \"We miss you\": \"Hi {r.student}, it's been a while! We'd love to see you again at the center.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00222", "domain": "tutoring", "pattern": "lapsed", "batch": true, "sop": "On Wednesdays at 10am, find students whose next session was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Never include their learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by next_session first 15\n let msgs = draft each r in oldest up to 15 email to r.parent_email subject \"We miss you\": \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the center.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00223", "domain": "tutoring", "pattern": "summary", "batch": false, "sop": "On Thursdays at 4pm, count the students in Students whose status is \"done\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy TutoringPolicy {\n allow read Students(status, balance, student, parent_email, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringDailySummary {\n about \"Tell the owner how many students are done\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every thursday at 16:00\n\n let all = fetch Students\n let these = filter all where status == \"done\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no done students\"\n }\n notify owner \"Done students: {n}, total balance: {total}\"\n}"} {"id": "train-00224", "domain": "tutoring", "pattern": "summary", "batch": false, "sop": "Every day at 8:30am, count the students in Students whose status is \"missed\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy TutoringPolicy {\n allow read Students(status, balance, student, parent_email)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringDailySummary {\n about \"Tell the owner how many students are missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Students\n let these = filter all where status == \"missed\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students: {n}, total balance: {total}\"\n}"} {"id": "train-00225", "domain": "tutoring", "pattern": "summary", "batch": false, "sop": "Every Thursday at 8:30am, count the students in Students whose status is \"missed\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy TutoringPolicy {\n allow read Students(status, balance, student, parent_email)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringDailySummary {\n about \"Tell the owner how many students are missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Students\n let these = filter all where status == \"missed\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students: {n}, total balance: {total}\"\n}"} {"id": "train-00226", "domain": "tutoring", "pattern": "summary", "batch": false, "sop": "Every day at 4pm, count the students in Students whose status is \"scheduled\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy TutoringPolicy {\n allow read Students(status, balance, student, parent_email, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringDailySummary {\n about \"Tell the owner how many students are scheduled\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Students\n let these = filter all where status == \"scheduled\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no scheduled students\"\n }\n notify owner \"Scheduled students: {n}, total balance: {total}\"\n}"} {"id": "train-00227", "domain": "tutoring", "pattern": "summary", "batch": false, "sop": "Daily at 4pm, count the students in Students whose status is \"missed\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy TutoringPolicy {\n allow read Students(status, balance, student, parent_email, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringDailySummary {\n about \"Tell the owner how many students are missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Students\n let these = filter all where status == \"missed\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students: {n}, total balance: {total}\"\n}"} {"id": "train-00228", "domain": "tutoring", "pattern": "summary", "batch": false, "sop": "Each morning at 8:30am, count the students in Students whose status is \"missed\", and send the numbers to me only. Don't message any students.", "policy": "policy TutoringPolicy {\n allow read Students(status, balance, student, parent_email, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringDailySummary {\n about \"Tell the owner how many students are missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Students\n let these = filter all where status == \"missed\"\n let n = summarize count of these\n notify owner \"Missed students today: {n}\"\n}"} {"id": "train-00229", "domain": "tutoring", "pattern": "summary", "batch": false, "sop": "Daily at 11am, count the students in Students whose status is \"scheduled\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy TutoringPolicy {\n allow read Students(status, balance, student, parent_email, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringDailySummary {\n about \"Tell the owner how many students are scheduled\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Students\n let these = filter all where status == \"scheduled\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no scheduled students\"\n }\n notify owner \"Scheduled students: {n}, total balance: {total}\"\n}"} {"id": "train-00230", "domain": "tutoring", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy TutoringRefundPolicy {\n allow read RefundRequests(request_id, student, parent_email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_email\n limit refund $40 per action\n limit refund $120 per day\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure TutoringRefunds {\n about \"Handle refund requests within limits\"\n policy TutoringRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.parent_email subject \"Your refund\": \"Hi {r.student default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00231", "domain": "tutoring", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy TutoringRefundPolicy {\n allow read RefundRequests(request_id, student, parent_email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_email\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure TutoringRefunds {\n about \"Handle refund requests within limits\"\n policy TutoringRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.parent_email subject \"Your refund\": \"Hi {r.student default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00232", "domain": "tutoring", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy TutoringRefundPolicy {\n allow read RefundRequests(request_id, student, parent_email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_email\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $20\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure TutoringRefunds {\n about \"Handle refund requests within limits\"\n policy TutoringRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.parent_email subject \"Your refund\": \"Hi {r.student default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00233", "domain": "tutoring", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy TutoringRefundPolicy {\n allow read RefundRequests(request_id, student, parent_email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_email\n limit refund $100 per action\n limit refund $500 per day\n refund without approval up to $15\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure TutoringRefunds {\n about \"Handle refund requests within limits\"\n policy TutoringRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.parent_email subject \"Your refund\": \"Hi {r.student}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00234", "domain": "tutoring", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $75, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy TutoringRefundPolicy {\n allow read RefundRequests(request_id, student, parent_email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_email\n limit refund $75 per action\n limit refund $375 per day\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure TutoringRefunds {\n about \"Handle refund requests within limits\"\n policy TutoringRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.parent_email subject \"Your refund\": \"Hi {r.student default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00235", "domain": "tutoring", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy TutoringRefundPolicy {\n allow read RefundRequests(request_id, student, parent_email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_email\n limit refund $40 per action\n limit refund $240 per day\n refund without approval up to $20\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure TutoringRefunds {\n about \"Handle refund requests within limits\"\n policy TutoringRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.parent_email subject \"Your refund\": \"Hi {r.student}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00236", "domain": "tutoring", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy TutoringRefundPolicy {\n allow read RefundRequests(request_id, student, parent_email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_email\n limit refund $75 per action\n limit refund $375 per day\n refund without approval up to $10\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure TutoringRefunds {\n about \"Handle refund requests within limits\"\n policy TutoringRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.parent_email subject \"Your refund\": \"Hi {r.student default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00237", "domain": "tutoring", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy TutoringRefundPolicy {\n allow read RefundRequests(request_id, student, parent_email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_email\n limit refund $50 per action\n limit refund $250 per day\n refund without approval up to $10\n limit sends 30 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure TutoringRefunds {\n about \"Handle refund requests within limits\"\n policy TutoringRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.parent_email subject \"Your refund\": \"Hi {r.student}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00238", "domain": "tutoring", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Students, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Don't mention the learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger when new row r in Students\n\n let first = draft email to r.parent_email subject \"Welcome\": \"Hi {r.student}, thanks for choosing the center! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Students\n let now_r = find all where parent_email == r.parent_email else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.parent_email subject \"Checking in\": \"Hi {now_r.student default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00239", "domain": "tutoring", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Students, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Don't mention the learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger when new row r in Students\n\n let first = draft email to r.parent_email subject \"Welcome\": \"Hi {r.student default 'there'}, thanks for choosing the center! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Students\n let now_r = find all where parent_email == r.parent_email else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.parent_email subject \"Checking in\": \"Hi {now_r.student default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00240", "domain": "tutoring", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Students, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger when new row r in Students\n\n let first = draft email to r.parent_email subject \"Welcome\": \"Hi {r.student}, thanks for choosing the center! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Students\n let now_r = find all where parent_email == r.parent_email else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.parent_email subject \"Checking in\": \"Hi {now_r.student}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00241", "domain": "tutoring", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Students, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, status)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger when new row r in Students\n\n let first = draft email to r.parent_email subject \"Welcome\": \"Hi {r.student default 'there'}, thanks for choosing the center! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Students\n let now_r = find all where parent_email == r.parent_email else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.parent_email subject \"Checking in\": \"Hi {now_r.student default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00242", "domain": "tutoring", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Students, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Never include their learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger when new row r in Students\n\n let first = draft email to r.parent_email subject \"Welcome\": \"Hi {r.student default 'there'}, thanks for choosing the center! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Students\n let now_r = find all where parent_email == r.parent_email else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.parent_email subject \"Checking in\": \"Hi {now_r.student}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00243", "domain": "tutoring", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Students, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger when new row r in Students\n\n let first = draft email to r.parent_email subject \"Welcome\": \"Hi {r.student}, thanks for choosing the center! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Students\n let now_r = find all where parent_email == r.parent_email else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.parent_email subject \"Checking in\": \"Hi {now_r.student default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00244", "domain": "tutoring", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Students, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, status)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger when new row r in Students\n\n let first = draft email to r.parent_email subject \"Welcome\": \"Hi {r.student default 'there'}, thanks for choosing the center! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Students\n let now_r = find all where parent_email == r.parent_email else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.parent_email subject \"Checking in\": \"Hi {now_r.student default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00245", "domain": "tutoring", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Students, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger when new row r in Students\n\n let first = draft email to r.parent_email subject \"Welcome\": \"Hi {r.student}, thanks for choosing the center! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Students\n let now_r = find all where parent_email == r.parent_email else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.parent_email subject \"Checking in\": \"Hi {now_r.student default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00246", "domain": "tutoring", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Never include their learning notes. No more than 50.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student}, come back to the center! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00247", "domain": "tutoring", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Don't mention the learning notes. No more than 100.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student}, come back to the center! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00248", "domain": "tutoring", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Never include their learning notes. No more than 50.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student}, come back to the center! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00249", "domain": "tutoring", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Keep the learning notes out of the message. No more than 100.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student default 'there'}, come back to the center! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00250", "domain": "tutoring", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Never include their learning notes. No more than 50.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student}, come back to the center! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00251", "domain": "tutoring", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Keep the learning notes out of the message. No more than 100.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student default 'there'}, come back to the center! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00252", "domain": "tutoring", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the learning notes out of the message. No more than 50.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student}, come back to the center! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00253", "domain": "tutoring", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Don't mention the learning notes. No more than 100.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student}, come back to the center! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00254", "domain": "tutoring", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Keep the learning notes out of the message. No more than 100.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student default 'there'}, come back to the center! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00255", "domain": "tutoring", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Never include their learning notes. No more than 50.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student default 'there'}, come back to the center! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00256", "domain": "tutoring", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Keep the learning notes out of the message. No more than 50.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student default 'there'}, come back to the center! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00257", "domain": "tutoring", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Keep the learning notes out of the message. No more than 100.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student}, come back to the center! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00258", "domain": "tutoring", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Don't mention the learning notes. No more than 100.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student}, come back to the center! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00259", "domain": "tutoring", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Never include their learning notes. No more than 100.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student}, come back to the center! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00260", "domain": "restaurant", "pattern": "reminder", "batch": false, "sop": "Each morning at 8am, find every guest in the Bookings sheet whose reservation is in a week and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Then mark them reminded. Keep the allergy notes out of the message. At most 20 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 08:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 7 days and status == \"booked\"\n for each r in due up to 20 {\n let m = draft sms to r.phone: \"Hi {r.guest}, a reminder from the restaurant: your reservation is in a week at {time_of(r.at)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00261", "domain": "restaurant", "pattern": "reminder", "batch": false, "sop": "Each Thursday at 10am, find every guest in the Bookings sheet whose reservation is tomorrow and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Keep the allergy notes out of the message. At most 100 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 1 day and status == \"booked\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.guest}, a reminder from the restaurant: your reservation is tomorrow at {time_of(r.at)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00262", "domain": "restaurant", "pattern": "reminder", "batch": false, "sop": "Every Wednesday at 10am, find every guest in the Bookings sheet whose reservation is in three days and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Don't mention the allergy notes. At most 100 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 3 days and status == \"booked\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.guest}, a reminder from the restaurant: your reservation is in three days at {time_of(r.at)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00263", "domain": "restaurant", "pattern": "reminder", "batch": false, "sop": "Each day at 5:30pm, find every guest in the Bookings sheet whose reservation is in two days and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Then mark them notified. Keep the allergy notes out of the message. At most 100 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 17:30\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 2 days and status == \"booked\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.guest}, a reminder from the restaurant: your reservation is in two days at {time_of(r.at)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00264", "domain": "restaurant", "pattern": "reminder", "batch": false, "sop": "On Thursdays at 10am, find every guest in the Bookings sheet whose reservation is tomorrow and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Never include their allergy notes. At most 100 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 1 day and status == \"booked\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.guest}, a reminder from the restaurant: your reservation is tomorrow at {time_of(r.at)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00265", "domain": "restaurant", "pattern": "reminder", "batch": false, "sop": "On Fridays at 4pm, find every guest in the Bookings sheet whose reservation is in three days and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Then mark them notified. Don't mention the allergy notes. At most 100 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every friday at 16:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 3 days and status == \"booked\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.guest}, a reminder from the restaurant: your reservation is in three days at {time_of(r.at)}.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00266", "domain": "restaurant", "pattern": "reminder", "batch": false, "sop": "Every day at 10am, find every guest in the Bookings sheet whose reservation is tomorrow and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Don't mention the allergy notes. At most 50 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 10:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 1 day and status == \"booked\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, a reminder from the restaurant: your reservation is tomorrow at {time_of(r.at)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00267", "domain": "restaurant", "pattern": "reminder", "batch": true, "sop": "Every day at 10am, find every guest in the Bookings sheet whose reservation is in two days and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Don't mention the allergy notes. At most 100 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 10:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 2 days and status == \"booked\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.guest default 'there'}, a reminder from the restaurant: your reservation is in two days at {time_of(r.at)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00268", "domain": "restaurant", "pattern": "reminder", "batch": true, "sop": "Each morning at 11am, find every guest in the Bookings sheet whose reservation is tomorrow and whose status is \"booked\". Send each one a text reminder. Nothing goes out until I've approved it. Never include their allergy notes. At most 20 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 11:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.guest}, a reminder from the restaurant: your reservation is tomorrow at {time_of(r.at)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00269", "domain": "restaurant", "pattern": "reminder", "batch": true, "sop": "Each morning at 11am, find every guest in the Bookings sheet whose reservation is tomorrow and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Then mark them notified. Keep the allergy notes out of the message. At most 100 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 11:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.guest default 'there'}, a reminder from the restaurant: your reservation is tomorrow at {time_of(r.at)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00270", "domain": "restaurant", "pattern": "reminder", "batch": true, "sop": "Each Monday at 9am, find every guest in the Bookings sheet whose reservation is in a week and whose status is \"booked\". Send each one a text reminder. Nothing goes out until I've approved it. Then mark them notified. Don't mention the allergy notes. At most 100 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 100 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every monday at 09:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 7 days and status == \"booked\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.guest default 'there'}, a reminder from the restaurant: your reservation is in a week at {time_of(r.at)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00271", "domain": "restaurant", "pattern": "reminder", "batch": true, "sop": "Every Tuesday at 11am, find every guest in the Bookings sheet whose reservation is tomorrow and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Then mark them reminded. Don't mention the allergy notes. At most 30 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every tuesday at 11:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.guest default 'there'}, a reminder from the restaurant: your reservation is tomorrow at {time_of(r.at)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00272", "domain": "restaurant", "pattern": "reminder", "batch": true, "sop": "Every Monday at 8am, find every guest in the Bookings sheet whose reservation is in three days and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Keep the allergy notes out of the message. At most 30 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every monday at 08:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 3 days and status == \"booked\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.guest default 'there'}, a reminder from the restaurant: your reservation is in three days at {time_of(r.at)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00273", "domain": "restaurant", "pattern": "followup", "batch": false, "sop": "On Wednesdays at 6pm, look for guests marked \"no-show\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every wednesday at 18:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 3 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.guest}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00274", "domain": "restaurant", "pattern": "followup", "batch": false, "sop": "Each Thursday at 4pm, look for guests marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every thursday at 16:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 1 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00275", "domain": "restaurant", "pattern": "followup", "batch": false, "sop": "Every day at 10am, look for guests marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 10:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 2 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00276", "domain": "restaurant", "pattern": "followup", "batch": false, "sop": "Daily at 4pm, look for guests marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 16:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 2 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.guest}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00277", "domain": "restaurant", "pattern": "followup", "batch": false, "sop": "Each morning at 8:30am, look for guests marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 08:30\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 2 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00278", "domain": "restaurant", "pattern": "followup", "batch": false, "sop": "Each Tuesday at 6pm, look for guests marked \"no-show\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 3 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00279", "domain": "restaurant", "pattern": "followup", "batch": false, "sop": "Daily at 10am, look for guests marked \"no-show\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 10:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 7 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00280", "domain": "restaurant", "pattern": "followup", "batch": true, "sop": "Every Monday at 11am, look for guests marked \"no-show\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every monday at 11:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 3 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.guest}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00281", "domain": "restaurant", "pattern": "followup", "batch": true, "sop": "Daily at 8:30am, look for guests marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 08:30\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 1 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.guest default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00282", "domain": "restaurant", "pattern": "followup", "batch": true, "sop": "Daily at 4pm, look for guests marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 16:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 1 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.guest default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00283", "domain": "restaurant", "pattern": "followup", "batch": true, "sop": "Every Friday at 5:30pm, look for guests marked \"no-show\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every friday at 17:30\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 7 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.guest default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00284", "domain": "restaurant", "pattern": "followup", "batch": true, "sop": "Every day at 6pm, look for guests marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 18:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 2 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.guest default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00285", "domain": "restaurant", "pattern": "lapsed", "batch": false, "sop": "Each morning at 8am, find guests whose at was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 08:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by at first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00286", "domain": "restaurant", "pattern": "lapsed", "batch": false, "sop": "Each morning at 9am, find guests whose at was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 09:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by at first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.guest}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00287", "domain": "restaurant", "pattern": "lapsed", "batch": false, "sop": "On Thursdays at 9am, find guests whose at was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every thursday at 09:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by at first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.guest}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00288", "domain": "restaurant", "pattern": "lapsed", "batch": false, "sop": "On Mondays at 10am, find guests whose at was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every monday at 10:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by at first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00289", "domain": "restaurant", "pattern": "lapsed", "batch": false, "sop": "Each Monday at 6pm, find guests whose at was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every monday at 18:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by at first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00290", "domain": "restaurant", "pattern": "lapsed", "batch": false, "sop": "On Mondays at 10am, find guests whose at was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every monday at 10:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by at first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.guest}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00291", "domain": "restaurant", "pattern": "lapsed", "batch": false, "sop": "Every Monday at 5:30pm, find guests whose at was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every monday at 17:30\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by at first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00292", "domain": "restaurant", "pattern": "lapsed", "batch": false, "sop": "Each Friday at 9am, find guests whose at was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Show me the messages for approval first. Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every friday at 09:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by at first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00293", "domain": "restaurant", "pattern": "lapsed", "batch": true, "sop": "Every day at 10am, find guests whose at was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 10:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by at first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.guest}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00294", "domain": "restaurant", "pattern": "lapsed", "batch": true, "sop": "Daily at 11am, find guests whose at was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 11:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by at first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.guest default 'there'}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00295", "domain": "restaurant", "pattern": "lapsed", "batch": true, "sop": "Each morning at 9am, find guests whose at was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 09:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by at first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.guest default 'there'}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00296", "domain": "restaurant", "pattern": "lapsed", "batch": true, "sop": "Daily at 6pm, find guests whose at was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 18:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by at first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.guest default 'there'}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00297", "domain": "restaurant", "pattern": "lapsed", "batch": true, "sop": "Every day at 8am, find guests whose at was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 08:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by at first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.guest default 'there'}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00298", "domain": "restaurant", "pattern": "lapsed", "batch": true, "sop": "On Mondays at 10am, find guests whose at was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every monday at 10:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by at first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.guest default 'there'}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00299", "domain": "restaurant", "pattern": "lapsed", "batch": true, "sop": "Each morning at 11am, find guests whose at was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 11:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by at first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.guest default 'there'}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00300", "domain": "restaurant", "pattern": "summary", "batch": false, "sop": "Each Friday at 8am, count the guests in Bookings whose status is \"booked\" and the total deposit, and send the numbers to me only. Don't message any guests. If there are none, don't bother me.", "policy": "policy RestaurantPolicy {\n allow read Bookings(status, deposit, guest, phone, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantDailySummary {\n about \"Tell the owner how many guests are booked\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every friday at 08:00\n\n let all = fetch Bookings\n let these = filter all where status == \"booked\"\n let n = summarize count of these\n let total = summarize sum deposit of these\n if n == 0 {\n stop \"no booked guests\"\n }\n notify owner \"Booked guests: {n}, total deposit: {total}\"\n}"} {"id": "train-00301", "domain": "restaurant", "pattern": "summary", "batch": false, "sop": "On Fridays at 9am, count the guests in Bookings whose status is \"seated\" and the total deposit, and send the numbers to me only. Don't message any guests. If there are none, don't bother me.", "policy": "policy RestaurantPolicy {\n allow read Bookings(status, deposit, guest, phone, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantDailySummary {\n about \"Tell the owner how many guests are seated\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every friday at 09:00\n\n let all = fetch Bookings\n let these = filter all where status == \"seated\"\n let n = summarize count of these\n let total = summarize sum deposit of these\n if n == 0 {\n stop \"no seated guests\"\n }\n notify owner \"Seated guests: {n}, total deposit: {total}\"\n}"} {"id": "train-00302", "domain": "restaurant", "pattern": "summary", "batch": false, "sop": "Daily at 6pm, count the guests in Bookings whose status is \"no-show\", and send the numbers to me only. Don't message any guests.", "policy": "policy RestaurantPolicy {\n allow read Bookings(status, deposit, guest, phone, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantDailySummary {\n about \"Tell the owner how many guests are no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 18:00\n\n let all = fetch Bookings\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n notify owner \"No-show guests today: {n}\"\n}"} {"id": "train-00303", "domain": "restaurant", "pattern": "summary", "batch": false, "sop": "Each morning at 10am, count the guests in Bookings whose status is \"no-show\" and the total deposit, and send the numbers to me only. Don't message any guests. If there are none, don't bother me.", "policy": "policy RestaurantPolicy {\n allow read Bookings(status, deposit, guest, phone, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantDailySummary {\n about \"Tell the owner how many guests are no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 10:00\n\n let all = fetch Bookings\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n let total = summarize sum deposit of these\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests: {n}, total deposit: {total}\"\n}"} {"id": "train-00304", "domain": "restaurant", "pattern": "summary", "batch": false, "sop": "Daily at 11am, count the guests in Bookings whose status is \"booked\" and the total deposit, and send the numbers to me only. Don't message any guests. If there are none, don't bother me.", "policy": "policy RestaurantPolicy {\n allow read Bookings(status, deposit, guest, phone, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantDailySummary {\n about \"Tell the owner how many guests are booked\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 11:00\n\n let all = fetch Bookings\n let these = filter all where status == \"booked\"\n let n = summarize count of these\n let total = summarize sum deposit of these\n if n == 0 {\n stop \"no booked guests\"\n }\n notify owner \"Booked guests: {n}, total deposit: {total}\"\n}"} {"id": "train-00305", "domain": "restaurant", "pattern": "summary", "batch": false, "sop": "Each Tuesday at 10am, count the guests in Bookings whose status is \"seated\", and send the numbers to me only. Don't message any guests.", "policy": "policy RestaurantPolicy {\n allow read Bookings(status, deposit, guest, phone, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantDailySummary {\n about \"Tell the owner how many guests are seated\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every tuesday at 10:00\n\n let all = fetch Bookings\n let these = filter all where status == \"seated\"\n let n = summarize count of these\n notify owner \"Seated guests today: {n}\"\n}"} {"id": "train-00306", "domain": "restaurant", "pattern": "summary", "batch": false, "sop": "Every day at 5:30pm, count the guests in Bookings whose status is \"no-show\" and the total deposit, and send the numbers to me only. Don't message any guests. If there are none, don't bother me.", "policy": "policy RestaurantPolicy {\n allow read Bookings(status, deposit, guest, phone)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantDailySummary {\n about \"Tell the owner how many guests are no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 17:30\n\n let all = fetch Bookings\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n let total = summarize sum deposit of these\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests: {n}, total deposit: {total}\"\n}"} {"id": "train-00307", "domain": "restaurant", "pattern": "reorder", "batch": false, "sop": "On Fridays at 8:30am, check Pantry. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy RestaurantStockPolicy {\n allow read Pantry(item, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Pantry.supplier\n limit order $150 per action\n limit order $600 per day\n}", "sheets": "sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure RestaurantReorder {\n about \"Reorder ingredients below their minimum\"\n policy RestaurantStockPolicy\n sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every friday at 08:30\n\n let all = fetch Pantry\n let low = filter all where on_hand < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.item} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.item}\" from i.supplier cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.item}\"\n }\n}"} {"id": "train-00308", "domain": "restaurant", "pattern": "reorder", "batch": false, "sop": "Every Wednesday at 11am, check Pantry. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy RestaurantStockPolicy {\n allow read Pantry(item, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Pantry.supplier\n limit order $150 per action\n limit order $450 per day\n}", "sheets": "sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure RestaurantReorder {\n about \"Reorder ingredients below their minimum\"\n policy RestaurantStockPolicy\n sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every wednesday at 11:00\n\n let all = fetch Pantry\n let low = filter all where on_hand < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.item} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.item}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.item}\"\n }\n}"} {"id": "train-00309", "domain": "restaurant", "pattern": "reorder", "batch": false, "sop": "On Mondays at 10am, check Pantry. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $200 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy RestaurantStockPolicy {\n allow read Pantry(item, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Pantry.supplier\n limit order $200 per action\n limit order $600 per day\n}", "sheets": "sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure RestaurantReorder {\n about \"Reorder ingredients below their minimum\"\n policy RestaurantStockPolicy\n sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every monday at 10:00\n\n let all = fetch Pantry\n let low = filter all where on_hand < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $200.00 {\n notify owner \"Reorder of {i.item} would cost {cost}, over the $200 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.item}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.item}\"\n }\n}"} {"id": "train-00310", "domain": "restaurant", "pattern": "reorder", "batch": false, "sop": "Every day at 4pm, check Pantry. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $200 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy RestaurantStockPolicy {\n allow read Pantry(item, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Pantry.supplier\n limit order $200 per action\n limit order $1000 per day\n}", "sheets": "sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure RestaurantReorder {\n about \"Reorder ingredients below their minimum\"\n policy RestaurantStockPolicy\n sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 16:00\n\n let all = fetch Pantry\n let low = filter all where on_hand < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $200.00 {\n notify owner \"Reorder of {i.item} would cost {cost}, over the $200 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.item}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.item}\"\n }\n}"} {"id": "train-00311", "domain": "restaurant", "pattern": "reorder", "batch": false, "sop": "Each morning at 8:30am, check Pantry. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy RestaurantStockPolicy {\n allow read Pantry(item, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Pantry.supplier\n limit order $250 per action\n limit order $1000 per day\n}", "sheets": "sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure RestaurantReorder {\n about \"Reorder ingredients below their minimum\"\n policy RestaurantStockPolicy\n sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 08:30\n\n let all = fetch Pantry\n let low = filter all where on_hand < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $250.00 {\n notify owner \"Reorder of {i.item} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.item}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.item}\"\n }\n}"} {"id": "train-00312", "domain": "restaurant", "pattern": "reorder", "batch": false, "sop": "Every Thursday at 11am, check Pantry. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy RestaurantStockPolicy {\n allow read Pantry(item, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Pantry.supplier\n limit order $250 per action\n limit order $1000 per day\n}", "sheets": "sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure RestaurantReorder {\n about \"Reorder ingredients below their minimum\"\n policy RestaurantStockPolicy\n sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every thursday at 11:00\n\n let all = fetch Pantry\n let low = filter all where on_hand < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $250.00 {\n notify owner \"Reorder of {i.item} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.item}\" from i.supplier cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.item}\"\n }\n}"} {"id": "train-00313", "domain": "restaurant", "pattern": "reorder", "batch": false, "sop": "Each Thursday at 8:30am, check Pantry. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy RestaurantStockPolicy {\n allow read Pantry(item, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Pantry.supplier\n limit order $100 per action\n limit order $500 per day\n}", "sheets": "sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure RestaurantReorder {\n about \"Reorder ingredients below their minimum\"\n policy RestaurantStockPolicy\n sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every thursday at 08:30\n\n let all = fetch Pantry\n let low = filter all where on_hand < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.item} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.item}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.item}\"\n }\n}"} {"id": "train-00314", "domain": "restaurant", "pattern": "reorder", "batch": false, "sop": "Each Wednesday at 10am, check Pantry. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 2 items per run.", "policy": "policy RestaurantStockPolicy {\n allow read Pantry(item, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Pantry.supplier\n limit order $100 per action\n limit order $200 per day\n}", "sheets": "sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure RestaurantReorder {\n about \"Reorder ingredients below their minimum\"\n policy RestaurantStockPolicy\n sheet Pantry \"Pantry\" { item: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every wednesday at 10:00\n\n let all = fetch Pantry\n let low = filter all where on_hand < minimum\n for each i in low up to 2 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.item} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.item}\" from i.supplier cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.item}\"\n }\n}"} {"id": "train-00315", "domain": "restaurant", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the guest know (I approve that message too).", "policy": "policy RestaurantRefundPolicy {\n allow read RefundRequests(request_id, guest, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $300 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure RestaurantRefunds {\n about \"Handle refund requests within limits\"\n policy RestaurantRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.guest}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00316", "domain": "restaurant", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the guest know (I approve that message too).", "policy": "policy RestaurantRefundPolicy {\n allow read RefundRequests(request_id, guest, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $300 per day\n refund without approval up to $15\n limit sends 30 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure RestaurantRefunds {\n about \"Handle refund requests within limits\"\n policy RestaurantRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00317", "domain": "restaurant", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the guest know (I approve that message too).", "policy": "policy RestaurantRefundPolicy {\n allow read RefundRequests(request_id, guest, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $50 per action\n limit refund $250 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure RestaurantRefunds {\n about \"Handle refund requests within limits\"\n policy RestaurantRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.guest}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00318", "domain": "restaurant", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the guest know (I approve that message too).", "policy": "policy RestaurantRefundPolicy {\n allow read RefundRequests(request_id, guest, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $50 per action\n limit refund $300 per day\n refund without approval up to $15\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure RestaurantRefunds {\n about \"Handle refund requests within limits\"\n policy RestaurantRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00319", "domain": "restaurant", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the guest know (I approve that message too).", "policy": "policy RestaurantRefundPolicy {\n allow read RefundRequests(request_id, guest, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $75 per action\n limit refund $450 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure RestaurantRefunds {\n about \"Handle refund requests within limits\"\n policy RestaurantRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00320", "domain": "restaurant", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the guest know (I approve that message too).", "policy": "policy RestaurantRefundPolicy {\n allow read RefundRequests(request_id, guest, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $15\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure RestaurantRefunds {\n about \"Handle refund requests within limits\"\n policy RestaurantRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.guest}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00321", "domain": "restaurant", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the guest know (I approve that message too).", "policy": "policy RestaurantRefundPolicy {\n allow read RefundRequests(request_id, guest, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $15\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure RestaurantRefunds {\n about \"Handle refund requests within limits\"\n policy RestaurantRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00322", "domain": "restaurant", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the guest know (I approve that message too).", "policy": "policy RestaurantRefundPolicy {\n allow read RefundRequests(request_id, guest, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure RestaurantRefunds {\n about \"Handle refund requests within limits\"\n policy RestaurantRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, guest: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.guest}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00323", "domain": "restaurant", "pattern": "confirm_new", "batch": false, "sop": "When a new reservation is added to Bookings: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Tables calendar for 60 minutes, and mark it confirmed. Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, deposit)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow calendar Tables\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\ncalendar Tables \"Tables\"", "program": "procedure RestaurantConfirmNewReservation {\n about \"Confirm a new reservation and add it to the calendar\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Bookings\n\n if r.at < now() + 12 hours {\n notify owner \"Short-notice reservation for {r.guest} at {r.at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, your reservation with the restaurant is confirmed for {r.at}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.guest}\", at: r.at, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00324", "domain": "restaurant", "pattern": "confirm_new", "batch": false, "sop": "When a new reservation is added to Bookings: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (show me the messages for approval first), put it on the Tables calendar for 60 minutes, and mark it confirmed. Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, deposit)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow calendar Tables\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\ncalendar Tables \"Tables\"", "program": "procedure RestaurantConfirmNewReservation {\n about \"Confirm a new reservation and add it to the calendar\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Bookings\n\n if r.at < now() + 2 hours {\n notify owner \"Short-notice reservation for {r.guest} at {r.at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, your reservation with the restaurant is confirmed for {r.at}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.guest}\", at: r.at, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00325", "domain": "restaurant", "pattern": "confirm_new", "batch": false, "sop": "When a new reservation is added to Bookings: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Tables calendar for 30 minutes, and mark it confirmed. Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, deposit)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 09:00 and 21:00\n allow calendar Tables\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\ncalendar Tables \"Tables\"", "program": "procedure RestaurantConfirmNewReservation {\n about \"Confirm a new reservation and add it to the calendar\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Bookings\n\n if r.at < now() + 2 hours {\n notify owner \"Short-notice reservation for {r.guest} at {r.at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, your reservation with the restaurant is confirmed for {r.at}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.guest}\", at: r.at, length: 30 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00326", "domain": "restaurant", "pattern": "confirm_new", "batch": false, "sop": "When a new reservation is added to Bookings: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (show me the messages for approval first), put it on the Tables calendar for 60 minutes, and mark it confirmed. Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, deposit)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow calendar Tables\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\ncalendar Tables \"Tables\"", "program": "procedure RestaurantConfirmNewReservation {\n about \"Confirm a new reservation and add it to the calendar\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Bookings\n\n if r.at < now() + 24 hours {\n notify owner \"Short-notice reservation for {r.guest} at {r.at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, your reservation with the restaurant is confirmed for {r.at}.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.guest}\", at: r.at, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00327", "domain": "restaurant", "pattern": "confirm_new", "batch": false, "sop": "When a new reservation is added to Bookings: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (i want to approve each message first), put it on the Tables calendar for 90 minutes, and mark it confirmed. Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, deposit, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 07:30 and 19:00\n allow calendar Tables\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\ncalendar Tables \"Tables\"", "program": "procedure RestaurantConfirmNewReservation {\n about \"Confirm a new reservation and add it to the calendar\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Bookings\n\n if r.at < now() + 24 hours {\n notify owner \"Short-notice reservation for {r.guest} at {r.at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.guest}, your reservation with the restaurant is confirmed for {r.at}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.guest}\", at: r.at, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00328", "domain": "restaurant", "pattern": "confirm_new", "batch": false, "sop": "When a new reservation is added to Bookings: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (i need to ok every message), put it on the Tables calendar for 30 minutes, and mark it confirmed. Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, deposit)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow calendar Tables\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\ncalendar Tables \"Tables\"", "program": "procedure RestaurantConfirmNewReservation {\n about \"Confirm a new reservation and add it to the calendar\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Bookings\n\n if r.at < now() + 12 hours {\n notify owner \"Short-notice reservation for {r.guest} at {r.at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, your reservation with the restaurant is confirmed for {r.at}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.guest}\", at: r.at, length: 30 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00329", "domain": "restaurant", "pattern": "confirm_new", "batch": false, "sop": "When a new reservation is added to Bookings: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (i want to approve each message first), put it on the Tables calendar for 90 minutes, and mark it confirmed. Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, deposit)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 07:30 and 19:00\n allow calendar Tables\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\ncalendar Tables \"Tables\"", "program": "procedure RestaurantConfirmNewReservation {\n about \"Confirm a new reservation and add it to the calendar\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Bookings\n\n if r.at < now() + 2 hours {\n notify owner \"Short-notice reservation for {r.guest} at {r.at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.guest}, your reservation with the restaurant is confirmed for {r.at}.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.guest}\", at: r.at, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00330", "domain": "restaurant", "pattern": "wait_followup", "batch": false, "sop": "When a new guest is added to Bookings, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"seated\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, status, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantFollowUpAfterWait {\n about \"Contact a new guest, then follow up once\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger when new row r in Bookings\n\n let first = draft sms to r.phone: \"Hi {r.guest}, thanks for choosing the restaurant! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Bookings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"seated\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.guest default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00331", "domain": "restaurant", "pattern": "wait_followup", "batch": false, "sop": "When a new guest is added to Bookings, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"seated\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantFollowUpAfterWait {\n about \"Contact a new guest, then follow up once\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger when new row r in Bookings\n\n let first = draft sms to r.phone: \"Hi {r.guest default 'there'}, thanks for choosing the restaurant! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Bookings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"seated\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.guest}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00332", "domain": "restaurant", "pattern": "wait_followup", "batch": false, "sop": "When a new guest is added to Bookings, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"seated\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, status, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantFollowUpAfterWait {\n about \"Contact a new guest, then follow up once\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger when new row r in Bookings\n\n let first = draft sms to r.phone: \"Hi {r.guest default 'there'}, thanks for choosing the restaurant! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Bookings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"seated\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.guest default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00333", "domain": "restaurant", "pattern": "wait_followup", "batch": false, "sop": "When a new guest is added to Bookings, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"seated\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantFollowUpAfterWait {\n about \"Contact a new guest, then follow up once\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger when new row r in Bookings\n\n let first = draft sms to r.phone: \"Hi {r.guest default 'there'}, thanks for choosing the restaurant! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Bookings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"seated\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.guest default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00334", "domain": "restaurant", "pattern": "wait_followup", "batch": false, "sop": "When a new guest is added to Bookings, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"seated\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantFollowUpAfterWait {\n about \"Contact a new guest, then follow up once\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger when new row r in Bookings\n\n let first = draft sms to r.phone: \"Hi {r.guest}, thanks for choosing the restaurant! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Bookings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"seated\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.guest}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00335", "domain": "restaurant", "pattern": "wait_followup", "batch": false, "sop": "When a new guest is added to Bookings, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"seated\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantFollowUpAfterWait {\n about \"Contact a new guest, then follow up once\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger when new row r in Bookings\n\n let first = draft sms to r.phone: \"Hi {r.guest default 'there'}, thanks for choosing the restaurant! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Bookings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"seated\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.guest default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00336", "domain": "restaurant", "pattern": "wait_followup", "batch": false, "sop": "When a new guest is added to Bookings, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"seated\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, status, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantFollowUpAfterWait {\n about \"Contact a new guest, then follow up once\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger when new row r in Bookings\n\n let first = draft sms to r.phone: \"Hi {r.guest}, thanks for choosing the restaurant! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Bookings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"seated\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.guest default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00337", "domain": "restaurant", "pattern": "wait_followup", "batch": false, "sop": "When a new guest is added to Bookings, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"seated\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantFollowUpAfterWait {\n about \"Contact a new guest, then follow up once\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger when new row r in Bookings\n\n let first = draft sms to r.phone: \"Hi {r.guest}, thanks for choosing the restaurant! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Bookings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"seated\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.guest default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00338", "domain": "restaurant", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Keep the allergy notes out of the message. No more than 100.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, come back to the restaurant! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00339", "domain": "restaurant", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Keep the allergy notes out of the message. No more than 50.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, come back to the restaurant! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00340", "domain": "restaurant", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Don't mention the allergy notes. No more than 50.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, come back to the restaurant! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00341", "domain": "restaurant", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Don't mention the allergy notes. No more than 100.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.guest}, come back to the restaurant! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00342", "domain": "restaurant", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Never include their allergy notes. No more than 50.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, come back to the restaurant! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00343", "domain": "restaurant", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Don't mention the allergy notes. No more than 100.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.guest}, come back to the restaurant! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00344", "domain": "restaurant", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Never include their allergy notes. No more than 100.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.guest}, come back to the restaurant! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00345", "domain": "restaurant", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Don't mention the allergy notes. No more than 50.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, come back to the restaurant! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00346", "domain": "restaurant", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Never include their allergy notes. No more than 100.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.guest default 'there'}, come back to the restaurant! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00347", "domain": "restaurant", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Never include their allergy notes. No more than 50.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.guest default 'there'}, come back to the restaurant! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00348", "domain": "restaurant", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Keep the allergy notes out of the message. No more than 50.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.guest default 'there'}, come back to the restaurant! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00349", "domain": "restaurant", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Keep the allergy notes out of the message. No more than 50.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.guest default 'there'}, come back to the restaurant! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00350", "domain": "restaurant", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Keep the allergy notes out of the message. No more than 100.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.guest default 'there'}, come back to the restaurant! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00351", "domain": "restaurant", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Never include their allergy notes. No more than 100.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.guest}, come back to the restaurant! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00352", "domain": "restaurant", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Keep the allergy notes out of the message. No more than 50.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.guest default 'there'}, come back to the restaurant! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00353", "domain": "retail", "pattern": "reminder", "batch": false, "sop": "Every day at 11am, find every customer in the Orders sheet whose order is in three days and whose status is \"new\". Send each one a email reminder. I need to OK every message. Never include their payment notes. At most 30 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 3 days and status == \"new\"\n for each r in due up to 30 {\n let m = draft email to r.email subject \"Your order in three days\": \"Hi {r.customer default 'there'}, a reminder from the shop: your order is in three days.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00354", "domain": "retail", "pattern": "reminder", "batch": false, "sop": "Every day at 6pm, find every customer in the Orders sheet whose order is in two days and whose status is \"new\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them notified. Don't mention the payment notes. At most 50 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 18:00\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 2 days and status == \"new\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your order in two days\": \"Hi {r.customer}, a reminder from the shop: your order is in two days.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00355", "domain": "retail", "pattern": "reminder", "batch": false, "sop": "Every Wednesday at 11am, find every customer in the Orders sheet whose order is tomorrow and whose status is \"new\". Send each one a email reminder. I want to approve each message first. Don't mention the payment notes. At most 50 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every wednesday at 11:00\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 1 day and status == \"new\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your order tomorrow\": \"Hi {r.customer}, a reminder from the shop: your order is tomorrow.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00356", "domain": "retail", "pattern": "reminder", "batch": false, "sop": "Every day at 8:30am, find every customer in the Orders sheet whose order is tomorrow and whose status is \"new\". Send each one a email reminder. Show me the messages for approval first. Then mark them notified. Keep the payment notes out of the message. At most 20 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 1 day and status == \"new\"\n for each r in due up to 20 {\n let m = draft email to r.email subject \"Your order tomorrow\": \"Hi {r.customer}, a reminder from the shop: your order is tomorrow.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00357", "domain": "retail", "pattern": "reminder", "batch": false, "sop": "Each day at 5:30pm, find every customer in the Orders sheet whose order is in three days and whose status is \"new\". Send each one a email reminder. Let me check the messages before they go out. Then mark them reminded. Keep the payment notes out of the message. At most 100 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 17:30\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 3 days and status == \"new\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your order in three days\": \"Hi {r.customer default 'there'}, a reminder from the shop: your order is in three days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00358", "domain": "retail", "pattern": "reminder", "batch": false, "sop": "On Mondays at 11am, find every customer in the Orders sheet whose order is in three days and whose status is \"new\". Send each one a email reminder. Show me the messages for approval first. Then mark them notified. Keep the payment notes out of the message. At most 30 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every monday at 11:00\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 3 days and status == \"new\"\n for each r in due up to 30 {\n let m = draft email to r.email subject \"Your order in three days\": \"Hi {r.customer default 'there'}, a reminder from the shop: your order is in three days.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00359", "domain": "retail", "pattern": "reminder", "batch": false, "sop": "Each morning at 8am, find every customer in the Orders sheet whose order is tomorrow and whose status is \"new\". Send each one a email reminder. Let me check the messages before they go out. Don't mention the payment notes. At most 50 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 08:00\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 1 day and status == \"new\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your order tomorrow\": \"Hi {r.customer}, a reminder from the shop: your order is tomorrow.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00360", "domain": "retail", "pattern": "reminder", "batch": true, "sop": "Every day at 5:30pm, find every customer in the Orders sheet whose order is in three days and whose status is \"new\". Send each one a email reminder. I need to OK every message. Then mark them notified. Keep the payment notes out of the message. At most 30 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 17:30\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 3 days and status == \"new\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your order in three days\": \"Hi {r.customer default 'there'}, a reminder from the shop: your order is in three days.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00361", "domain": "retail", "pattern": "reminder", "batch": true, "sop": "Daily at 11am, find every customer in the Orders sheet whose order is tomorrow and whose status is \"new\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Keep the payment notes out of the message. At most 20 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 1 day and status == \"new\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your order tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the shop: your order is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00362", "domain": "retail", "pattern": "reminder", "batch": true, "sop": "Daily at 5:30pm, find every customer in the Orders sheet whose order is in a week and whose status is \"new\". Send each one a email reminder. I need to OK every message. Don't mention the payment notes. At most 20 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 17:30\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 7 days and status == \"new\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your order in a week\": \"Hi {r.customer default 'there'}, a reminder from the shop: your order is in a week.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00363", "domain": "retail", "pattern": "reminder", "batch": true, "sop": "Every Monday at 9am, find every customer in the Orders sheet whose order is in a week and whose status is \"new\". Send each one a email reminder. I need to OK every message. Then mark them reminded. Keep the payment notes out of the message. At most 50 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 50 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every monday at 09:00\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 7 days and status == \"new\"\n let msgs = draft each r in due up to 50 email to r.email subject \"Your order in a week\": \"Hi {r.customer default 'there'}, a reminder from the shop: your order is in a week.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00364", "domain": "retail", "pattern": "reminder", "batch": true, "sop": "On Tuesdays at 10am, find every customer in the Orders sheet whose order is tomorrow and whose status is \"new\". Send each one a email reminder. I need to OK every message. Then mark them notified. Keep the payment notes out of the message. At most 20 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every tuesday at 10:00\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 1 day and status == \"new\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your order tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the shop: your order is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00365", "domain": "retail", "pattern": "reminder", "batch": true, "sop": "Every day at 8:30am, find every customer in the Orders sheet whose order is tomorrow and whose status is \"new\". Send each one a email reminder. I want to approve each message first. Then mark them reminded. Keep the payment notes out of the message. At most 100 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 1 day and status == \"new\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your order tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the shop: your order is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00366", "domain": "retail", "pattern": "reminder", "batch": true, "sop": "Every Friday at 10am, find every customer in the Orders sheet whose order is in two days and whose status is \"new\". Send each one a email reminder. I need to OK every message. Never include their payment notes. At most 100 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every friday at 10:00\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 2 days and status == \"new\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your order in two days\": \"Hi {r.customer default 'there'}, a reminder from the shop: your order is in two days.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00367", "domain": "retail", "pattern": "followup", "batch": false, "sop": "Every day at 8:30am, look for customers marked \"returned\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 1 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00368", "domain": "retail", "pattern": "followup", "batch": false, "sop": "Each morning at 9am, look for customers marked \"returned\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 09:00\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 1 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00369", "domain": "retail", "pattern": "followup", "batch": false, "sop": "Every Friday at 10am, look for customers marked \"returned\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every friday at 10:00\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 2 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00370", "domain": "retail", "pattern": "followup", "batch": false, "sop": "Every Friday at 9am, look for customers marked \"returned\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every friday at 09:00\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 7 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00371", "domain": "retail", "pattern": "followup", "batch": false, "sop": "On Mondays at 11am, look for customers marked \"returned\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every monday at 11:00\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 3 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00372", "domain": "retail", "pattern": "followup", "batch": false, "sop": "Each Friday at 8am, look for customers marked \"returned\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every friday at 08:00\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 1 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00373", "domain": "retail", "pattern": "followup", "batch": false, "sop": "Each day at 5:30pm, look for customers marked \"returned\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Keep the payment notes out of the message.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 17:30\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 1 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00374", "domain": "retail", "pattern": "followup", "batch": false, "sop": "Daily at 8:30am, look for customers marked \"returned\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 1 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00375", "domain": "retail", "pattern": "followup", "batch": true, "sop": "Each morning at 11am, look for customers marked \"returned\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 2 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00376", "domain": "retail", "pattern": "followup", "batch": true, "sop": "Each day at 6pm, look for customers marked \"returned\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the payment notes out of the message.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 18:00\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 2 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00377", "domain": "retail", "pattern": "followup", "batch": true, "sop": "Every day at 9am, look for customers marked \"returned\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Keep the payment notes out of the message.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 09:00\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 7 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00378", "domain": "retail", "pattern": "followup", "batch": true, "sop": "Each morning at 10am, look for customers marked \"returned\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 10:00\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 2 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00379", "domain": "retail", "pattern": "followup", "batch": true, "sop": "Every day at 8:30am, look for customers marked \"returned\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 1 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00380", "domain": "retail", "pattern": "followup", "batch": true, "sop": "Each Thursday at 6pm, look for customers marked \"returned\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every thursday at 18:00\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 3 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00381", "domain": "retail", "pattern": "followup", "batch": true, "sop": "Each day at 4pm, look for customers marked \"returned\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the payment notes out of the message.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 16:00\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 2 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00382", "domain": "retail", "pattern": "followup", "batch": true, "sop": "Each morning at 11am, look for customers marked \"returned\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the payment notes out of the message.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailReturnedFollowUp {\n about \"Follow up with customers marked returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Orders\n let recent = filter all where status == \"returned\" and days_between(ordered_on, today()) <= 3 and days_between(ordered_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00383", "domain": "retail", "pattern": "lapsed", "batch": false, "sop": "Each morning at 8am, find customers whose ordered on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 08:00\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00384", "domain": "retail", "pattern": "lapsed", "batch": false, "sop": "Each Monday at 4pm, find customers whose ordered on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every monday at 16:00\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00385", "domain": "retail", "pattern": "lapsed", "batch": false, "sop": "Each Friday at 8:30am, find customers whose ordered on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every friday at 08:30\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00386", "domain": "retail", "pattern": "lapsed", "batch": false, "sop": "Each Friday at 8:30am, find customers whose ordered on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every friday at 08:30\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00387", "domain": "retail", "pattern": "lapsed", "batch": false, "sop": "Every Friday at 8am, find customers whose ordered on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every friday at 08:00\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00388", "domain": "retail", "pattern": "lapsed", "batch": false, "sop": "Every day at 8:30am, find customers whose ordered on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00389", "domain": "retail", "pattern": "lapsed", "batch": false, "sop": "Each Thursday at 8:30am, find customers whose ordered on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Keep the payment notes out of the message.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00390", "domain": "retail", "pattern": "lapsed", "batch": true, "sop": "Each morning at 9am, find customers whose ordered on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Keep the payment notes out of the message.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 09:00\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00391", "domain": "retail", "pattern": "lapsed", "batch": true, "sop": "Each Friday at 10am, find customers whose ordered on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the payment notes out of the message.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every friday at 10:00\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00392", "domain": "retail", "pattern": "lapsed", "batch": true, "sop": "Daily at 11am, find customers whose ordered on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00393", "domain": "retail", "pattern": "lapsed", "batch": true, "sop": "Each morning at 10am, find customers whose ordered on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the payment notes out of the message.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 10:00\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00394", "domain": "retail", "pattern": "lapsed", "batch": true, "sop": "Each morning at 11am, find customers whose ordered on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00395", "domain": "retail", "pattern": "lapsed", "batch": true, "sop": "Each Friday at 10am, find customers whose ordered on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every friday at 10:00\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00396", "domain": "retail", "pattern": "lapsed", "batch": true, "sop": "On Thursdays at 5:30pm, find customers whose ordered on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Keep the payment notes out of the message.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00397", "domain": "retail", "pattern": "lapsed", "batch": true, "sop": "Daily at 8:30am, find customers whose ordered on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Keep the payment notes out of the message.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00398", "domain": "retail", "pattern": "summary", "batch": false, "sop": "Each morning at 8:30am, count the customers in Orders whose status is \"returned\" and the total order total, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy RetailPolicy {\n allow read Orders(status, total, customer, email, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailDailySummary {\n about \"Tell the owner how many customers are returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Orders\n let these = filter all where status == \"returned\"\n let n = summarize count of these\n let total = summarize sum total of these\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers: {n}, total total: {total}\"\n}"} {"id": "train-00399", "domain": "retail", "pattern": "summary", "batch": false, "sop": "Every day at 8am, count the customers in Orders whose status is \"returned\" and the total order total, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy RetailPolicy {\n allow read Orders(status, total, customer, email)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailDailySummary {\n about \"Tell the owner how many customers are returned\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 08:00\n\n let all = fetch Orders\n let these = filter all where status == \"returned\"\n let n = summarize count of these\n let total = summarize sum total of these\n if n == 0 {\n stop \"no returned customers\"\n }\n notify owner \"Returned customers: {n}, total total: {total}\"\n}"} {"id": "train-00400", "domain": "retail", "pattern": "summary", "batch": false, "sop": "On Fridays at 5:30pm, count the customers in Orders whose status is \"new\" and the total order total, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy RetailPolicy {\n allow read Orders(status, total, customer, email, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailDailySummary {\n about \"Tell the owner how many customers are new\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every friday at 17:30\n\n let all = fetch Orders\n let these = filter all where status == \"new\"\n let n = summarize count of these\n let total = summarize sum total of these\n if n == 0 {\n stop \"no new customers\"\n }\n notify owner \"New customers: {n}, total total: {total}\"\n}"} {"id": "train-00401", "domain": "retail", "pattern": "summary", "batch": false, "sop": "Daily at 4pm, count the customers in Orders whose status is \"new\", and send the numbers to me only. Don't message any customers.", "policy": "policy RetailPolicy {\n allow read Orders(status, total, customer, email, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailDailySummary {\n about \"Tell the owner how many customers are new\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 16:00\n\n let all = fetch Orders\n let these = filter all where status == \"new\"\n let n = summarize count of these\n notify owner \"New customers today: {n}\"\n}"} {"id": "train-00402", "domain": "retail", "pattern": "summary", "batch": false, "sop": "Every Monday at 5:30pm, count the customers in Orders whose status is \"shipped\", and send the numbers to me only. Don't message any customers.", "policy": "policy RetailPolicy {\n allow read Orders(status, total, customer, email)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailDailySummary {\n about \"Tell the owner how many customers are shipped\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every monday at 17:30\n\n let all = fetch Orders\n let these = filter all where status == \"shipped\"\n let n = summarize count of these\n notify owner \"Shipped customers today: {n}\"\n}"} {"id": "train-00403", "domain": "retail", "pattern": "summary", "batch": false, "sop": "Every day at 6pm, count the customers in Orders whose status is \"shipped\", and send the numbers to me only. Don't message any customers.", "policy": "policy RetailPolicy {\n allow read Orders(status, total, customer, email, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailDailySummary {\n about \"Tell the owner how many customers are shipped\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 18:00\n\n let all = fetch Orders\n let these = filter all where status == \"shipped\"\n let n = summarize count of these\n notify owner \"Shipped customers today: {n}\"\n}"} {"id": "train-00404", "domain": "retail", "pattern": "summary", "batch": false, "sop": "On Tuesdays at 11am, count the customers in Orders whose status is \"shipped\", and send the numbers to me only. Don't message any customers.", "policy": "policy RetailPolicy {\n allow read Orders(status, total, customer, email, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailDailySummary {\n about \"Tell the owner how many customers are shipped\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every tuesday at 11:00\n\n let all = fetch Orders\n let these = filter all where status == \"shipped\"\n let n = summarize count of these\n notify owner \"Shipped customers today: {n}\"\n}"} {"id": "train-00405", "domain": "retail", "pattern": "summary", "batch": false, "sop": "Daily at 10am, count the customers in Orders whose status is \"new\" and the total order total, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy RetailPolicy {\n allow read Orders(status, total, customer, email)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailDailySummary {\n about \"Tell the owner how many customers are new\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 10:00\n\n let all = fetch Orders\n let these = filter all where status == \"new\"\n let n = summarize count of these\n let total = summarize sum total of these\n if n == 0 {\n stop \"no new customers\"\n }\n notify owner \"New customers: {n}, total total: {total}\"\n}"} {"id": "train-00406", "domain": "retail", "pattern": "reorder", "batch": false, "sop": "Every Wednesday at 6pm, check Stock. For anything below its minimum, order the usual reorder amount from its vendor. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy RetailStockPolicy {\n allow read Stock(product, qty, min_qty, reorder_qty, vendor, cost)\n allow supplier Stock.vendor\n limit order $100 per action\n limit order $500 per day\n}", "sheets": "sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }", "program": "procedure RetailReorder {\n about \"Reorder products below their minimum\"\n policy RetailStockPolicy\n sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }\n trigger every wednesday at 18:00\n\n let all = fetch Stock\n let low = filter all where qty < min_qty\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.product} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.product}\" from i.vendor cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.product}\"\n }\n}"} {"id": "train-00407", "domain": "retail", "pattern": "reorder", "batch": false, "sop": "Daily at 8am, check Stock. For anything below its minimum, order the usual reorder amount from its vendor. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy RetailStockPolicy {\n allow read Stock(product, qty, min_qty, reorder_qty, vendor, cost)\n allow supplier Stock.vendor\n limit order $250 per action\n limit order $1000 per day\n}", "sheets": "sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }", "program": "procedure RetailReorder {\n about \"Reorder products below their minimum\"\n policy RetailStockPolicy\n sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }\n trigger every day at 08:00\n\n let all = fetch Stock\n let low = filter all where qty < min_qty\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.cost\n if cost > $250.00 {\n notify owner \"Reorder of {i.product} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.product}\" from i.vendor cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.product}\"\n }\n}"} {"id": "train-00408", "domain": "retail", "pattern": "reorder", "batch": false, "sop": "Every day at 8:30am, check Stock. For anything below its minimum, order the usual reorder amount from its vendor. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy RetailStockPolicy {\n allow read Stock(product, qty, min_qty, reorder_qty, vendor, cost)\n allow supplier Stock.vendor\n limit order $100 per action\n limit order $300 per day\n}", "sheets": "sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }", "program": "procedure RetailReorder {\n about \"Reorder products below their minimum\"\n policy RetailStockPolicy\n sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }\n trigger every day at 08:30\n\n let all = fetch Stock\n let low = filter all where qty < min_qty\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.product} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.product}\" from i.vendor cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.product}\"\n }\n}"} {"id": "train-00409", "domain": "retail", "pattern": "reorder", "batch": false, "sop": "Every day at 8am, check Stock. For anything below its minimum, order the usual reorder amount from its vendor. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy RetailStockPolicy {\n allow read Stock(product, qty, min_qty, reorder_qty, vendor, cost)\n allow supplier Stock.vendor\n limit order $250 per action\n limit order $750 per day\n}", "sheets": "sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }", "program": "procedure RetailReorder {\n about \"Reorder products below their minimum\"\n policy RetailStockPolicy\n sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }\n trigger every day at 08:00\n\n let all = fetch Stock\n let low = filter all where qty < min_qty\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.cost\n if cost > $250.00 {\n notify owner \"Reorder of {i.product} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.product}\" from i.vendor cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.product}\"\n }\n}"} {"id": "train-00410", "domain": "retail", "pattern": "reorder", "batch": false, "sop": "Each morning at 9am, check Stock. For anything below its minimum, order the usual reorder amount from its vendor. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 2 items per run.", "policy": "policy RetailStockPolicy {\n allow read Stock(product, qty, min_qty, reorder_qty, vendor, cost)\n allow supplier Stock.vendor\n limit order $100 per action\n limit order $200 per day\n}", "sheets": "sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }", "program": "procedure RetailReorder {\n about \"Reorder products below their minimum\"\n policy RetailStockPolicy\n sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }\n trigger every day at 09:00\n\n let all = fetch Stock\n let low = filter all where qty < min_qty\n for each i in low up to 2 {\n let cost = i.reorder_qty * i.cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.product} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.product}\" from i.vendor cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.product}\"\n }\n}"} {"id": "train-00411", "domain": "retail", "pattern": "reorder", "batch": false, "sop": "On Mondays at 8am, check Stock. For anything below its minimum, order the usual reorder amount from its vendor. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy RetailStockPolicy {\n allow read Stock(product, qty, min_qty, reorder_qty, vendor, cost)\n allow supplier Stock.vendor\n limit order $150 per action\n limit order $450 per day\n}", "sheets": "sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }", "program": "procedure RetailReorder {\n about \"Reorder products below their minimum\"\n policy RetailStockPolicy\n sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }\n trigger every monday at 08:00\n\n let all = fetch Stock\n let low = filter all where qty < min_qty\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.product} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.product}\" from i.vendor cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.product}\"\n }\n}"} {"id": "train-00412", "domain": "retail", "pattern": "reorder", "batch": false, "sop": "Every Friday at 8am, check Stock. For anything below its minimum, order the usual reorder amount from its vendor. Always ask me first. Never spend more than $200 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy RetailStockPolicy {\n allow read Stock(product, qty, min_qty, reorder_qty, vendor, cost)\n allow supplier Stock.vendor\n limit order $200 per action\n limit order $600 per day\n}", "sheets": "sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }", "program": "procedure RetailReorder {\n about \"Reorder products below their minimum\"\n policy RetailStockPolicy\n sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }\n trigger every friday at 08:00\n\n let all = fetch Stock\n let low = filter all where qty < min_qty\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.cost\n if cost > $200.00 {\n notify owner \"Reorder of {i.product} would cost {cost}, over the $200 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.product}\" from i.vendor cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.product}\"\n }\n}"} {"id": "train-00413", "domain": "retail", "pattern": "reorder", "batch": false, "sop": "On Mondays at 11am, check Stock. For anything below its minimum, order the usual reorder amount from its vendor. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy RetailStockPolicy {\n allow read Stock(product, qty, min_qty, reorder_qty, vendor, cost)\n allow supplier Stock.vendor\n limit order $150 per action\n limit order $750 per day\n}", "sheets": "sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }", "program": "procedure RetailReorder {\n about \"Reorder products below their minimum\"\n policy RetailStockPolicy\n sheet Stock \"Stock\" { product: Text, qty: Number, min_qty: Number, reorder_qty: Number, vendor: Text, cost: Money }\n trigger every monday at 11:00\n\n let all = fetch Stock\n let low = filter all where qty < min_qty\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.product} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.product}\" from i.vendor cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.product}\"\n }\n}"} {"id": "train-00414", "domain": "retail", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy RetailRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $200 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure RetailRefunds {\n about \"Handle refund requests within limits\"\n policy RetailRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00415", "domain": "retail", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy RetailRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $150 per day\n refund without approval up to $15\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure RetailRefunds {\n about \"Handle refund requests within limits\"\n policy RetailRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00416", "domain": "retail", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy RetailRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $450 per day\n refund without approval up to $20\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure RetailRefunds {\n about \"Handle refund requests within limits\"\n policy RetailRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00417", "domain": "retail", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $100, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy RetailRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $100 per action\n limit refund $300 per day\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure RetailRefunds {\n about \"Handle refund requests within limits\"\n policy RetailRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00418", "domain": "retail", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy RetailRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $225 per day\n refund without approval up to $10\n limit sends 30 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure RetailRefunds {\n about \"Handle refund requests within limits\"\n policy RetailRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00419", "domain": "retail", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $75, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy RetailRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $450 per day\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure RetailRefunds {\n about \"Handle refund requests within limits\"\n policy RetailRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00420", "domain": "retail", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy RetailRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $120 per day\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure RetailRefunds {\n about \"Handle refund requests within limits\"\n policy RetailRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00421", "domain": "retail", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy RetailRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $200 per day\n refund without approval up to $15\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure RetailRefunds {\n about \"Handle refund requests within limits\"\n policy RetailRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00422", "domain": "retail", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Orders, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"shipped\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger when new row r in Orders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Orders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"shipped\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00423", "domain": "retail", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Orders, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"shipped\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger when new row r in Orders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Orders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"shipped\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00424", "domain": "retail", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Orders, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"shipped\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger when new row r in Orders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Orders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"shipped\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00425", "domain": "retail", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Orders, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"shipped\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger when new row r in Orders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Orders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"shipped\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00426", "domain": "retail", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Orders, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"shipped\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger when new row r in Orders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Orders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"shipped\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00427", "domain": "retail", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Orders, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"shipped\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Keep the payment notes out of the message.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger when new row r in Orders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Orders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"shipped\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00428", "domain": "retail", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Orders, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"shipped\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, status, card_note)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger when new row r in Orders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Orders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"shipped\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00429", "domain": "retail", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Orders, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"shipped\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Don't mention the payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger when new row r in Orders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Orders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"shipped\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00430", "domain": "retail", "pattern": "escalation", "batch": false, "sop": "On Wednesdays at 9am: for customers with a order total above zero whose order passed more than 3 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 14 days late, don't message them; tell me so I can call. Keep the payment notes out of the message. At most 20 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, total)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every wednesday at 09:00\n\n let all = fetch Orders\n let late = filter all where total > $0.00 and days_between(ordered_on, today()) > 3\n for each r in late up to 20 {\n if days_between(r.ordered_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.total}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a total of {r.total}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00431", "domain": "retail", "pattern": "escalation", "batch": false, "sop": "On Mondays at 10am: for customers with a order total above zero whose order passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 30 days late, don't message them; tell me so I can call. Don't mention the payment notes. At most 40 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, total, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every monday at 10:00\n\n let all = fetch Orders\n let late = filter all where total > $0.00 and days_between(ordered_on, today()) > 5\n for each r in late up to 40 {\n if days_between(r.ordered_on, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.total}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a total of {r.total}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00432", "domain": "retail", "pattern": "escalation", "batch": false, "sop": "Each Wednesday at 8am: for customers with a order total above zero whose order passed more than 3 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 14 days late, don't message them; tell me so I can call. Keep the payment notes out of the message. At most 30 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, total, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every wednesday at 08:00\n\n let all = fetch Orders\n let late = filter all where total > $0.00 and days_between(ordered_on, today()) > 3\n for each r in late up to 30 {\n if days_between(r.ordered_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.total}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a total of {r.total}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-00433", "domain": "retail", "pattern": "escalation", "batch": false, "sop": "Every day at 4pm: for customers with a order total above zero whose order passed more than 5 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 14 days late, don't message them; tell me so I can call. Keep the payment notes out of the message. At most 40 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, total, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 16:00\n\n let all = fetch Orders\n let late = filter all where total > $0.00 and days_between(ordered_on, today()) > 5\n for each r in late up to 40 {\n if days_between(r.ordered_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.total}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a total of {r.total}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00434", "domain": "retail", "pattern": "escalation", "batch": false, "sop": "Every day at 5:30pm: for customers with a order total above zero whose order passed more than 3 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 14 days late, don't message them; tell me so I can call. Never include their payment notes. At most 40 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, total, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 17:30\n\n let all = fetch Orders\n let late = filter all where total > $0.00 and days_between(ordered_on, today()) > 3\n for each r in late up to 40 {\n if days_between(r.ordered_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.total}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a total of {r.total}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00435", "domain": "retail", "pattern": "escalation", "batch": false, "sop": "Every day at 6pm: for customers with a order total above zero whose order passed more than 5 days ago, send a polite reminder with the amount. Show me the messages for approval first. If it's more than 14 days late, don't message them; tell me so I can call. Don't mention the payment notes. At most 20 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, total, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 18:00\n\n let all = fetch Orders\n let late = filter all where total > $0.00 and days_between(ordered_on, today()) > 5\n for each r in late up to 20 {\n if days_between(r.ordered_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.total}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a total of {r.total}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-00436", "domain": "retail", "pattern": "escalation", "batch": false, "sop": "Each Wednesday at 6pm: for customers with a order total above zero whose order passed more than 7 days ago, send a polite reminder with the amount. Show me the messages for approval first. If it's more than 21 days late, don't message them; tell me so I can call. Don't mention the payment notes. At most 40 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, total)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every wednesday at 18:00\n\n let all = fetch Orders\n let late = filter all where total > $0.00 and days_between(ordered_on, today()) > 7\n for each r in late up to 40 {\n if days_between(r.ordered_on, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.total}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a total of {r.total}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00437", "domain": "retail", "pattern": "escalation", "batch": false, "sop": "Every day at 8am: for customers with a order total above zero whose order passed more than 5 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 30 days late, don't message them; tell me so I can call. Keep the payment notes out of the message. At most 30 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, total)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 08:00\n\n let all = fetch Orders\n let late = filter all where total > $0.00 and days_between(ordered_on, today()) > 5\n for each r in late up to 30 {\n if days_between(r.ordered_on, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.total}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a total of {r.total}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00438", "domain": "retail", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Keep the payment notes out of the message. No more than 50.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00439", "domain": "retail", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Never include their payment notes. No more than 50.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 50 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00440", "domain": "retail", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Don't mention the payment notes. No more than 100.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00441", "domain": "retail", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Never include their payment notes. No more than 100.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00442", "domain": "retail", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Don't mention the payment notes. No more than 100.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00443", "domain": "retail", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Never include their payment notes. No more than 50.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00444", "domain": "retail", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Don't mention the payment notes. No more than 100.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00445", "domain": "retail", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Keep the payment notes out of the message. No more than 100.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00446", "domain": "retail", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Keep the payment notes out of the message. No more than 100.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00447", "domain": "retail", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Keep the payment notes out of the message. No more than 100.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00448", "domain": "retail", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Never include their payment notes. No more than 100.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00449", "domain": "retail", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Never include their payment notes. No more than 100.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00450", "domain": "retail", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Keep the payment notes out of the message. No more than 100.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00451", "domain": "retail", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Don't mention the payment notes. No more than 50.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00452", "domain": "retail", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Don't mention the payment notes. No more than 100.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status, card_note)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00453", "domain": "salon", "pattern": "reminder", "batch": false, "sop": "Every day at 10am, find every client in the Clients sheet whose last visit is in two days and whose status is \"active\". Send each one a text reminder. Let me check the messages before they go out. Never include their color formula. At most 30 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 10:00\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 2 days and status == \"active\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, a reminder from the salon: your last visit is in two days.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00454", "domain": "salon", "pattern": "reminder", "batch": false, "sop": "Every Thursday at 10am, find every client in the Clients sheet whose last visit is in three days and whose status is \"active\". Send each one a text reminder. Nothing goes out until I've approved it. Never include their color formula. At most 30 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 3 days and status == \"active\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, a reminder from the salon: your last visit is in three days.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00455", "domain": "salon", "pattern": "reminder", "batch": false, "sop": "Each day at 5:30pm, find every client in the Clients sheet whose last visit is in three days and whose status is \"active\". Send each one a text reminder. I want to approve each message first. Keep the color formula out of the message. At most 50 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 17:30\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 3 days and status == \"active\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.name}, a reminder from the salon: your last visit is in three days.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00456", "domain": "salon", "pattern": "reminder", "batch": false, "sop": "On Fridays at 5:30pm, find every client in the Clients sheet whose last visit is tomorrow and whose status is \"active\". Send each one a text reminder. Let me check the messages before they go out. Then mark them notified. Keep the color formula out of the message. At most 100 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every friday at 17:30\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 1 day and status == \"active\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, a reminder from the salon: your last visit is tomorrow.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00457", "domain": "salon", "pattern": "reminder", "batch": false, "sop": "Each morning at 8:30am, find every client in the Clients sheet whose last visit is in a week and whose status is \"active\". Send each one a text reminder. I need to OK every message. Then mark them notified. Keep the color formula out of the message. At most 30 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:30\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 7 days and status == \"active\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, a reminder from the salon: your last visit is in a week.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00458", "domain": "salon", "pattern": "reminder", "batch": false, "sop": "Each morning at 8am, find every client in the Clients sheet whose last visit is in three days and whose status is \"active\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Keep the color formula out of the message. At most 50 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:00\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 3 days and status == \"active\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.name}, a reminder from the salon: your last visit is in three days.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00459", "domain": "salon", "pattern": "reminder", "batch": false, "sop": "Daily at 8:30am, find every client in the Clients sheet whose last visit is in two days and whose status is \"active\". Send each one a text reminder. Nothing goes out until I've approved it. Don't mention the color formula. At most 30 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:30\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 2 days and status == \"active\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, a reminder from the salon: your last visit is in two days.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00460", "domain": "salon", "pattern": "reminder", "batch": true, "sop": "On Fridays at 8:30am, find every client in the Clients sheet whose last visit is in a week and whose status is \"active\". Send each one a text reminder. Show me the messages for approval first. Never include their color formula. At most 50 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 50 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every friday at 08:30\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 7 days and status == \"active\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.name}, a reminder from the salon: your last visit is in a week.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00461", "domain": "salon", "pattern": "reminder", "batch": true, "sop": "On Wednesdays at 8am, find every client in the Clients sheet whose last visit is in three days and whose status is \"active\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Never include their color formula. At most 50 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 50 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every wednesday at 08:00\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 3 days and status == \"active\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.name default 'there'}, a reminder from the salon: your last visit is in three days.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00462", "domain": "salon", "pattern": "reminder", "batch": true, "sop": "Every day at 8am, find every client in the Clients sheet whose last visit is tomorrow and whose status is \"active\". Send each one a text reminder. Let me check the messages before they go out. Then mark them reminded. Don't mention the color formula. At most 20 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:00\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 1 day and status == \"active\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.name default 'there'}, a reminder from the salon: your last visit is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00463", "domain": "salon", "pattern": "reminder", "batch": true, "sop": "Daily at 4pm, find every client in the Clients sheet whose last visit is tomorrow and whose status is \"active\". Send each one a text reminder. I need to OK every message. Never include their color formula. At most 20 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 16:00\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 1 day and status == \"active\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.name default 'there'}, a reminder from the salon: your last visit is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00464", "domain": "salon", "pattern": "reminder", "batch": true, "sop": "Daily at 6pm, find every client in the Clients sheet whose last visit is tomorrow and whose status is \"active\". Send each one a text reminder. Let me check the messages before they go out. Then mark them reminded. Don't mention the color formula. At most 30 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 18:00\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 1 day and status == \"active\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.name}, a reminder from the salon: your last visit is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00465", "domain": "salon", "pattern": "reminder", "batch": true, "sop": "Each day at 5:30pm, find every client in the Clients sheet whose last visit is tomorrow and whose status is \"active\". Send each one a text reminder. I want to approve each message first. Then mark them notified. Never include their color formula. At most 30 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 17:30\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 1 day and status == \"active\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.name}, a reminder from the salon: your last visit is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00466", "domain": "salon", "pattern": "reminder", "batch": true, "sop": "Every day at 10am, find every client in the Clients sheet whose last visit is tomorrow and whose status is \"active\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Don't mention the color formula. At most 50 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 50 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 10:00\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 1 day and status == \"active\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.name}, a reminder from the salon: your last visit is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00467", "domain": "salon", "pattern": "followup", "batch": false, "sop": "Each Monday at 8am, look for clients marked \"booked\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every monday at 08:00\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 3 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00468", "domain": "salon", "pattern": "followup", "batch": false, "sop": "Every Tuesday at 4pm, look for clients marked \"booked\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every tuesday at 16:00\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 3 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00469", "domain": "salon", "pattern": "followup", "batch": false, "sop": "Every day at 10am, look for clients marked \"booked\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 10:00\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 1 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00470", "domain": "salon", "pattern": "followup", "batch": false, "sop": "Every Wednesday at 5:30pm, look for clients marked \"booked\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Never include their color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every wednesday at 17:30\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 2 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00471", "domain": "salon", "pattern": "followup", "batch": false, "sop": "Every Monday at 8:30am, look for clients marked \"booked\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every monday at 08:30\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 7 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00472", "domain": "salon", "pattern": "followup", "batch": false, "sop": "Daily at 5:30pm, look for clients marked \"booked\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 17:30\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 7 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00473", "domain": "salon", "pattern": "followup", "batch": false, "sop": "Each morning at 8am, look for clients marked \"booked\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:00\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 2 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00474", "domain": "salon", "pattern": "followup", "batch": false, "sop": "Each day at 5:30pm, look for clients marked \"booked\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 17:30\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 7 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00475", "domain": "salon", "pattern": "followup", "batch": true, "sop": "Each day at 4pm, look for clients marked \"booked\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 16:00\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 3 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00476", "domain": "salon", "pattern": "followup", "batch": true, "sop": "Each Friday at 10am, look for clients marked \"booked\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every friday at 10:00\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 1 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00477", "domain": "salon", "pattern": "followup", "batch": true, "sop": "Every Friday at 11am, look for clients marked \"booked\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every friday at 11:00\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 7 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00478", "domain": "salon", "pattern": "followup", "batch": true, "sop": "Daily at 8am, look for clients marked \"booked\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:00\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 2 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00479", "domain": "salon", "pattern": "followup", "batch": true, "sop": "Each Wednesday at 4pm, look for clients marked \"booked\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every wednesday at 16:00\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 2 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00480", "domain": "salon", "pattern": "followup", "batch": true, "sop": "Each morning at 11am, look for clients marked \"booked\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 40 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 11:00\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 3 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00481", "domain": "salon", "pattern": "followup", "batch": true, "sop": "On Wednesdays at 10am, look for clients marked \"booked\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 2 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00482", "domain": "salon", "pattern": "followup", "batch": true, "sop": "Every day at 8:30am, look for clients marked \"booked\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonBookedFollowUp {\n about \"Follow up with clients marked booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:30\n\n let all = fetch Clients\n let recent = filter all where status == \"booked\" and days_between(last_visit, today()) <= 2 and days_between(last_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00483", "domain": "salon", "pattern": "lapsed", "batch": false, "sop": "Each morning at 8am, find clients whose last visit was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Never include their color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by last_visit first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.name}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00484", "domain": "salon", "pattern": "lapsed", "batch": false, "sop": "Each morning at 9am, find clients whose last visit was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 09:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by last_visit first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00485", "domain": "salon", "pattern": "lapsed", "batch": false, "sop": "Every day at 11am, find clients whose last visit was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 11:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by last_visit first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00486", "domain": "salon", "pattern": "lapsed", "batch": false, "sop": "Each morning at 9am, find clients whose last visit was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 09:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by last_visit first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00487", "domain": "salon", "pattern": "lapsed", "batch": false, "sop": "Daily at 8am, find clients whose last visit was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by last_visit first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00488", "domain": "salon", "pattern": "lapsed", "batch": false, "sop": "Each Friday at 8am, find clients whose last visit was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every friday at 08:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by last_visit first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00489", "domain": "salon", "pattern": "lapsed", "batch": true, "sop": "Each morning at 9am, find clients whose last visit was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 10 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 09:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by last_visit first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00490", "domain": "salon", "pattern": "lapsed", "batch": true, "sop": "Every Monday at 9am, find clients whose last visit was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every monday at 09:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by last_visit first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00491", "domain": "salon", "pattern": "lapsed", "batch": true, "sop": "Every day at 4pm, find clients whose last visit was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 16:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by last_visit first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00492", "domain": "salon", "pattern": "lapsed", "batch": true, "sop": "Each morning at 11am, find clients whose last visit was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 11:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by last_visit first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.name}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00493", "domain": "salon", "pattern": "lapsed", "batch": true, "sop": "Each morning at 8:30am, find clients whose last visit was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:30\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by last_visit first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.name}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00494", "domain": "salon", "pattern": "lapsed", "batch": true, "sop": "Every day at 10am, find clients whose last visit was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Never include their color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 10:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by last_visit first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00495", "domain": "salon", "pattern": "lapsed", "batch": true, "sop": "Every day at 11am, find clients whose last visit was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 11:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by last_visit first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.name}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00496", "domain": "salon", "pattern": "summary", "batch": false, "sop": "Daily at 9am, count the clients in Clients whose status is \"active\" and the total tab, and send the numbers to me only. Don't message any clients. If there are none, don't bother me.", "policy": "policy SalonPolicy {\n allow read Clients(status, tab, name, phone, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonDailySummary {\n about \"Tell the owner how many clients are active\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 09:00\n\n let all = fetch Clients\n let these = filter all where status == \"active\"\n let n = summarize count of these\n let total = summarize sum tab of these\n if n == 0 {\n stop \"no active clients\"\n }\n notify owner \"Active clients: {n}, total tab: {total}\"\n}"} {"id": "train-00497", "domain": "salon", "pattern": "summary", "batch": false, "sop": "Every day at 6pm, count the clients in Clients whose status is \"active\" and the total tab, and send the numbers to me only. Don't message any clients. If there are none, don't bother me.", "policy": "policy SalonPolicy {\n allow read Clients(status, tab, name, phone, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonDailySummary {\n about \"Tell the owner how many clients are active\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 18:00\n\n let all = fetch Clients\n let these = filter all where status == \"active\"\n let n = summarize count of these\n let total = summarize sum tab of these\n if n == 0 {\n stop \"no active clients\"\n }\n notify owner \"Active clients: {n}, total tab: {total}\"\n}"} {"id": "train-00498", "domain": "salon", "pattern": "summary", "batch": false, "sop": "Each Wednesday at 11am, count the clients in Clients whose status is \"lapsed\", and send the numbers to me only. Don't message any clients.", "policy": "policy SalonPolicy {\n allow read Clients(status, tab, name, phone, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonDailySummary {\n about \"Tell the owner how many clients are lapsed\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every wednesday at 11:00\n\n let all = fetch Clients\n let these = filter all where status == \"lapsed\"\n let n = summarize count of these\n notify owner \"Lapsed clients today: {n}\"\n}"} {"id": "train-00499", "domain": "salon", "pattern": "summary", "batch": false, "sop": "Each Friday at 6pm, count the clients in Clients whose status is \"lapsed\", and send the numbers to me only. Don't message any clients.", "policy": "policy SalonPolicy {\n allow read Clients(status, tab, name, phone)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonDailySummary {\n about \"Tell the owner how many clients are lapsed\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every friday at 18:00\n\n let all = fetch Clients\n let these = filter all where status == \"lapsed\"\n let n = summarize count of these\n notify owner \"Lapsed clients today: {n}\"\n}"} {"id": "train-00500", "domain": "salon", "pattern": "summary", "batch": false, "sop": "Every day at 8am, count the clients in Clients whose status is \"booked\" and the total tab, and send the numbers to me only. Don't message any clients. If there are none, don't bother me.", "policy": "policy SalonPolicy {\n allow read Clients(status, tab, name, phone)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonDailySummary {\n about \"Tell the owner how many clients are booked\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:00\n\n let all = fetch Clients\n let these = filter all where status == \"booked\"\n let n = summarize count of these\n let total = summarize sum tab of these\n if n == 0 {\n stop \"no booked clients\"\n }\n notify owner \"Booked clients: {n}, total tab: {total}\"\n}"} {"id": "train-00501", "domain": "salon", "pattern": "summary", "batch": false, "sop": "Each morning at 11am, count the clients in Clients whose status is \"lapsed\" and the total tab, and send the numbers to me only. Don't message any clients. If there are none, don't bother me.", "policy": "policy SalonPolicy {\n allow read Clients(status, tab, name, phone, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonDailySummary {\n about \"Tell the owner how many clients are lapsed\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 11:00\n\n let all = fetch Clients\n let these = filter all where status == \"lapsed\"\n let n = summarize count of these\n let total = summarize sum tab of these\n if n == 0 {\n stop \"no lapsed clients\"\n }\n notify owner \"Lapsed clients: {n}, total tab: {total}\"\n}"} {"id": "train-00502", "domain": "salon", "pattern": "summary", "batch": false, "sop": "Daily at 9am, count the clients in Clients whose status is \"active\", and send the numbers to me only. Don't message any clients.", "policy": "policy SalonPolicy {\n allow read Clients(status, tab, name, phone)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonDailySummary {\n about \"Tell the owner how many clients are active\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 09:00\n\n let all = fetch Clients\n let these = filter all where status == \"active\"\n let n = summarize count of these\n notify owner \"Active clients today: {n}\"\n}"} {"id": "train-00503", "domain": "salon", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy SalonRefundPolicy {\n allow read RefundRequests(request_id, name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $50 per action\n limit refund $150 per day\n refund without approval up to $15\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure SalonRefunds {\n about \"Handle refund requests within limits\"\n policy SalonRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00504", "domain": "salon", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy SalonRefundPolicy {\n allow read RefundRequests(request_id, name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $50 per action\n limit refund $300 per day\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure SalonRefunds {\n about \"Handle refund requests within limits\"\n policy SalonRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00505", "domain": "salon", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy SalonRefundPolicy {\n allow read RefundRequests(request_id, name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $75 per action\n limit refund $450 per day\n refund without approval up to $20\n limit sends 30 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure SalonRefunds {\n about \"Handle refund requests within limits\"\n policy SalonRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00506", "domain": "salon", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy SalonRefundPolicy {\n allow read RefundRequests(request_id, name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $240 per day\n refund without approval up to $10\n limit sends 30 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure SalonRefunds {\n about \"Handle refund requests within limits\"\n policy SalonRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00507", "domain": "salon", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy SalonRefundPolicy {\n allow read RefundRequests(request_id, name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $300 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure SalonRefunds {\n about \"Handle refund requests within limits\"\n policy SalonRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00508", "domain": "salon", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy SalonRefundPolicy {\n allow read RefundRequests(request_id, name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $50 per action\n limit refund $250 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure SalonRefunds {\n about \"Handle refund requests within limits\"\n policy SalonRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00509", "domain": "salon", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy SalonRefundPolicy {\n allow read RefundRequests(request_id, name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $200 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure SalonRefunds {\n about \"Handle refund requests within limits\"\n policy SalonRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00510", "domain": "salon", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy SalonRefundPolicy {\n allow read RefundRequests(request_id, name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $10\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure SalonRefunds {\n about \"Handle refund requests within limits\"\n policy SalonRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00511", "domain": "salon", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Clients, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"lapsed\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger when new row r in Clients\n\n let first = draft sms to r.phone: \"Hi {r.name default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Clients\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"lapsed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00512", "domain": "salon", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Clients, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"lapsed\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger when new row r in Clients\n\n let first = draft sms to r.phone: \"Hi {r.name default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Clients\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"lapsed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00513", "domain": "salon", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Clients, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"lapsed\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger when new row r in Clients\n\n let first = draft sms to r.phone: \"Hi {r.name default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Clients\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"lapsed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00514", "domain": "salon", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Clients, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"lapsed\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger when new row r in Clients\n\n let first = draft sms to r.phone: \"Hi {r.name default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Clients\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"lapsed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00515", "domain": "salon", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Clients, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"lapsed\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Never include their color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger when new row r in Clients\n\n let first = draft sms to r.phone: \"Hi {r.name default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Clients\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"lapsed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00516", "domain": "salon", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Clients, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"lapsed\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger when new row r in Clients\n\n let first = draft sms to r.phone: \"Hi {r.name default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Clients\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"lapsed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00517", "domain": "salon", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Clients, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"lapsed\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger when new row r in Clients\n\n let first = draft sms to r.phone: \"Hi {r.name default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Clients\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"lapsed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00518", "domain": "salon", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Clients, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"lapsed\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Never include their color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, status)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger when new row r in Clients\n\n let first = draft sms to r.phone: \"Hi {r.name default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Clients\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"lapsed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00519", "domain": "salon", "pattern": "escalation", "batch": false, "sop": "Each morning at 11am: for clients with a tab above zero whose last visit passed more than 5 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 14 days late, don't message them; tell me so I can call. Don't mention the color formula. At most 40 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, tab)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLateBalance {\n about \"Remind late clients; escalate very late ones\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 11:00\n\n let all = fetch Clients\n let late = filter all where tab > $0.00 and days_between(last_visit, today()) > 5\n for each r in late up to 40 {\n if days_between(r.last_visit, today()) > 14 {\n notify owner \"{r.name} is very late ({r.tab}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.name default 'there'}, our records show a tab of {r.tab}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00520", "domain": "salon", "pattern": "escalation", "batch": false, "sop": "On Fridays at 8am: for clients with a tab above zero whose last visit passed more than 5 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 14 days late, don't message them; tell me so I can call. Never include their color formula. At most 30 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, tab)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLateBalance {\n about \"Remind late clients; escalate very late ones\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every friday at 08:00\n\n let all = fetch Clients\n let late = filter all where tab > $0.00 and days_between(last_visit, today()) > 5\n for each r in late up to 30 {\n if days_between(r.last_visit, today()) > 14 {\n notify owner \"{r.name} is very late ({r.tab}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.name default 'there'}, our records show a tab of {r.tab}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00521", "domain": "salon", "pattern": "escalation", "batch": false, "sop": "Daily at 8:30am: for clients with a tab above zero whose last visit passed more than 7 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 21 days late, don't message them; tell me so I can call. Don't mention the color formula. At most 20 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, tab, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLateBalance {\n about \"Remind late clients; escalate very late ones\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:30\n\n let all = fetch Clients\n let late = filter all where tab > $0.00 and days_between(last_visit, today()) > 7\n for each r in late up to 20 {\n if days_between(r.last_visit, today()) > 21 {\n notify owner \"{r.name} is very late ({r.tab}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.name default 'there'}, our records show a tab of {r.tab}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00522", "domain": "salon", "pattern": "escalation", "batch": false, "sop": "Every Tuesday at 8am: for clients with a tab above zero whose last visit passed more than 3 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 14 days late, don't message them; tell me so I can call. Keep the color formula out of the message. At most 20 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, tab, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLateBalance {\n about \"Remind late clients; escalate very late ones\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every tuesday at 08:00\n\n let all = fetch Clients\n let late = filter all where tab > $0.00 and days_between(last_visit, today()) > 3\n for each r in late up to 20 {\n if days_between(r.last_visit, today()) > 14 {\n notify owner \"{r.name} is very late ({r.tab}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.name}, our records show a tab of {r.tab}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00523", "domain": "salon", "pattern": "escalation", "batch": false, "sop": "Daily at 8:30am: for clients with a tab above zero whose last visit passed more than 5 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 30 days late, don't message them; tell me so I can call. Never include their color formula. At most 30 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, tab, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLateBalance {\n about \"Remind late clients; escalate very late ones\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 08:30\n\n let all = fetch Clients\n let late = filter all where tab > $0.00 and days_between(last_visit, today()) > 5\n for each r in late up to 30 {\n if days_between(r.last_visit, today()) > 30 {\n notify owner \"{r.name} is very late ({r.tab}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.name}, our records show a tab of {r.tab}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00524", "domain": "salon", "pattern": "escalation", "batch": false, "sop": "Each morning at 10am: for clients with a tab above zero whose last visit passed more than 7 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 21 days late, don't message them; tell me so I can call. Keep the color formula out of the message. At most 30 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, tab)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLateBalance {\n about \"Remind late clients; escalate very late ones\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 10:00\n\n let all = fetch Clients\n let late = filter all where tab > $0.00 and days_between(last_visit, today()) > 7\n for each r in late up to 30 {\n if days_between(r.last_visit, today()) > 21 {\n notify owner \"{r.name} is very late ({r.tab}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.name default 'there'}, our records show a tab of {r.tab}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-00525", "domain": "salon", "pattern": "escalation", "batch": false, "sop": "Every day at 10am: for clients with a tab above zero whose last visit passed more than 5 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 30 days late, don't message them; tell me so I can call. Keep the color formula out of the message. At most 20 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, tab)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLateBalance {\n about \"Remind late clients; escalate very late ones\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 10:00\n\n let all = fetch Clients\n let late = filter all where tab > $0.00 and days_between(last_visit, today()) > 5\n for each r in late up to 20 {\n if days_between(r.last_visit, today()) > 30 {\n notify owner \"{r.name} is very late ({r.tab}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.name default 'there'}, our records show a tab of {r.tab}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00526", "domain": "salon", "pattern": "escalation", "batch": false, "sop": "Each morning at 10am: for clients with a tab above zero whose last visit passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 30 days late, don't message them; tell me so I can call. Don't mention the color formula. At most 30 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, tab, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLateBalance {\n about \"Remind late clients; escalate very late ones\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 10:00\n\n let all = fetch Clients\n let late = filter all where tab > $0.00 and days_between(last_visit, today()) > 5\n for each r in late up to 30 {\n if days_between(r.last_visit, today()) > 30 {\n notify owner \"{r.name} is very late ({r.tab}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.name default 'there'}, our records show a tab of {r.tab}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00527", "domain": "salon", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the color formula out of the message. No more than 100.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, come back to the salon! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00528", "domain": "salon", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Keep the color formula out of the message. No more than 100.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00529", "domain": "salon", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Never include their color formula. No more than 100.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00530", "domain": "salon", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Keep the color formula out of the message. No more than 50.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.name}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00531", "domain": "salon", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Don't mention the color formula. No more than 100.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, come back to the salon! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00532", "domain": "salon", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Don't mention the color formula. No more than 100.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, come back to the salon! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00533", "domain": "salon", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Don't mention the color formula. No more than 100.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, come back to the salon! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00534", "domain": "salon", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Keep the color formula out of the message. No more than 50.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, come back to the salon! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00535", "domain": "salon", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Never include their color formula. No more than 50.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.name}, come back to the salon! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00536", "domain": "salon", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Don't mention the color formula. No more than 50.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.name}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00537", "domain": "salon", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Keep the color formula out of the message. No more than 50.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.name default 'there'}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00538", "domain": "salon", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Never include their color formula. No more than 50.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.name default 'there'}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00539", "domain": "salon", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Don't mention the color formula. No more than 100.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.name}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00540", "domain": "salon", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Never include their color formula. No more than 50.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.name}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00541", "domain": "salon", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Don't mention the color formula. No more than 100.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.name default 'there'}, come back to the salon! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00542", "domain": "gym", "pattern": "reminder", "batch": false, "sop": "Every Monday at 6pm, find every member in the Members sheet whose renewal date is in three days and whose status is \"active\". Send each one a email reminder. Show me the messages for approval first. Never include their health notes. At most 20 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every monday at 18:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 3 days and status == \"active\"\n for each r in due up to 20 {\n let m = draft email to r.email subject \"Your renewal date in three days\": \"Hi {r.name default 'there'}, a reminder from the gym: your renewal date is in three days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00543", "domain": "gym", "pattern": "reminder", "batch": false, "sop": "On Thursdays at 11am, find every member in the Members sheet whose renewal date is in two days and whose status is \"active\". Send each one a email reminder. Let me check the messages before they go out. Then mark them notified. Keep the health notes out of the message. At most 100 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 2 days and status == \"active\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your renewal date in two days\": \"Hi {r.name default 'there'}, a reminder from the gym: your renewal date is in two days.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00544", "domain": "gym", "pattern": "reminder", "batch": false, "sop": "Every day at 4pm, find every member in the Members sheet whose renewal date is in three days and whose status is \"active\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them notified. Don't mention the health notes. At most 100 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 3 days and status == \"active\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your renewal date in three days\": \"Hi {r.name}, a reminder from the gym: your renewal date is in three days.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00545", "domain": "gym", "pattern": "reminder", "batch": false, "sop": "Each morning at 10am, find every member in the Members sheet whose renewal date is in two days and whose status is \"active\". Send each one a email reminder. Nothing goes out until I've approved it. Don't mention the health notes. At most 30 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 2 days and status == \"active\"\n for each r in due up to 30 {\n let m = draft email to r.email subject \"Your renewal date in two days\": \"Hi {r.name default 'there'}, a reminder from the gym: your renewal date is in two days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00546", "domain": "gym", "pattern": "reminder", "batch": false, "sop": "Every Thursday at 11am, find every member in the Members sheet whose renewal date is tomorrow and whose status is \"active\". Send each one a email reminder. I want to approve each message first. Never include their health notes. At most 100 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 1 day and status == \"active\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your renewal date tomorrow\": \"Hi {r.name default 'there'}, a reminder from the gym: your renewal date is tomorrow.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00547", "domain": "gym", "pattern": "reminder", "batch": false, "sop": "On Thursdays at 9am, find every member in the Members sheet whose renewal date is in two days and whose status is \"active\". Send each one a email reminder. Show me the messages for approval first. Then mark them notified. Don't mention the health notes. At most 100 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every thursday at 09:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 2 days and status == \"active\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your renewal date in two days\": \"Hi {r.name default 'there'}, a reminder from the gym: your renewal date is in two days.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00548", "domain": "gym", "pattern": "reminder", "batch": false, "sop": "Each morning at 9am, find every member in the Members sheet whose renewal date is tomorrow and whose status is \"active\". Send each one a email reminder. I need to OK every message. Then mark them notified. Never include their health notes. At most 20 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 1 day and status == \"active\"\n for each r in due up to 20 {\n let m = draft email to r.email subject \"Your renewal date tomorrow\": \"Hi {r.name}, a reminder from the gym: your renewal date is tomorrow.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00549", "domain": "gym", "pattern": "reminder", "batch": true, "sop": "Every day at 8:30am, find every member in the Members sheet whose renewal date is in two days and whose status is \"active\". Send each one a email reminder. Let me check the messages before they go out. Never include their health notes. At most 100 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 2 days and status == \"active\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your renewal date in two days\": \"Hi {r.name}, a reminder from the gym: your renewal date is in two days.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00550", "domain": "gym", "pattern": "reminder", "batch": true, "sop": "Daily at 10am, find every member in the Members sheet whose renewal date is tomorrow and whose status is \"active\". Send each one a email reminder. Show me the messages for approval first. Don't mention the health notes. At most 100 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 1 day and status == \"active\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your renewal date tomorrow\": \"Hi {r.name default 'there'}, a reminder from the gym: your renewal date is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00551", "domain": "gym", "pattern": "reminder", "batch": true, "sop": "Daily at 5:30pm, find every member in the Members sheet whose renewal date is tomorrow and whose status is \"active\". Send each one a email reminder. Nothing goes out until I've approved it. Keep the health notes out of the message. At most 20 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 1 day and status == \"active\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your renewal date tomorrow\": \"Hi {r.name}, a reminder from the gym: your renewal date is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00552", "domain": "gym", "pattern": "reminder", "batch": true, "sop": "On Fridays at 4pm, find every member in the Members sheet whose renewal date is tomorrow and whose status is \"active\". Send each one a email reminder. I need to OK every message. Then mark them notified. Don't mention the health notes. At most 100 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every friday at 16:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 1 day and status == \"active\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your renewal date tomorrow\": \"Hi {r.name default 'there'}, a reminder from the gym: your renewal date is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00553", "domain": "gym", "pattern": "reminder", "batch": true, "sop": "Each day at 4pm, find every member in the Members sheet whose renewal date is in a week and whose status is \"active\". Send each one a email reminder. Nothing goes out until I've approved it. Keep the health notes out of the message. At most 20 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 7 days and status == \"active\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your renewal date in a week\": \"Hi {r.name}, a reminder from the gym: your renewal date is in a week.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00554", "domain": "gym", "pattern": "reminder", "batch": true, "sop": "Every day at 10am, find every member in the Members sheet whose renewal date is tomorrow and whose status is \"active\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Don't mention the health notes. At most 20 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 1 day and status == \"active\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your renewal date tomorrow\": \"Hi {r.name default 'there'}, a reminder from the gym: your renewal date is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00555", "domain": "gym", "pattern": "reminder", "batch": true, "sop": "Each morning at 10am, find every member in the Members sheet whose renewal date is tomorrow and whose status is \"active\". Send each one a email reminder. Let me check the messages before they go out. Never include their health notes. At most 50 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 50 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 1 day and status == \"active\"\n let msgs = draft each r in due up to 50 email to r.email subject \"Your renewal date tomorrow\": \"Hi {r.name}, a reminder from the gym: your renewal date is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00556", "domain": "gym", "pattern": "reminder", "batch": true, "sop": "Every Thursday at 8am, find every member in the Members sheet whose renewal date is in two days and whose status is \"active\". Send each one a email reminder. I need to OK every message. Never include their health notes. At most 100 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every thursday at 08:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 2 days and status == \"active\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your renewal date in two days\": \"Hi {r.name default 'there'}, a reminder from the gym: your renewal date is in two days.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00557", "domain": "gym", "pattern": "followup", "batch": false, "sop": "Every Friday at 8:30am, look for members marked \"frozen\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every friday at 08:30\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 3 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00558", "domain": "gym", "pattern": "followup", "batch": false, "sop": "Each day at 5:30pm, look for members marked \"frozen\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 2 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00559", "domain": "gym", "pattern": "followup", "batch": false, "sop": "Each Friday at 6pm, look for members marked \"frozen\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every friday at 18:00\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 2 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00560", "domain": "gym", "pattern": "followup", "batch": false, "sop": "Daily at 5:30pm, look for members marked \"frozen\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 2 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00561", "domain": "gym", "pattern": "followup", "batch": false, "sop": "On Thursdays at 4pm, look for members marked \"frozen\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every thursday at 16:00\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 2 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00562", "domain": "gym", "pattern": "followup", "batch": false, "sop": "Daily at 6pm, look for members marked \"frozen\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 3 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00563", "domain": "gym", "pattern": "followup", "batch": true, "sop": "Each morning at 10am, look for members marked \"frozen\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 7 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00564", "domain": "gym", "pattern": "followup", "batch": true, "sop": "Each morning at 10am, look for members marked \"frozen\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 7 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00565", "domain": "gym", "pattern": "followup", "batch": true, "sop": "On Thursdays at 8am, look for members marked \"frozen\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every thursday at 08:00\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 3 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00566", "domain": "gym", "pattern": "followup", "batch": true, "sop": "Every Tuesday at 6pm, look for members marked \"frozen\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Don't mention the health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 2 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00567", "domain": "gym", "pattern": "followup", "batch": true, "sop": "Every day at 10am, look for members marked \"frozen\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 1 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00568", "domain": "gym", "pattern": "followup", "batch": true, "sop": "Each day at 4pm, look for members marked \"frozen\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 7 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00569", "domain": "gym", "pattern": "followup", "batch": true, "sop": "Each Friday at 9am, look for members marked \"frozen\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every friday at 09:00\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 3 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00570", "domain": "gym", "pattern": "followup", "batch": true, "sop": "Each Wednesday at 5:30pm, look for members marked \"frozen\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every wednesday at 17:30\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 3 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00571", "domain": "gym", "pattern": "lapsed", "batch": false, "sop": "Every Friday at 10am, find members whose renews on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Don't mention the health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every friday at 10:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by renews_on first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00572", "domain": "gym", "pattern": "lapsed", "batch": false, "sop": "Each Wednesday at 5:30pm, find members whose renews on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every wednesday at 17:30\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by renews_on first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00573", "domain": "gym", "pattern": "lapsed", "batch": false, "sop": "Every Thursday at 4pm, find members whose renews on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Don't mention the health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every thursday at 16:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by renews_on first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00574", "domain": "gym", "pattern": "lapsed", "batch": false, "sop": "Every day at 8am, find members whose renews on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by renews_on first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00575", "domain": "gym", "pattern": "lapsed", "batch": false, "sop": "Every Wednesday at 11am, find members whose renews on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every wednesday at 11:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by renews_on first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00576", "domain": "gym", "pattern": "lapsed", "batch": false, "sop": "Daily at 5:30pm, find members whose renews on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Show me the messages for approval first. Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by renews_on first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00577", "domain": "gym", "pattern": "lapsed", "batch": false, "sop": "Every day at 10am, find members whose renews on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by renews_on first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00578", "domain": "gym", "pattern": "lapsed", "batch": false, "sop": "Each Tuesday at 8:30am, find members whose renews on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every tuesday at 08:30\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by renews_on first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00579", "domain": "gym", "pattern": "lapsed", "batch": true, "sop": "Every day at 10am, find members whose renews on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by renews_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00580", "domain": "gym", "pattern": "lapsed", "batch": true, "sop": "Each morning at 9am, find members whose renews on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by renews_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00581", "domain": "gym", "pattern": "lapsed", "batch": true, "sop": "Every day at 8am, find members whose renews on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by renews_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00582", "domain": "gym", "pattern": "lapsed", "batch": true, "sop": "Each morning at 8am, find members whose renews on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by renews_on first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00583", "domain": "gym", "pattern": "lapsed", "batch": true, "sop": "Each morning at 11am, find members whose renews on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Don't mention the health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by renews_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00584", "domain": "gym", "pattern": "lapsed", "batch": true, "sop": "Every Monday at 8am, find members whose renews on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every monday at 08:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by renews_on first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00585", "domain": "gym", "pattern": "lapsed", "batch": true, "sop": "Every day at 6pm, find members whose renews on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by renews_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00586", "domain": "gym", "pattern": "lapsed", "batch": true, "sop": "Each day at 4pm, find members whose renews on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymWinBack {\n about \"Nudge members whose renewal date was long ago\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Members\n let old = filter all where days_between(renews_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by renews_on first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the gym.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00587", "domain": "gym", "pattern": "summary", "batch": false, "sop": "Every Friday at 9am, count the members in Members whose status is \"expired\", and send the numbers to me only. Don't message any members.", "policy": "policy GymPolicy {\n allow read Members(status, dues, name, email)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymDailySummary {\n about \"Tell the owner how many members are expired\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every friday at 09:00\n\n let all = fetch Members\n let these = filter all where status == \"expired\"\n let n = summarize count of these\n notify owner \"Expired members today: {n}\"\n}"} {"id": "train-00588", "domain": "gym", "pattern": "summary", "batch": false, "sop": "Each Friday at 10am, count the members in Members whose status is \"frozen\" and the total dues, and send the numbers to me only. Don't message any members. If there are none, don't bother me.", "policy": "policy GymPolicy {\n allow read Members(status, dues, name, email, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymDailySummary {\n about \"Tell the owner how many members are frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every friday at 10:00\n\n let all = fetch Members\n let these = filter all where status == \"frozen\"\n let n = summarize count of these\n let total = summarize sum dues of these\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members: {n}, total dues: {total}\"\n}"} {"id": "train-00589", "domain": "gym", "pattern": "summary", "batch": false, "sop": "Each day at 5:30pm, count the members in Members whose status is \"expired\" and the total dues, and send the numbers to me only. Don't message any members. If there are none, don't bother me.", "policy": "policy GymPolicy {\n allow read Members(status, dues, name, email, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymDailySummary {\n about \"Tell the owner how many members are expired\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Members\n let these = filter all where status == \"expired\"\n let n = summarize count of these\n let total = summarize sum dues of these\n if n == 0 {\n stop \"no expired members\"\n }\n notify owner \"Expired members: {n}, total dues: {total}\"\n}"} {"id": "train-00590", "domain": "gym", "pattern": "summary", "batch": false, "sop": "On Thursdays at 9am, count the members in Members whose status is \"expired\", and send the numbers to me only. Don't message any members.", "policy": "policy GymPolicy {\n allow read Members(status, dues, name, email, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymDailySummary {\n about \"Tell the owner how many members are expired\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every thursday at 09:00\n\n let all = fetch Members\n let these = filter all where status == \"expired\"\n let n = summarize count of these\n notify owner \"Expired members today: {n}\"\n}"} {"id": "train-00591", "domain": "gym", "pattern": "summary", "batch": false, "sop": "Each Tuesday at 4pm, count the members in Members whose status is \"frozen\" and the total dues, and send the numbers to me only. Don't message any members. If there are none, don't bother me.", "policy": "policy GymPolicy {\n allow read Members(status, dues, name, email, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymDailySummary {\n about \"Tell the owner how many members are frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every tuesday at 16:00\n\n let all = fetch Members\n let these = filter all where status == \"frozen\"\n let n = summarize count of these\n let total = summarize sum dues of these\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members: {n}, total dues: {total}\"\n}"} {"id": "train-00592", "domain": "gym", "pattern": "summary", "batch": false, "sop": "Every day at 9am, count the members in Members whose status is \"frozen\", and send the numbers to me only. Don't message any members.", "policy": "policy GymPolicy {\n allow read Members(status, dues, name, email)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymDailySummary {\n about \"Tell the owner how many members are frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Members\n let these = filter all where status == \"frozen\"\n let n = summarize count of these\n notify owner \"Frozen members today: {n}\"\n}"} {"id": "train-00593", "domain": "gym", "pattern": "summary", "batch": false, "sop": "Every day at 5:30pm, count the members in Members whose status is \"frozen\", and send the numbers to me only. Don't message any members.", "policy": "policy GymPolicy {\n allow read Members(status, dues, name, email, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymDailySummary {\n about \"Tell the owner how many members are frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Members\n let these = filter all where status == \"frozen\"\n let n = summarize count of these\n notify owner \"Frozen members today: {n}\"\n}"} {"id": "train-00594", "domain": "gym", "pattern": "summary", "batch": false, "sop": "Daily at 4pm, count the members in Members whose status is \"frozen\", and send the numbers to me only. Don't message any members.", "policy": "policy GymPolicy {\n allow read Members(status, dues, name, email, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymDailySummary {\n about \"Tell the owner how many members are frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Members\n let these = filter all where status == \"frozen\"\n let n = summarize count of these\n notify owner \"Frozen members today: {n}\"\n}"} {"id": "train-00595", "domain": "gym", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the member know (I approve that message too).", "policy": "policy GymRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $120 per day\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure GymRefunds {\n about \"Handle refund requests within limits\"\n policy GymRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00596", "domain": "gym", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the member know (I approve that message too).", "policy": "policy GymRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $150 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure GymRefunds {\n about \"Handle refund requests within limits\"\n policy GymRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00597", "domain": "gym", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the member know (I approve that message too).", "policy": "policy GymRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $200 per day\n refund without approval up to $10\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure GymRefunds {\n about \"Handle refund requests within limits\"\n policy GymRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00598", "domain": "gym", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $75, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the member know (I approve that message too).", "policy": "policy GymRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $225 per day\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure GymRefunds {\n about \"Handle refund requests within limits\"\n policy GymRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00599", "domain": "gym", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the member know (I approve that message too).", "policy": "policy GymRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $250 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure GymRefunds {\n about \"Handle refund requests within limits\"\n policy GymRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00600", "domain": "gym", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the member know (I approve that message too).", "policy": "policy GymRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $450 per day\n refund without approval up to $15\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure GymRefunds {\n about \"Handle refund requests within limits\"\n policy GymRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00601", "domain": "gym", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the member know (I approve that message too).", "policy": "policy GymRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $225 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure GymRefunds {\n about \"Handle refund requests within limits\"\n policy GymRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00602", "domain": "gym", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the member know (I approve that message too).", "policy": "policy GymRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $15\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure GymRefunds {\n about \"Handle refund requests within limits\"\n policy GymRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00603", "domain": "gym", "pattern": "wait_followup", "batch": false, "sop": "When a new member is added to Members, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Don't mention the health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFollowUpAfterWait {\n about \"Contact a new member, then follow up once\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger when new row r in Members\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name default 'there'}, thanks for choosing the gym! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Members\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00604", "domain": "gym", "pattern": "wait_followup", "batch": false, "sop": "When a new member is added to Members, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFollowUpAfterWait {\n about \"Contact a new member, then follow up once\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger when new row r in Members\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name}, thanks for choosing the gym! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Members\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00605", "domain": "gym", "pattern": "wait_followup", "batch": false, "sop": "When a new member is added to Members, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFollowUpAfterWait {\n about \"Contact a new member, then follow up once\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger when new row r in Members\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name}, thanks for choosing the gym! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Members\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00606", "domain": "gym", "pattern": "wait_followup", "batch": false, "sop": "When a new member is added to Members, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Don't mention the health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFollowUpAfterWait {\n about \"Contact a new member, then follow up once\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger when new row r in Members\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name default 'there'}, thanks for choosing the gym! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Members\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00607", "domain": "gym", "pattern": "wait_followup", "batch": false, "sop": "When a new member is added to Members, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Don't mention the health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFollowUpAfterWait {\n about \"Contact a new member, then follow up once\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger when new row r in Members\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name}, thanks for choosing the gym! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Members\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00608", "domain": "gym", "pattern": "wait_followup", "batch": false, "sop": "When a new member is added to Members, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, status, health_notes)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFollowUpAfterWait {\n about \"Contact a new member, then follow up once\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger when new row r in Members\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name}, thanks for choosing the gym! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Members\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00609", "domain": "gym", "pattern": "wait_followup", "batch": false, "sop": "When a new member is added to Members, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFollowUpAfterWait {\n about \"Contact a new member, then follow up once\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger when new row r in Members\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name default 'there'}, thanks for choosing the gym! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Members\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00610", "domain": "gym", "pattern": "wait_followup", "batch": false, "sop": "When a new member is added to Members, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Never include their health notes.", "policy": "policy GymPolicy {\n allow read Members(name, email, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFollowUpAfterWait {\n about \"Contact a new member, then follow up once\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger when new row r in Members\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name default 'there'}, thanks for choosing the gym! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Members\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00611", "domain": "gym", "pattern": "escalation", "batch": false, "sop": "On Mondays at 9am: for members with a dues above zero whose renewal date passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 14 days late, don't message them; tell me so I can call. Never include their health notes. At most 30 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, dues)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymLateBalance {\n about \"Remind late members; escalate very late ones\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every monday at 09:00\n\n let all = fetch Members\n let late = filter all where dues > $0.00 and days_between(renews_on, today()) > 5\n for each r in late up to 30 {\n if days_between(r.renews_on, today()) > 14 {\n notify owner \"{r.name} is very late ({r.dues}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name default 'there'}, our records show a dues of {r.dues}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-00612", "domain": "gym", "pattern": "escalation", "batch": false, "sop": "Each Thursday at 4pm: for members with a dues above zero whose renewal date passed more than 7 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 21 days late, don't message them; tell me so I can call. Keep the health notes out of the message. At most 30 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, dues)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymLateBalance {\n about \"Remind late members; escalate very late ones\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every thursday at 16:00\n\n let all = fetch Members\n let late = filter all where dues > $0.00 and days_between(renews_on, today()) > 7\n for each r in late up to 30 {\n if days_between(r.renews_on, today()) > 21 {\n notify owner \"{r.name} is very late ({r.dues}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name default 'there'}, our records show a dues of {r.dues}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00613", "domain": "gym", "pattern": "escalation", "batch": false, "sop": "Every Friday at 4pm: for members with a dues above zero whose renewal date passed more than 5 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 14 days late, don't message them; tell me so I can call. Never include their health notes. At most 30 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, dues)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymLateBalance {\n about \"Remind late members; escalate very late ones\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every friday at 16:00\n\n let all = fetch Members\n let late = filter all where dues > $0.00 and days_between(renews_on, today()) > 5\n for each r in late up to 30 {\n if days_between(r.renews_on, today()) > 14 {\n notify owner \"{r.name} is very late ({r.dues}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name}, our records show a dues of {r.dues}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-00614", "domain": "gym", "pattern": "escalation", "batch": false, "sop": "Every Tuesday at 4pm: for members with a dues above zero whose renewal date passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 14 days late, don't message them; tell me so I can call. Don't mention the health notes. At most 20 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, dues)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymLateBalance {\n about \"Remind late members; escalate very late ones\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every tuesday at 16:00\n\n let all = fetch Members\n let late = filter all where dues > $0.00 and days_between(renews_on, today()) > 5\n for each r in late up to 20 {\n if days_between(r.renews_on, today()) > 14 {\n notify owner \"{r.name} is very late ({r.dues}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name default 'there'}, our records show a dues of {r.dues}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00615", "domain": "gym", "pattern": "escalation", "batch": false, "sop": "Daily at 5:30pm: for members with a dues above zero whose renewal date passed more than 7 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 21 days late, don't message them; tell me so I can call. Never include their health notes. At most 40 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, dues, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymLateBalance {\n about \"Remind late members; escalate very late ones\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Members\n let late = filter all where dues > $0.00 and days_between(renews_on, today()) > 7\n for each r in late up to 40 {\n if days_between(r.renews_on, today()) > 21 {\n notify owner \"{r.name} is very late ({r.dues}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name default 'there'}, our records show a dues of {r.dues}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00616", "domain": "gym", "pattern": "escalation", "batch": false, "sop": "Each Friday at 6pm: for members with a dues above zero whose renewal date passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 30 days late, don't message them; tell me so I can call. Don't mention the health notes. At most 30 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, dues, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymLateBalance {\n about \"Remind late members; escalate very late ones\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every friday at 18:00\n\n let all = fetch Members\n let late = filter all where dues > $0.00 and days_between(renews_on, today()) > 5\n for each r in late up to 30 {\n if days_between(r.renews_on, today()) > 30 {\n notify owner \"{r.name} is very late ({r.dues}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name}, our records show a dues of {r.dues}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00617", "domain": "gym", "pattern": "escalation", "batch": false, "sop": "Each morning at 10am: for members with a dues above zero whose renewal date passed more than 5 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 30 days late, don't message them; tell me so I can call. Keep the health notes out of the message. At most 20 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, dues, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymLateBalance {\n about \"Remind late members; escalate very late ones\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Members\n let late = filter all where dues > $0.00 and days_between(renews_on, today()) > 5\n for each r in late up to 20 {\n if days_between(r.renews_on, today()) > 30 {\n notify owner \"{r.name} is very late ({r.dues}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name default 'there'}, our records show a dues of {r.dues}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00618", "domain": "gym", "pattern": "escalation", "batch": false, "sop": "Daily at 9am: for members with a dues above zero whose renewal date passed more than 5 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 30 days late, don't message them; tell me so I can call. Keep the health notes out of the message. At most 40 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, dues)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymLateBalance {\n about \"Remind late members; escalate very late ones\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Members\n let late = filter all where dues > $0.00 and days_between(renews_on, today()) > 5\n for each r in late up to 40 {\n if days_between(r.renews_on, today()) > 30 {\n notify owner \"{r.name} is very late ({r.dues}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name default 'there'}, our records show a dues of {r.dues}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00619", "domain": "gym", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Don't mention the health notes. No more than 100.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the gym! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00620", "domain": "gym", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Don't mention the health notes. No more than 50.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name}, come back to the gym! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00621", "domain": "gym", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Never include their health notes. No more than 100.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name}, come back to the gym! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00622", "domain": "gym", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Keep the health notes out of the message. No more than 50.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name}, come back to the gym! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00623", "domain": "gym", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Never include their health notes. No more than 100.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name}, come back to the gym! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00624", "domain": "gym", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Keep the health notes out of the message. No more than 100.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the gym! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00625", "domain": "gym", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Don't mention the health notes. No more than 50.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the gym! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00626", "domain": "gym", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Don't mention the health notes. No more than 100.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the gym! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00627", "domain": "gym", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Keep the health notes out of the message. No more than 100.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.name}, come back to the gym! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00628", "domain": "gym", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Never include their health notes. No more than 50.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.name}, come back to the gym! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00629", "domain": "gym", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Keep the health notes out of the message. No more than 100.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the gym! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00630", "domain": "gym", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Never include their health notes. No more than 100.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the gym! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00631", "domain": "gym", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Never include their health notes. No more than 50.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.name}, come back to the gym! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00632", "domain": "autorepair", "pattern": "reminder", "batch": false, "sop": "Each morning at 8am, find every customer in the Jobs sheet whose pickup time is in three days and whose status is \"open\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Keep the VIN out of the message. At most 100 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 08:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 3 days and status == \"open\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, a reminder from the shop: your pickup time is in three days at {time_of(r.promised)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00633", "domain": "autorepair", "pattern": "reminder", "batch": false, "sop": "Each day at 5:30pm, find every customer in the Jobs sheet whose pickup time is in three days and whose status is \"open\". Send each one a text reminder. I want to approve each message first. Don't mention the VIN. At most 30 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 17:30\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 3 days and status == \"open\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, a reminder from the shop: your pickup time is in three days at {time_of(r.promised)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00634", "domain": "autorepair", "pattern": "reminder", "batch": false, "sop": "Daily at 5:30pm, find every customer in the Jobs sheet whose pickup time is tomorrow and whose status is \"open\". Send each one a text reminder. Let me check the messages before they go out. Never include their VIN. At most 100 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 17:30\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 1 day and status == \"open\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, a reminder from the shop: your pickup time is tomorrow at {time_of(r.promised)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00635", "domain": "autorepair", "pattern": "reminder", "batch": false, "sop": "Every Friday at 8am, find every customer in the Jobs sheet whose pickup time is in a week and whose status is \"open\". Send each one a text reminder. Let me check the messages before they go out. Then mark them reminded. Keep the VIN out of the message. At most 100 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every friday at 08:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 7 days and status == \"open\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, a reminder from the shop: your pickup time is in a week at {time_of(r.promised)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00636", "domain": "autorepair", "pattern": "reminder", "batch": false, "sop": "On Wednesdays at 6pm, find every customer in the Jobs sheet whose pickup time is tomorrow and whose status is \"open\". Send each one a text reminder. I need to OK every message. Never include their VIN. At most 50 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every wednesday at 18:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 1 day and status == \"open\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, a reminder from the shop: your pickup time is tomorrow at {time_of(r.promised)}.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00637", "domain": "autorepair", "pattern": "reminder", "batch": false, "sop": "Daily at 10am, find every customer in the Jobs sheet whose pickup time is in two days and whose status is \"open\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Don't mention the VIN. At most 50 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 10:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 2 days and status == \"open\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, a reminder from the shop: your pickup time is in two days at {time_of(r.promised)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00638", "domain": "autorepair", "pattern": "reminder", "batch": false, "sop": "Each day at 4pm, find every customer in the Jobs sheet whose pickup time is in three days and whose status is \"open\". Send each one a text reminder. Nothing goes out until I've approved it. Then mark them notified. Keep the VIN out of the message. At most 100 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 16:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 3 days and status == \"open\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, a reminder from the shop: your pickup time is in three days at {time_of(r.promised)}.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00639", "domain": "autorepair", "pattern": "reminder", "batch": true, "sop": "On Fridays at 4pm, find every customer in the Jobs sheet whose pickup time is tomorrow and whose status is \"open\". Send each one a text reminder. I want to approve each message first. Never include their VIN. At most 100 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every friday at 16:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 1 day and status == \"open\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.owner_name default 'there'}, a reminder from the shop: your pickup time is tomorrow at {time_of(r.promised)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00640", "domain": "autorepair", "pattern": "reminder", "batch": true, "sop": "Every day at 11am, find every customer in the Jobs sheet whose pickup time is tomorrow and whose status is \"open\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Never include their VIN. At most 50 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 50 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 11:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 1 day and status == \"open\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.owner_name}, a reminder from the shop: your pickup time is tomorrow at {time_of(r.promised)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00641", "domain": "autorepair", "pattern": "reminder", "batch": true, "sop": "Each day at 5:30pm, find every customer in the Jobs sheet whose pickup time is in three days and whose status is \"open\". Send each one a text reminder. I want to approve each message first. Never include their VIN. At most 50 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 50 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 17:30\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 3 days and status == \"open\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.owner_name}, a reminder from the shop: your pickup time is in three days at {time_of(r.promised)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00642", "domain": "autorepair", "pattern": "reminder", "batch": true, "sop": "Every Tuesday at 8am, find every customer in the Jobs sheet whose pickup time is in three days and whose status is \"open\". Send each one a text reminder. I need to OK every message. Then mark them reminded. Don't mention the VIN. At most 100 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every tuesday at 08:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 3 days and status == \"open\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.owner_name default 'there'}, a reminder from the shop: your pickup time is in three days at {time_of(r.promised)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00643", "domain": "autorepair", "pattern": "reminder", "batch": true, "sop": "Daily at 6pm, find every customer in the Jobs sheet whose pickup time is tomorrow and whose status is \"open\". Send each one a text reminder. Let me check the messages before they go out. Then mark them reminded. Never include their VIN. At most 50 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 18:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 1 day and status == \"open\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.owner_name default 'there'}, a reminder from the shop: your pickup time is tomorrow at {time_of(r.promised)}.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00644", "domain": "autorepair", "pattern": "reminder", "batch": true, "sop": "Each day at 6pm, find every customer in the Jobs sheet whose pickup time is in two days and whose status is \"open\". Send each one a text reminder. I need to OK every message. Then mark them notified. Keep the VIN out of the message. At most 20 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 18:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 2 days and status == \"open\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.owner_name default 'there'}, a reminder from the shop: your pickup time is in two days at {time_of(r.promised)}.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00645", "domain": "autorepair", "pattern": "reminder", "batch": true, "sop": "Every day at 6pm, find every customer in the Jobs sheet whose pickup time is in a week and whose status is \"open\". Send each one a text reminder. Nothing goes out until I've approved it. Keep the VIN out of the message. At most 30 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 18:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 7 days and status == \"open\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.owner_name}, a reminder from the shop: your pickup time is in a week at {time_of(r.promised)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00646", "domain": "autorepair", "pattern": "reminder", "batch": true, "sop": "Every Friday at 6pm, find every customer in the Jobs sheet whose pickup time is in a week and whose status is \"open\". Send each one a text reminder. I need to OK every message. Then mark them reminded. Don't mention the VIN. At most 100 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every friday at 18:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 7 days and status == \"open\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.owner_name default 'there'}, a reminder from the shop: your pickup time is in a week at {time_of(r.promised)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00647", "domain": "autorepair", "pattern": "followup", "batch": false, "sop": "On Tuesdays at 10am, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the VIN out of the message.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every tuesday at 10:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 1 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00648", "domain": "autorepair", "pattern": "followup", "batch": false, "sop": "Each Wednesday at 8am, look for customers marked \"picked-up\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every wednesday at 08:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 3 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00649", "domain": "autorepair", "pattern": "followup", "batch": false, "sop": "On Wednesdays at 11am, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the VIN out of the message.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every wednesday at 11:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 1 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00650", "domain": "autorepair", "pattern": "followup", "batch": false, "sop": "Every Wednesday at 6pm, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every wednesday at 18:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 1 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00651", "domain": "autorepair", "pattern": "followup", "batch": false, "sop": "On Fridays at 4pm, look for customers marked \"picked-up\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every friday at 16:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 3 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00652", "domain": "autorepair", "pattern": "followup", "batch": false, "sop": "Every day at 5:30pm, look for customers marked \"picked-up\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Keep the VIN out of the message.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 17:30\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 3 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00653", "domain": "autorepair", "pattern": "followup", "batch": true, "sop": "Daily at 8am, look for customers marked \"picked-up\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 08:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 3 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.owner_name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00654", "domain": "autorepair", "pattern": "followup", "batch": true, "sop": "Every day at 4pm, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 16:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 1 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.owner_name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00655", "domain": "autorepair", "pattern": "followup", "batch": true, "sop": "On Thursdays at 5:30pm, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 1 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.owner_name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00656", "domain": "autorepair", "pattern": "followup", "batch": true, "sop": "Daily at 5:30pm, look for customers marked \"picked-up\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 17:30\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 3 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.owner_name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00657", "domain": "autorepair", "pattern": "followup", "batch": true, "sop": "Every Tuesday at 8am, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every tuesday at 08:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 1 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.owner_name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00658", "domain": "autorepair", "pattern": "followup", "batch": true, "sop": "On Tuesdays at 10am, look for customers marked \"picked-up\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every tuesday at 10:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 2 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.owner_name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00659", "domain": "autorepair", "pattern": "followup", "batch": true, "sop": "Daily at 8am, look for customers marked \"picked-up\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the VIN out of the message.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 08:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 3 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.owner_name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00660", "domain": "autorepair", "pattern": "followup", "batch": true, "sop": "On Mondays at 6pm, look for customers marked \"picked-up\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every monday at 18:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 2 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.owner_name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00661", "domain": "autorepair", "pattern": "lapsed", "batch": false, "sop": "Every day at 4pm, find customers whose promised was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 16:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by promised first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00662", "domain": "autorepair", "pattern": "lapsed", "batch": false, "sop": "Every Tuesday at 8:30am, find customers whose promised was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every tuesday at 08:30\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by promised first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00663", "domain": "autorepair", "pattern": "lapsed", "batch": false, "sop": "Every Thursday at 11am, find customers whose promised was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by promised first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00664", "domain": "autorepair", "pattern": "lapsed", "batch": false, "sop": "Every day at 8am, find customers whose promised was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 08:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by promised first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00665", "domain": "autorepair", "pattern": "lapsed", "batch": false, "sop": "On Thursdays at 8am, find customers whose promised was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every thursday at 08:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by promised first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00666", "domain": "autorepair", "pattern": "lapsed", "batch": false, "sop": "Daily at 9am, find customers whose promised was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 09:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by promised first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00667", "domain": "autorepair", "pattern": "lapsed", "batch": true, "sop": "Every day at 9am, find customers whose promised was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the VIN out of the message.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 09:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by promised first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.owner_name default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00668", "domain": "autorepair", "pattern": "lapsed", "batch": true, "sop": "Daily at 10am, find customers whose promised was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 10:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by promised first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.owner_name default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00669", "domain": "autorepair", "pattern": "lapsed", "batch": true, "sop": "Every Wednesday at 9am, find customers whose promised was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every wednesday at 09:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by promised first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.owner_name default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00670", "domain": "autorepair", "pattern": "lapsed", "batch": true, "sop": "On Tuesdays at 11am, find customers whose promised was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every tuesday at 11:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by promised first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.owner_name default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00671", "domain": "autorepair", "pattern": "lapsed", "batch": true, "sop": "Every day at 8am, find customers whose promised was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 08:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by promised first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.owner_name}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00672", "domain": "autorepair", "pattern": "lapsed", "batch": true, "sop": "Every day at 11am, find customers whose promised was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 11:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by promised first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.owner_name default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00673", "domain": "autorepair", "pattern": "lapsed", "batch": true, "sop": "Each morning at 9am, find customers whose promised was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 09:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by promised first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.owner_name default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00674", "domain": "autorepair", "pattern": "lapsed", "batch": true, "sop": "Daily at 10am, find customers whose promised was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 10:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by promised first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.owner_name default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00675", "domain": "autorepair", "pattern": "summary", "batch": false, "sop": "Every Thursday at 5:30pm, count the customers in Jobs whose status is \"picked-up\" and the total estimate, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy AutorepairPolicy {\n allow read Jobs(status, estimate, owner_name, phone)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairDailySummary {\n about \"Tell the owner how many customers are picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Jobs\n let these = filter all where status == \"picked-up\"\n let n = summarize count of these\n let total = summarize sum estimate of these\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers: {n}, total estimate: {total}\"\n}"} {"id": "train-00676", "domain": "autorepair", "pattern": "summary", "batch": false, "sop": "Every day at 6pm, count the customers in Jobs whose status is \"ready\", and send the numbers to me only. Don't message any customers.", "policy": "policy AutorepairPolicy {\n allow read Jobs(status, estimate, owner_name, phone)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 18:00\n\n let all = fetch Jobs\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n notify owner \"Ready customers today: {n}\"\n}"} {"id": "train-00677", "domain": "autorepair", "pattern": "summary", "batch": false, "sop": "Each day at 6pm, count the customers in Jobs whose status is \"open\" and the total estimate, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy AutorepairPolicy {\n allow read Jobs(status, estimate, owner_name, phone, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairDailySummary {\n about \"Tell the owner how many customers are open\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 18:00\n\n let all = fetch Jobs\n let these = filter all where status == \"open\"\n let n = summarize count of these\n let total = summarize sum estimate of these\n if n == 0 {\n stop \"no open customers\"\n }\n notify owner \"Open customers: {n}, total estimate: {total}\"\n}"} {"id": "train-00678", "domain": "autorepair", "pattern": "summary", "batch": false, "sop": "Every day at 8:30am, count the customers in Jobs whose status is \"open\" and the total estimate, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy AutorepairPolicy {\n allow read Jobs(status, estimate, owner_name, phone, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairDailySummary {\n about \"Tell the owner how many customers are open\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 08:30\n\n let all = fetch Jobs\n let these = filter all where status == \"open\"\n let n = summarize count of these\n let total = summarize sum estimate of these\n if n == 0 {\n stop \"no open customers\"\n }\n notify owner \"Open customers: {n}, total estimate: {total}\"\n}"} {"id": "train-00679", "domain": "autorepair", "pattern": "summary", "batch": false, "sop": "Each morning at 8am, count the customers in Jobs whose status is \"ready\" and the total estimate, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy AutorepairPolicy {\n allow read Jobs(status, estimate, owner_name, phone, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 08:00\n\n let all = fetch Jobs\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n let total = summarize sum estimate of these\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers: {n}, total estimate: {total}\"\n}"} {"id": "train-00680", "domain": "autorepair", "pattern": "summary", "batch": false, "sop": "Daily at 10am, count the customers in Jobs whose status is \"picked-up\", and send the numbers to me only. Don't message any customers.", "policy": "policy AutorepairPolicy {\n allow read Jobs(status, estimate, owner_name, phone, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairDailySummary {\n about \"Tell the owner how many customers are picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 10:00\n\n let all = fetch Jobs\n let these = filter all where status == \"picked-up\"\n let n = summarize count of these\n notify owner \"Picked-up customers today: {n}\"\n}"} {"id": "train-00681", "domain": "autorepair", "pattern": "summary", "batch": false, "sop": "Each Friday at 8:30am, count the customers in Jobs whose status is \"open\" and the total estimate, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy AutorepairPolicy {\n allow read Jobs(status, estimate, owner_name, phone)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairDailySummary {\n about \"Tell the owner how many customers are open\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every friday at 08:30\n\n let all = fetch Jobs\n let these = filter all where status == \"open\"\n let n = summarize count of these\n let total = summarize sum estimate of these\n if n == 0 {\n stop \"no open customers\"\n }\n notify owner \"Open customers: {n}, total estimate: {total}\"\n}"} {"id": "train-00682", "domain": "autorepair", "pattern": "summary", "batch": false, "sop": "On Mondays at 5:30pm, count the customers in Jobs whose status is \"open\" and the total estimate, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy AutorepairPolicy {\n allow read Jobs(status, estimate, owner_name, phone, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairDailySummary {\n about \"Tell the owner how many customers are open\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every monday at 17:30\n\n let all = fetch Jobs\n let these = filter all where status == \"open\"\n let n = summarize count of these\n let total = summarize sum estimate of these\n if n == 0 {\n stop \"no open customers\"\n }\n notify owner \"Open customers: {n}, total estimate: {total}\"\n}"} {"id": "train-00683", "domain": "autorepair", "pattern": "reorder", "batch": false, "sop": "Every day at 9am, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy AutorepairStockPolicy {\n allow read Parts(part, count, minimum, reorder_qty, supplier, unit_price)\n allow supplier Parts.supplier\n limit order $150 per action\n limit order $600 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }", "program": "procedure AutorepairReorder {\n about \"Reorder parts below their minimum\"\n policy AutorepairStockPolicy\n sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }\n trigger every day at 09:00\n\n let all = fetch Parts\n let low = filter all where count < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_price\n if cost > $150.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-00684", "domain": "autorepair", "pattern": "reorder", "batch": false, "sop": "On Wednesdays at 9am, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy AutorepairStockPolicy {\n allow read Parts(part, count, minimum, reorder_qty, supplier, unit_price)\n allow supplier Parts.supplier\n limit order $150 per action\n limit order $750 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }", "program": "procedure AutorepairReorder {\n about \"Reorder parts below their minimum\"\n policy AutorepairStockPolicy\n sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }\n trigger every wednesday at 09:00\n\n let all = fetch Parts\n let low = filter all where count < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_price\n if cost > $150.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-00685", "domain": "autorepair", "pattern": "reorder", "batch": false, "sop": "Each Thursday at 8:30am, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy AutorepairStockPolicy {\n allow read Parts(part, count, minimum, reorder_qty, supplier, unit_price)\n allow supplier Parts.supplier\n limit order $150 per action\n limit order $600 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }", "program": "procedure AutorepairReorder {\n about \"Reorder parts below their minimum\"\n policy AutorepairStockPolicy\n sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }\n trigger every thursday at 08:30\n\n let all = fetch Parts\n let low = filter all where count < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_price\n if cost > $150.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-00686", "domain": "autorepair", "pattern": "reorder", "batch": false, "sop": "Daily at 8am, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy AutorepairStockPolicy {\n allow read Parts(part, count, minimum, reorder_qty, supplier, unit_price)\n allow supplier Parts.supplier\n limit order $250 per action\n limit order $750 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }", "program": "procedure AutorepairReorder {\n about \"Reorder parts below their minimum\"\n policy AutorepairStockPolicy\n sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }\n trigger every day at 08:00\n\n let all = fetch Parts\n let low = filter all where count < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.unit_price\n if cost > $250.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-00687", "domain": "autorepair", "pattern": "reorder", "batch": false, "sop": "Every day at 8:30am, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $200 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy AutorepairStockPolicy {\n allow read Parts(part, count, minimum, reorder_qty, supplier, unit_price)\n allow supplier Parts.supplier\n limit order $200 per action\n limit order $600 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }", "program": "procedure AutorepairReorder {\n about \"Reorder parts below their minimum\"\n policy AutorepairStockPolicy\n sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }\n trigger every day at 08:30\n\n let all = fetch Parts\n let low = filter all where count < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.unit_price\n if cost > $200.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $200 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-00688", "domain": "autorepair", "pattern": "reorder", "batch": false, "sop": "Daily at 8:30am, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy AutorepairStockPolicy {\n allow read Parts(part, count, minimum, reorder_qty, supplier, unit_price)\n allow supplier Parts.supplier\n limit order $100 per action\n limit order $400 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }", "program": "procedure AutorepairReorder {\n about \"Reorder parts below their minimum\"\n policy AutorepairStockPolicy\n sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }\n trigger every day at 08:30\n\n let all = fetch Parts\n let low = filter all where count < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_price\n if cost > $100.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-00689", "domain": "autorepair", "pattern": "reorder", "batch": false, "sop": "Daily at 8:30am, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $200 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy AutorepairStockPolicy {\n allow read Parts(part, count, minimum, reorder_qty, supplier, unit_price)\n allow supplier Parts.supplier\n limit order $200 per action\n limit order $800 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }", "program": "procedure AutorepairReorder {\n about \"Reorder parts below their minimum\"\n policy AutorepairStockPolicy\n sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }\n trigger every day at 08:30\n\n let all = fetch Parts\n let low = filter all where count < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_price\n if cost > $200.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $200 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-00690", "domain": "autorepair", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy AutorepairRefundPolicy {\n allow read RefundRequests(request_id, owner_name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $75 per action\n limit refund $225 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure AutorepairRefunds {\n about \"Handle refund requests within limits\"\n policy AutorepairRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00691", "domain": "autorepair", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy AutorepairRefundPolicy {\n allow read RefundRequests(request_id, owner_name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $50 per action\n limit refund $250 per day\n refund without approval up to $10\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure AutorepairRefunds {\n about \"Handle refund requests within limits\"\n policy AutorepairRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner_name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00692", "domain": "autorepair", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy AutorepairRefundPolicy {\n allow read RefundRequests(request_id, owner_name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $240 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure AutorepairRefunds {\n about \"Handle refund requests within limits\"\n policy AutorepairRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00693", "domain": "autorepair", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy AutorepairRefundPolicy {\n allow read RefundRequests(request_id, owner_name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $500 per day\n refund without approval up to $20\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure AutorepairRefunds {\n about \"Handle refund requests within limits\"\n policy AutorepairRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00694", "domain": "autorepair", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy AutorepairRefundPolicy {\n allow read RefundRequests(request_id, owner_name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure AutorepairRefunds {\n about \"Handle refund requests within limits\"\n policy AutorepairRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00695", "domain": "autorepair", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy AutorepairRefundPolicy {\n allow read RefundRequests(request_id, owner_name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $200 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure AutorepairRefunds {\n about \"Handle refund requests within limits\"\n policy AutorepairRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00696", "domain": "autorepair", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $100, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy AutorepairRefundPolicy {\n allow read RefundRequests(request_id, owner_name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $600 per day\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure AutorepairRefunds {\n about \"Handle refund requests within limits\"\n policy AutorepairRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00697", "domain": "autorepair", "pattern": "confirm_new", "batch": false, "sop": "When a new pickup time is added to Jobs: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Bays calendar for 60 minutes, and mark it confirmed. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, estimate, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow calendar Bays\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\ncalendar Bays \"Bays\"", "program": "procedure AutorepairConfirmNewPickupTime {\n about \"Confirm a new pickup time and add it to the calendar\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n calendar Bays \"Bays\"\n trigger when new row r in Jobs\n\n if r.promised < now() + 12 hours {\n notify owner \"Short-notice pickup time for {r.owner_name} at {r.promised}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your pickup time with the shop is confirmed for {r.promised}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Bays { title: \"{r.owner_name}\", at: r.promised, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00698", "domain": "autorepair", "pattern": "confirm_new", "batch": false, "sop": "When a new pickup time is added to Jobs: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (i want to approve each message first), put it on the Bays calendar for 60 minutes, and mark it confirmed. Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, estimate, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow calendar Bays\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\ncalendar Bays \"Bays\"", "program": "procedure AutorepairConfirmNewPickupTime {\n about \"Confirm a new pickup time and add it to the calendar\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n calendar Bays \"Bays\"\n trigger when new row r in Jobs\n\n if r.promised < now() + 24 hours {\n notify owner \"Short-notice pickup time for {r.owner_name} at {r.promised}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner_name}, your pickup time with the shop is confirmed for {r.promised}.\"\n let ok = request approval of m from owner timeout 1 day else stop \"confirmation not approved\"\n send ok\n let ev = book Bays { title: \"{r.owner_name}\", at: r.promised, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00699", "domain": "autorepair", "pattern": "confirm_new", "batch": false, "sop": "When a new pickup time is added to Jobs: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Bays calendar for 45 minutes, and mark it confirmed. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, estimate, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow calendar Bays\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\ncalendar Bays \"Bays\"", "program": "procedure AutorepairConfirmNewPickupTime {\n about \"Confirm a new pickup time and add it to the calendar\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n calendar Bays \"Bays\"\n trigger when new row r in Jobs\n\n if r.promised < now() + 2 hours {\n notify owner \"Short-notice pickup time for {r.owner_name} at {r.promised}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your pickup time with the shop is confirmed for {r.promised}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Bays { title: \"{r.owner_name}\", at: r.promised, length: 45 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00700", "domain": "autorepair", "pattern": "confirm_new", "batch": false, "sop": "When a new pickup time is added to Jobs: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Bays calendar for 30 minutes, and mark it confirmed. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, estimate)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow calendar Bays\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\ncalendar Bays \"Bays\"", "program": "procedure AutorepairConfirmNewPickupTime {\n about \"Confirm a new pickup time and add it to the calendar\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n calendar Bays \"Bays\"\n trigger when new row r in Jobs\n\n if r.promised < now() + 12 hours {\n notify owner \"Short-notice pickup time for {r.owner_name} at {r.promised}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your pickup time with the shop is confirmed for {r.promised}.\"\n let ok = request approval of m from owner timeout 1 day else stop \"confirmation not approved\"\n send ok\n let ev = book Bays { title: \"{r.owner_name}\", at: r.promised, length: 30 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00701", "domain": "autorepair", "pattern": "confirm_new", "batch": false, "sop": "When a new pickup time is added to Jobs: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (i need to ok every message), put it on the Bays calendar for 30 minutes, and mark it confirmed. Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, estimate, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow calendar Bays\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\ncalendar Bays \"Bays\"", "program": "procedure AutorepairConfirmNewPickupTime {\n about \"Confirm a new pickup time and add it to the calendar\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n calendar Bays \"Bays\"\n trigger when new row r in Jobs\n\n if r.promised < now() + 24 hours {\n notify owner \"Short-notice pickup time for {r.owner_name} at {r.promised}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your pickup time with the shop is confirmed for {r.promised}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Bays { title: \"{r.owner_name}\", at: r.promised, length: 30 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00702", "domain": "autorepair", "pattern": "confirm_new", "batch": false, "sop": "When a new pickup time is added to Jobs: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (i need to ok every message), put it on the Bays calendar for 45 minutes, and mark it confirmed. Keep the VIN out of the message.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, estimate)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 08:00 and 18:00\n allow calendar Bays\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\ncalendar Bays \"Bays\"", "program": "procedure AutorepairConfirmNewPickupTime {\n about \"Confirm a new pickup time and add it to the calendar\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n calendar Bays \"Bays\"\n trigger when new row r in Jobs\n\n if r.promised < now() + 12 hours {\n notify owner \"Short-notice pickup time for {r.owner_name} at {r.promised}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your pickup time with the shop is confirmed for {r.promised}.\"\n let ok = request approval of m from owner timeout 1 day else stop \"confirmation not approved\"\n send ok\n let ev = book Bays { title: \"{r.owner_name}\", at: r.promised, length: 45 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00703", "domain": "autorepair", "pattern": "confirm_new", "batch": false, "sop": "When a new pickup time is added to Jobs: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (i want to approve each message first), put it on the Bays calendar for 90 minutes, and mark it confirmed. Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, estimate, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 08:00 and 20:00\n allow calendar Bays\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\ncalendar Bays \"Bays\"", "program": "procedure AutorepairConfirmNewPickupTime {\n about \"Confirm a new pickup time and add it to the calendar\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n calendar Bays \"Bays\"\n trigger when new row r in Jobs\n\n if r.promised < now() + 24 hours {\n notify owner \"Short-notice pickup time for {r.owner_name} at {r.promised}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner_name}, your pickup time with the shop is confirmed for {r.promised}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Bays { title: \"{r.owner_name}\", at: r.promised, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-00704", "domain": "autorepair", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, status)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger when new row r in Jobs\n\n let first = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Jobs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner_name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00705", "domain": "autorepair", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, status)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger when new row r in Jobs\n\n let first = draft sms to r.phone: \"Hi {r.owner_name}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Jobs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner_name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00706", "domain": "autorepair", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Keep the VIN out of the message.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, status)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger when new row r in Jobs\n\n let first = draft sms to r.phone: \"Hi {r.owner_name}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Jobs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner_name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00707", "domain": "autorepair", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger when new row r in Jobs\n\n let first = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Jobs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner_name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00708", "domain": "autorepair", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger when new row r in Jobs\n\n let first = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Jobs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner_name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00709", "domain": "autorepair", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger when new row r in Jobs\n\n let first = draft sms to r.phone: \"Hi {r.owner_name}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Jobs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner_name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00710", "domain": "autorepair", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger when new row r in Jobs\n\n let first = draft sms to r.phone: \"Hi {r.owner_name}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Jobs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner_name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00711", "domain": "autorepair", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Keep the VIN out of the message. No more than 50.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 50 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00712", "domain": "autorepair", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Never include their VIN. No more than 50.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00713", "domain": "autorepair", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Never include their VIN. No more than 100.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00714", "domain": "autorepair", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Never include their VIN. No more than 100.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00715", "domain": "autorepair", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Don't mention the VIN. No more than 50.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00716", "domain": "autorepair", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Keep the VIN out of the message. No more than 100.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00717", "domain": "autorepair", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Don't mention the VIN. No more than 100.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00718", "domain": "autorepair", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Don't mention the VIN. No more than 50.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.owner_name default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00719", "domain": "autorepair", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Keep the VIN out of the message. No more than 50.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.owner_name default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00720", "domain": "autorepair", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Keep the VIN out of the message. No more than 100.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.owner_name default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00721", "domain": "autorepair", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Keep the VIN out of the message. No more than 50.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.owner_name default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00722", "domain": "autorepair", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Don't mention the VIN. No more than 100.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.owner_name default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00723", "domain": "autorepair", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Keep the VIN out of the message. No more than 50.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.owner_name}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00724", "domain": "autorepair", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Never include their VIN. No more than 100.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.owner_name default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00725", "domain": "autorepair", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Keep the VIN out of the message. No more than 50.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.owner_name default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00726", "domain": "bakery", "pattern": "reminder", "batch": false, "sop": "Daily at 8:30am, find every customer in the CakeOrders sheet whose pickup date is in two days and whose status is \"new\". Send each one a email reminder. Let me check the messages before they go out. Then mark them notified. Don't mention the home address. At most 50 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 08:30\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 2 days and status == \"new\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your pickup date in two days\": \"Hi {r.customer default 'there'}, a reminder from the bakery: your pickup date is in two days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00727", "domain": "bakery", "pattern": "reminder", "batch": false, "sop": "Every day at 5:30pm, find every customer in the CakeOrders sheet whose pickup date is in two days and whose status is \"new\". Send each one a email reminder. I want to approve each message first. Keep the home address out of the message. At most 20 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 17:30\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 2 days and status == \"new\"\n for each r in due up to 20 {\n let m = draft email to r.email subject \"Your pickup date in two days\": \"Hi {r.customer default 'there'}, a reminder from the bakery: your pickup date is in two days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00728", "domain": "bakery", "pattern": "reminder", "batch": false, "sop": "Every Thursday at 4pm, find every customer in the CakeOrders sheet whose pickup date is in three days and whose status is \"new\". Send each one a email reminder. Show me the messages for approval first. Never include their home address. At most 50 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every thursday at 16:00\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 3 days and status == \"new\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your pickup date in three days\": \"Hi {r.customer}, a reminder from the bakery: your pickup date is in three days.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00729", "domain": "bakery", "pattern": "reminder", "batch": false, "sop": "Every day at 4pm, find every customer in the CakeOrders sheet whose pickup date is tomorrow and whose status is \"new\". Send each one a email reminder. I need to OK every message. Then mark them reminded. Never include their home address. At most 100 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 16:00\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 1 day and status == \"new\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your pickup date tomorrow\": \"Hi {r.customer}, a reminder from the bakery: your pickup date is tomorrow.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00730", "domain": "bakery", "pattern": "reminder", "batch": false, "sop": "Every Tuesday at 10am, find every customer in the CakeOrders sheet whose pickup date is in two days and whose status is \"new\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Never include their home address. At most 20 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every tuesday at 10:00\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 2 days and status == \"new\"\n for each r in due up to 20 {\n let m = draft email to r.email subject \"Your pickup date in two days\": \"Hi {r.customer default 'there'}, a reminder from the bakery: your pickup date is in two days.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00731", "domain": "bakery", "pattern": "reminder", "batch": false, "sop": "On Fridays at 5:30pm, find every customer in the CakeOrders sheet whose pickup date is in three days and whose status is \"new\". Send each one a email reminder. I need to OK every message. Never include their home address. At most 100 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every friday at 17:30\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 3 days and status == \"new\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your pickup date in three days\": \"Hi {r.customer}, a reminder from the bakery: your pickup date is in three days.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00732", "domain": "bakery", "pattern": "reminder", "batch": false, "sop": "Every Friday at 8am, find every customer in the CakeOrders sheet whose pickup date is in a week and whose status is \"new\". Send each one a email reminder. Show me the messages for approval first. Then mark them reminded. Never include their home address. At most 100 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every friday at 08:00\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 7 days and status == \"new\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your pickup date in a week\": \"Hi {r.customer}, a reminder from the bakery: your pickup date is in a week.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00733", "domain": "bakery", "pattern": "reminder", "batch": true, "sop": "Each day at 4pm, find every customer in the CakeOrders sheet whose pickup date is in a week and whose status is \"new\". Send each one a email reminder. I want to approve each message first. Then mark them reminded. Don't mention the home address. At most 100 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 100 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 16:00\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 7 days and status == \"new\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your pickup date in a week\": \"Hi {r.customer}, a reminder from the bakery: your pickup date is in a week.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00734", "domain": "bakery", "pattern": "reminder", "batch": true, "sop": "Daily at 9am, find every customer in the CakeOrders sheet whose pickup date is in a week and whose status is \"new\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them notified. Don't mention the home address. At most 20 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 09:00\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 7 days and status == \"new\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your pickup date in a week\": \"Hi {r.customer default 'there'}, a reminder from the bakery: your pickup date is in a week.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00735", "domain": "bakery", "pattern": "reminder", "batch": true, "sop": "Every day at 8:30am, find every customer in the CakeOrders sheet whose pickup date is in three days and whose status is \"new\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Never include their home address. At most 20 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 08:30\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 3 days and status == \"new\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your pickup date in three days\": \"Hi {r.customer}, a reminder from the bakery: your pickup date is in three days.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00736", "domain": "bakery", "pattern": "reminder", "batch": true, "sop": "Each Monday at 8am, find every customer in the CakeOrders sheet whose pickup date is in a week and whose status is \"new\". Send each one a email reminder. Nothing goes out until I've approved it. Never include their home address. At most 30 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every monday at 08:00\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 7 days and status == \"new\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your pickup date in a week\": \"Hi {r.customer default 'there'}, a reminder from the bakery: your pickup date is in a week.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00737", "domain": "bakery", "pattern": "reminder", "batch": true, "sop": "Each Monday at 6pm, find every customer in the CakeOrders sheet whose pickup date is in a week and whose status is \"new\". Send each one a email reminder. Nothing goes out until I've approved it. Never include their home address. At most 20 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every monday at 18:00\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 7 days and status == \"new\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your pickup date in a week\": \"Hi {r.customer default 'there'}, a reminder from the bakery: your pickup date is in a week.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00738", "domain": "bakery", "pattern": "reminder", "batch": true, "sop": "Every Wednesday at 4pm, find every customer in the CakeOrders sheet whose pickup date is tomorrow and whose status is \"new\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them notified. Never include their home address. At most 30 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every wednesday at 16:00\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 1 day and status == \"new\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your pickup date tomorrow\": \"Hi {r.customer}, a reminder from the bakery: your pickup date is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00739", "domain": "bakery", "pattern": "reminder", "batch": true, "sop": "Each Wednesday at 6pm, find every customer in the CakeOrders sheet whose pickup date is in two days and whose status is \"new\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Never include their home address. At most 30 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every wednesday at 18:00\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 2 days and status == \"new\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your pickup date in two days\": \"Hi {r.customer default 'there'}, a reminder from the bakery: your pickup date is in two days.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00740", "domain": "bakery", "pattern": "reminder", "batch": true, "sop": "Daily at 9am, find every customer in the CakeOrders sheet whose pickup date is in two days and whose status is \"new\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them notified. Don't mention the home address. At most 20 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 09:00\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 2 days and status == \"new\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your pickup date in two days\": \"Hi {r.customer default 'there'}, a reminder from the bakery: your pickup date is in two days.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00741", "domain": "bakery", "pattern": "followup", "batch": false, "sop": "Every day at 9am, look for customers marked \"ready\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 09:00\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 3 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00742", "domain": "bakery", "pattern": "followup", "batch": false, "sop": "On Tuesdays at 8am, look for customers marked \"ready\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every tuesday at 08:00\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 3 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00743", "domain": "bakery", "pattern": "followup", "batch": false, "sop": "Each morning at 8am, look for customers marked \"ready\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the home address out of the message.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 08:00\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 1 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00744", "domain": "bakery", "pattern": "followup", "batch": false, "sop": "Each Tuesday at 5:30pm, look for customers marked \"ready\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every tuesday at 17:30\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 1 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00745", "domain": "bakery", "pattern": "followup", "batch": false, "sop": "On Mondays at 8am, look for customers marked \"ready\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every monday at 08:00\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 2 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00746", "domain": "bakery", "pattern": "followup", "batch": false, "sop": "Daily at 5:30pm, look for customers marked \"ready\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 17:30\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 1 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00747", "domain": "bakery", "pattern": "followup", "batch": false, "sop": "Each day at 5:30pm, look for customers marked \"ready\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 17:30\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 1 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00748", "domain": "bakery", "pattern": "followup", "batch": true, "sop": "Every Thursday at 9am, look for customers marked \"ready\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Keep the home address out of the message.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 40 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every thursday at 09:00\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 2 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00749", "domain": "bakery", "pattern": "followup", "batch": true, "sop": "On Mondays at 5:30pm, look for customers marked \"ready\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every monday at 17:30\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 1 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00750", "domain": "bakery", "pattern": "followup", "batch": true, "sop": "Each Monday at 5:30pm, look for customers marked \"ready\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every monday at 17:30\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 2 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00751", "domain": "bakery", "pattern": "followup", "batch": true, "sop": "Every Tuesday at 6pm, look for customers marked \"ready\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 3 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00752", "domain": "bakery", "pattern": "followup", "batch": true, "sop": "Each Monday at 5:30pm, look for customers marked \"ready\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every monday at 17:30\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 1 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00753", "domain": "bakery", "pattern": "followup", "batch": true, "sop": "Every day at 10am, look for customers marked \"ready\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 10:00\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 2 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00754", "domain": "bakery", "pattern": "followup", "batch": true, "sop": "Each day at 6pm, look for customers marked \"ready\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 18:00\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 1 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00755", "domain": "bakery", "pattern": "followup", "batch": true, "sop": "Each Friday at 10am, look for customers marked \"ready\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every friday at 10:00\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 2 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00756", "domain": "bakery", "pattern": "lapsed", "batch": false, "sop": "Daily at 11am, find customers whose pickup was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 11:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by pickup first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00757", "domain": "bakery", "pattern": "lapsed", "batch": false, "sop": "Every day at 11am, find customers whose pickup was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 11:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by pickup first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00758", "domain": "bakery", "pattern": "lapsed", "batch": false, "sop": "Each day at 4pm, find customers whose pickup was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 16:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by pickup first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00759", "domain": "bakery", "pattern": "lapsed", "batch": false, "sop": "Every day at 9am, find customers whose pickup was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 09:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by pickup first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00760", "domain": "bakery", "pattern": "lapsed", "batch": false, "sop": "Each morning at 10am, find customers whose pickup was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the home address out of the message.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 10:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by pickup first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00761", "domain": "bakery", "pattern": "lapsed", "batch": false, "sop": "Each day at 4pm, find customers whose pickup was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Keep the home address out of the message.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 16:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by pickup first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00762", "domain": "bakery", "pattern": "lapsed", "batch": false, "sop": "Every day at 8am, find customers whose pickup was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 08:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by pickup first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00763", "domain": "bakery", "pattern": "lapsed", "batch": false, "sop": "On Mondays at 10am, find customers whose pickup was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the home address out of the message.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every monday at 10:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by pickup first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00764", "domain": "bakery", "pattern": "lapsed", "batch": true, "sop": "Each Monday at 9am, find customers whose pickup was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Show me the messages for approval first. Keep the home address out of the message.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 10 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every monday at 09:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by pickup first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00765", "domain": "bakery", "pattern": "lapsed", "batch": true, "sop": "Daily at 10am, find customers whose pickup was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 10:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by pickup first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00766", "domain": "bakery", "pattern": "lapsed", "batch": true, "sop": "Every Thursday at 8am, find customers whose pickup was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Keep the home address out of the message.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every thursday at 08:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by pickup first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00767", "domain": "bakery", "pattern": "lapsed", "batch": true, "sop": "Daily at 11am, find customers whose pickup was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 11:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by pickup first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00768", "domain": "bakery", "pattern": "lapsed", "batch": true, "sop": "Each Wednesday at 11am, find customers whose pickup was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 10 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every wednesday at 11:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by pickup first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00769", "domain": "bakery", "pattern": "lapsed", "batch": true, "sop": "Each Wednesday at 10am, find customers whose pickup was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by pickup first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00770", "domain": "bakery", "pattern": "lapsed", "batch": true, "sop": "Each day at 4pm, find customers whose pickup was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 16:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by pickup first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00771", "domain": "bakery", "pattern": "lapsed", "batch": true, "sop": "Every Friday at 10am, find customers whose pickup was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the home address out of the message.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryWinBack {\n about \"Nudge customers whose pickup date was long ago\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every friday at 10:00\n\n let all = fetch CakeOrders\n let old = filter all where days_between(pickup, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by pickup first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the bakery.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00772", "domain": "bakery", "pattern": "summary", "batch": false, "sop": "Every Tuesday at 6pm, count the customers in CakeOrders whose status is \"ready\", and send the numbers to me only. Don't message any customers.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(status, price, customer, email)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch CakeOrders\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n notify owner \"Ready customers today: {n}\"\n}"} {"id": "train-00773", "domain": "bakery", "pattern": "summary", "batch": false, "sop": "Each morning at 8:30am, count the customers in CakeOrders whose status is \"ready\" and the total price, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(status, price, customer, email, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 08:30\n\n let all = fetch CakeOrders\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n let total = summarize sum price of these\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers: {n}, total price: {total}\"\n}"} {"id": "train-00774", "domain": "bakery", "pattern": "summary", "batch": false, "sop": "Every day at 9am, count the customers in CakeOrders whose status is \"new\" and the total price, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(status, price, customer, email, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryDailySummary {\n about \"Tell the owner how many customers are new\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 09:00\n\n let all = fetch CakeOrders\n let these = filter all where status == \"new\"\n let n = summarize count of these\n let total = summarize sum price of these\n if n == 0 {\n stop \"no new customers\"\n }\n notify owner \"New customers: {n}, total price: {total}\"\n}"} {"id": "train-00775", "domain": "bakery", "pattern": "summary", "batch": false, "sop": "Each Friday at 11am, count the customers in CakeOrders whose status is \"confirmed\", and send the numbers to me only. Don't message any customers.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(status, price, customer, email)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryDailySummary {\n about \"Tell the owner how many customers are confirmed\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every friday at 11:00\n\n let all = fetch CakeOrders\n let these = filter all where status == \"confirmed\"\n let n = summarize count of these\n notify owner \"Confirmed customers today: {n}\"\n}"} {"id": "train-00776", "domain": "bakery", "pattern": "summary", "batch": false, "sop": "Each Monday at 9am, count the customers in CakeOrders whose status is \"confirmed\" and the total price, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(status, price, customer, email)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryDailySummary {\n about \"Tell the owner how many customers are confirmed\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every monday at 09:00\n\n let all = fetch CakeOrders\n let these = filter all where status == \"confirmed\"\n let n = summarize count of these\n let total = summarize sum price of these\n if n == 0 {\n stop \"no confirmed customers\"\n }\n notify owner \"Confirmed customers: {n}, total price: {total}\"\n}"} {"id": "train-00777", "domain": "bakery", "pattern": "summary", "batch": false, "sop": "Each day at 5:30pm, count the customers in CakeOrders whose status is \"confirmed\", and send the numbers to me only. Don't message any customers.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(status, price, customer, email, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryDailySummary {\n about \"Tell the owner how many customers are confirmed\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 17:30\n\n let all = fetch CakeOrders\n let these = filter all where status == \"confirmed\"\n let n = summarize count of these\n notify owner \"Confirmed customers today: {n}\"\n}"} {"id": "train-00778", "domain": "bakery", "pattern": "summary", "batch": false, "sop": "Each morning at 11am, count the customers in CakeOrders whose status is \"ready\", and send the numbers to me only. Don't message any customers.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(status, price, customer, email)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 11:00\n\n let all = fetch CakeOrders\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n notify owner \"Ready customers today: {n}\"\n}"} {"id": "train-00779", "domain": "bakery", "pattern": "summary", "batch": false, "sop": "Each morning at 8am, count the customers in CakeOrders whose status is \"new\", and send the numbers to me only. Don't message any customers.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(status, price, customer, email)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryDailySummary {\n about \"Tell the owner how many customers are new\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 08:00\n\n let all = fetch CakeOrders\n let these = filter all where status == \"new\"\n let n = summarize count of these\n notify owner \"New customers today: {n}\"\n}"} {"id": "train-00780", "domain": "bakery", "pattern": "reorder", "batch": false, "sop": "Each day at 4pm, check Ingredients. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy BakeryStockPolicy {\n allow read Ingredients(ingredient, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Ingredients.supplier\n limit order $250 per action\n limit order $1250 per day\n}", "sheets": "sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BakeryReorder {\n about \"Reorder ingredients below their minimum\"\n policy BakeryStockPolicy\n sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 16:00\n\n let all = fetch Ingredients\n let low = filter all where on_hand < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $250.00 {\n notify owner \"Reorder of {i.ingredient} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.ingredient}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.ingredient}\"\n }\n}"} {"id": "train-00781", "domain": "bakery", "pattern": "reorder", "batch": false, "sop": "Daily at 8am, check Ingredients. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $200 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy BakeryStockPolicy {\n allow read Ingredients(ingredient, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Ingredients.supplier\n limit order $200 per action\n limit order $800 per day\n}", "sheets": "sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BakeryReorder {\n about \"Reorder ingredients below their minimum\"\n policy BakeryStockPolicy\n sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 08:00\n\n let all = fetch Ingredients\n let low = filter all where on_hand < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $200.00 {\n notify owner \"Reorder of {i.ingredient} would cost {cost}, over the $200 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.ingredient}\" from i.supplier cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.ingredient}\"\n }\n}"} {"id": "train-00782", "domain": "bakery", "pattern": "reorder", "batch": false, "sop": "Daily at 9am, check Ingredients. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy BakeryStockPolicy {\n allow read Ingredients(ingredient, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Ingredients.supplier\n limit order $100 per action\n limit order $300 per day\n}", "sheets": "sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BakeryReorder {\n about \"Reorder ingredients below their minimum\"\n policy BakeryStockPolicy\n sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 09:00\n\n let all = fetch Ingredients\n let low = filter all where on_hand < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.ingredient} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.ingredient}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.ingredient}\"\n }\n}"} {"id": "train-00783", "domain": "bakery", "pattern": "reorder", "batch": false, "sop": "Every Tuesday at 6pm, check Ingredients. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 2 items per run.", "policy": "policy BakeryStockPolicy {\n allow read Ingredients(ingredient, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Ingredients.supplier\n limit order $250 per action\n limit order $500 per day\n}", "sheets": "sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BakeryReorder {\n about \"Reorder ingredients below their minimum\"\n policy BakeryStockPolicy\n sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every tuesday at 18:00\n\n let all = fetch Ingredients\n let low = filter all where on_hand < minimum\n for each i in low up to 2 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $250.00 {\n notify owner \"Reorder of {i.ingredient} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.ingredient}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.ingredient}\"\n }\n}"} {"id": "train-00784", "domain": "bakery", "pattern": "reorder", "batch": false, "sop": "Daily at 4pm, check Ingredients. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $200 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy BakeryStockPolicy {\n allow read Ingredients(ingredient, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Ingredients.supplier\n limit order $200 per action\n limit order $1000 per day\n}", "sheets": "sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BakeryReorder {\n about \"Reorder ingredients below their minimum\"\n policy BakeryStockPolicy\n sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 16:00\n\n let all = fetch Ingredients\n let low = filter all where on_hand < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $200.00 {\n notify owner \"Reorder of {i.ingredient} would cost {cost}, over the $200 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.ingredient}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.ingredient}\"\n }\n}"} {"id": "train-00785", "domain": "bakery", "pattern": "reorder", "batch": false, "sop": "Each Friday at 11am, check Ingredients. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy BakeryStockPolicy {\n allow read Ingredients(ingredient, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Ingredients.supplier\n limit order $100 per action\n limit order $400 per day\n}", "sheets": "sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BakeryReorder {\n about \"Reorder ingredients below their minimum\"\n policy BakeryStockPolicy\n sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every friday at 11:00\n\n let all = fetch Ingredients\n let low = filter all where on_hand < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.ingredient} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.ingredient}\" from i.supplier cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.ingredient}\"\n }\n}"} {"id": "train-00786", "domain": "bakery", "pattern": "reorder", "batch": false, "sop": "On Thursdays at 11am, check Ingredients. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy BakeryStockPolicy {\n allow read Ingredients(ingredient, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Ingredients.supplier\n limit order $150 per action\n limit order $600 per day\n}", "sheets": "sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BakeryReorder {\n about \"Reorder ingredients below their minimum\"\n policy BakeryStockPolicy\n sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every thursday at 11:00\n\n let all = fetch Ingredients\n let low = filter all where on_hand < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.ingredient} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.ingredient}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.ingredient}\"\n }\n}"} {"id": "train-00787", "domain": "bakery", "pattern": "reorder", "batch": false, "sop": "Every day at 9am, check Ingredients. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $200 on one order; if it would cost more, just tell me. Handle at most 2 items per run.", "policy": "policy BakeryStockPolicy {\n allow read Ingredients(ingredient, on_hand, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Ingredients.supplier\n limit order $200 per action\n limit order $400 per day\n}", "sheets": "sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BakeryReorder {\n about \"Reorder ingredients below their minimum\"\n policy BakeryStockPolicy\n sheet Ingredients \"Ingredients\" { ingredient: Text, on_hand: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 09:00\n\n let all = fetch Ingredients\n let low = filter all where on_hand < minimum\n for each i in low up to 2 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $200.00 {\n notify owner \"Reorder of {i.ingredient} would cost {cost}, over the $200 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.ingredient}\" from i.supplier cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.ingredient}\"\n }\n}"} {"id": "train-00788", "domain": "bakery", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BakeryRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $300 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BakeryRefunds {\n about \"Handle refund requests within limits\"\n policy BakeryRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00789", "domain": "bakery", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $50, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BakeryRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $150 per day\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BakeryRefunds {\n about \"Handle refund requests within limits\"\n policy BakeryRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00790", "domain": "bakery", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BakeryRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $240 per day\n limit sends 30 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BakeryRefunds {\n about \"Handle refund requests within limits\"\n policy BakeryRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00791", "domain": "bakery", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $50, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BakeryRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $150 per day\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BakeryRefunds {\n about \"Handle refund requests within limits\"\n policy BakeryRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00792", "domain": "bakery", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BakeryRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $240 per day\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BakeryRefunds {\n about \"Handle refund requests within limits\"\n policy BakeryRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00793", "domain": "bakery", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BakeryRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $375 per day\n refund without approval up to $20\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BakeryRefunds {\n about \"Handle refund requests within limits\"\n policy BakeryRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00794", "domain": "bakery", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to CakeOrders, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"confirmed\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger when new row r in CakeOrders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the bakery! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch CakeOrders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"confirmed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00795", "domain": "bakery", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to CakeOrders, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"confirmed\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger when new row r in CakeOrders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the bakery! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch CakeOrders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"confirmed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00796", "domain": "bakery", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to CakeOrders, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"confirmed\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger when new row r in CakeOrders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the bakery! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch CakeOrders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"confirmed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00797", "domain": "bakery", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to CakeOrders, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"confirmed\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Keep the home address out of the message.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger when new row r in CakeOrders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the bakery! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch CakeOrders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"confirmed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00798", "domain": "bakery", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to CakeOrders, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"confirmed\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger when new row r in CakeOrders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the bakery! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch CakeOrders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"confirmed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00799", "domain": "bakery", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to CakeOrders, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"confirmed\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger when new row r in CakeOrders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the bakery! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch CakeOrders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"confirmed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00800", "domain": "bakery", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to CakeOrders, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"confirmed\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Never include their home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger when new row r in CakeOrders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the bakery! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch CakeOrders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"confirmed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00801", "domain": "bakery", "pattern": "escalation", "batch": false, "sop": "Daily at 5:30pm: for customers with a price above zero whose pickup date passed more than 3 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 14 days late, don't message them; tell me so I can call. Keep the home address out of the message. At most 20 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, price, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 17:30\n\n let all = fetch CakeOrders\n let late = filter all where price > $0.00 and days_between(pickup, today()) > 3\n for each r in late up to 20 {\n if days_between(r.pickup, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.price}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a price of {r.price}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00802", "domain": "bakery", "pattern": "escalation", "batch": false, "sop": "Each morning at 9am: for customers with a price above zero whose pickup date passed more than 7 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 21 days late, don't message them; tell me so I can call. Keep the home address out of the message. At most 40 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, price, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 09:00\n\n let all = fetch CakeOrders\n let late = filter all where price > $0.00 and days_between(pickup, today()) > 7\n for each r in late up to 40 {\n if days_between(r.pickup, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.price}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a price of {r.price}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00803", "domain": "bakery", "pattern": "escalation", "batch": false, "sop": "On Thursdays at 4pm: for customers with a price above zero whose pickup date passed more than 7 days ago, send a polite reminder with the amount. Show me the messages for approval first. If it's more than 21 days late, don't message them; tell me so I can call. Never include their home address. At most 20 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, price, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every thursday at 16:00\n\n let all = fetch CakeOrders\n let late = filter all where price > $0.00 and days_between(pickup, today()) > 7\n for each r in late up to 20 {\n if days_between(r.pickup, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.price}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a price of {r.price}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00804", "domain": "bakery", "pattern": "escalation", "batch": false, "sop": "On Fridays at 11am: for customers with a price above zero whose pickup date passed more than 5 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 30 days late, don't message them; tell me so I can call. Never include their home address. At most 30 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, price)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every friday at 11:00\n\n let all = fetch CakeOrders\n let late = filter all where price > $0.00 and days_between(pickup, today()) > 5\n for each r in late up to 30 {\n if days_between(r.pickup, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.price}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a price of {r.price}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00805", "domain": "bakery", "pattern": "escalation", "batch": false, "sop": "Each morning at 8:30am: for customers with a price above zero whose pickup date passed more than 7 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 21 days late, don't message them; tell me so I can call. Never include their home address. At most 30 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, price)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 08:30\n\n let all = fetch CakeOrders\n let late = filter all where price > $0.00 and days_between(pickup, today()) > 7\n for each r in late up to 30 {\n if days_between(r.pickup, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.price}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a price of {r.price}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00806", "domain": "bakery", "pattern": "escalation", "batch": false, "sop": "Daily at 8:30am: for customers with a price above zero whose pickup date passed more than 5 days ago, send a polite reminder with the amount. Show me the messages for approval first. If it's more than 30 days late, don't message them; tell me so I can call. Never include their home address. At most 30 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, price, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 08:30\n\n let all = fetch CakeOrders\n let late = filter all where price > $0.00 and days_between(pickup, today()) > 5\n for each r in late up to 30 {\n if days_between(r.pickup, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.price}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a price of {r.price}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00807", "domain": "bakery", "pattern": "escalation", "batch": false, "sop": "Each morning at 8:30am: for customers with a price above zero whose pickup date passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 30 days late, don't message them; tell me so I can call. Keep the home address out of the message. At most 20 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, price, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 08:30\n\n let all = fetch CakeOrders\n let late = filter all where price > $0.00 and days_between(pickup, today()) > 5\n for each r in late up to 20 {\n if days_between(r.pickup, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.price}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a price of {r.price}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00808", "domain": "bakery", "pattern": "escalation", "batch": false, "sop": "Every Monday at 8am: for customers with a price above zero whose pickup date passed more than 5 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 30 days late, don't message them; tell me so I can call. Never include their home address. At most 20 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, price)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every monday at 08:00\n\n let all = fetch CakeOrders\n let late = filter all where price > $0.00 and days_between(pickup, today()) > 5\n for each r in late up to 20 {\n if days_between(r.pickup, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.price}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a price of {r.price}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-00809", "domain": "bakery", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Keep the home address out of the message. No more than 100.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the bakery! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00810", "domain": "bakery", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Keep the home address out of the message. No more than 50.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the bakery! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00811", "domain": "bakery", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Never include their home address. No more than 50.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the bakery! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00812", "domain": "bakery", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Don't mention the home address. No more than 50.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the bakery! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00813", "domain": "bakery", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Keep the home address out of the message. No more than 50.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the bakery! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00814", "domain": "bakery", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Never include their home address. No more than 50.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the bakery! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00815", "domain": "bakery", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Never include their home address. No more than 50.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the bakery! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00816", "domain": "bakery", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Don't mention the home address. No more than 100.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the bakery! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00817", "domain": "bakery", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Don't mention the home address. No more than 50.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the bakery! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00818", "domain": "bakery", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Keep the home address out of the message. No more than 100.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the bakery! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00819", "domain": "bakery", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Keep the home address out of the message. No more than 50.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the bakery! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00820", "domain": "bakery", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Keep the home address out of the message. No more than 50.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the bakery! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00821", "domain": "bakery", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Don't mention the home address. No more than 100.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the bakery! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00822", "domain": "bakery", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Keep the home address out of the message. No more than 100.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the bakery! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00823", "domain": "bakery", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Never include their home address. No more than 50.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the bakery! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00824", "domain": "bakery", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose pickup was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Keep the home address out of the message. No more than 50.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BakeryOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch CakeOrders\n let targets = filter all where status == \"cancelled\" and days_between(pickup, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the bakery! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00825", "domain": "landscaping", "pattern": "reminder", "batch": false, "sop": "Every day at 9am, find every customer in the Quotes sheet whose quote is in a week and whose status is \"draft\". Send each one a email reminder. Let me check the messages before they go out. Never include their gate code. At most 50 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 7 days and status == \"draft\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your quote in a week\": \"Hi {r.customer}, a reminder from the company: your quote is in a week.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00826", "domain": "landscaping", "pattern": "reminder", "batch": false, "sop": "Every day at 9am, find every customer in the Quotes sheet whose quote is tomorrow and whose status is \"draft\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Don't mention the gate code. At most 100 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 1 day and status == \"draft\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your quote tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the company: your quote is tomorrow.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00827", "domain": "landscaping", "pattern": "reminder", "batch": false, "sop": "On Thursdays at 8am, find every customer in the Quotes sheet whose quote is in a week and whose status is \"draft\". Send each one a email reminder. I want to approve each message first. Then mark them reminded. Never include their gate code. At most 100 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every thursday at 08:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 7 days and status == \"draft\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your quote in a week\": \"Hi {r.customer default 'there'}, a reminder from the company: your quote is in a week.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00828", "domain": "landscaping", "pattern": "reminder", "batch": false, "sop": "Daily at 11am, find every customer in the Quotes sheet whose quote is in a week and whose status is \"draft\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Keep the gate code out of the message. At most 100 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 11:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 7 days and status == \"draft\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your quote in a week\": \"Hi {r.customer default 'there'}, a reminder from the company: your quote is in a week.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00829", "domain": "landscaping", "pattern": "reminder", "batch": false, "sop": "On Wednesdays at 4pm, find every customer in the Quotes sheet whose quote is in three days and whose status is \"draft\". Send each one a email reminder. Let me check the messages before they go out. Then mark them notified. Keep the gate code out of the message. At most 30 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every wednesday at 16:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 3 days and status == \"draft\"\n for each r in due up to 30 {\n let m = draft email to r.email subject \"Your quote in three days\": \"Hi {r.customer}, a reminder from the company: your quote is in three days.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00830", "domain": "landscaping", "pattern": "reminder", "batch": false, "sop": "Every day at 5:30pm, find every customer in the Quotes sheet whose quote is in two days and whose status is \"draft\". Send each one a email reminder. I need to OK every message. Then mark them notified. Keep the gate code out of the message. At most 50 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 2 days and status == \"draft\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your quote in two days\": \"Hi {r.customer default 'there'}, a reminder from the company: your quote is in two days.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00831", "domain": "landscaping", "pattern": "reminder", "batch": false, "sop": "Every day at 4pm, find every customer in the Quotes sheet whose quote is in a week and whose status is \"draft\". Send each one a email reminder. Let me check the messages before they go out. Don't mention the gate code. At most 100 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 7 days and status == \"draft\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your quote in a week\": \"Hi {r.customer default 'there'}, a reminder from the company: your quote is in a week.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00832", "domain": "landscaping", "pattern": "reminder", "batch": true, "sop": "Every day at 4pm, find every customer in the Quotes sheet whose quote is in two days and whose status is \"draft\". Send each one a email reminder. Let me check the messages before they go out. Don't mention the gate code. At most 50 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 50 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 2 days and status == \"draft\"\n let msgs = draft each r in due up to 50 email to r.email subject \"Your quote in two days\": \"Hi {r.customer}, a reminder from the company: your quote is in two days.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00833", "domain": "landscaping", "pattern": "reminder", "batch": true, "sop": "Daily at 6pm, find every customer in the Quotes sheet whose quote is tomorrow and whose status is \"draft\". Send each one a email reminder. Show me the messages for approval first. Then mark them reminded. Keep the gate code out of the message. At most 30 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 18:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 1 day and status == \"draft\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your quote tomorrow\": \"Hi {r.customer}, a reminder from the company: your quote is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00834", "domain": "landscaping", "pattern": "reminder", "batch": true, "sop": "Each morning at 9am, find every customer in the Quotes sheet whose quote is tomorrow and whose status is \"draft\". Send each one a email reminder. I want to approve each message first. Keep the gate code out of the message. At most 100 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 1 day and status == \"draft\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your quote tomorrow\": \"Hi {r.customer}, a reminder from the company: your quote is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00835", "domain": "landscaping", "pattern": "reminder", "batch": true, "sop": "Daily at 4pm, find every customer in the Quotes sheet whose quote is in a week and whose status is \"draft\". Send each one a email reminder. Let me check the messages before they go out. Then mark them reminded. Keep the gate code out of the message. At most 20 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 7 days and status == \"draft\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your quote in a week\": \"Hi {r.customer default 'there'}, a reminder from the company: your quote is in a week.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00836", "domain": "landscaping", "pattern": "reminder", "batch": true, "sop": "Every Wednesday at 9am, find every customer in the Quotes sheet whose quote is tomorrow and whose status is \"draft\". Send each one a email reminder. I need to OK every message. Then mark them notified. Don't mention the gate code. At most 30 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every wednesday at 09:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 1 day and status == \"draft\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your quote tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the company: your quote is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00837", "domain": "landscaping", "pattern": "reminder", "batch": true, "sop": "Every day at 9am, find every customer in the Quotes sheet whose quote is in a week and whose status is \"draft\". Send each one a email reminder. I need to OK every message. Never include their gate code. At most 50 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 7 days and status == \"draft\"\n let msgs = draft each r in due up to 50 email to r.email subject \"Your quote in a week\": \"Hi {r.customer default 'there'}, a reminder from the company: your quote is in a week.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00838", "domain": "landscaping", "pattern": "reminder", "batch": true, "sop": "Daily at 9am, find every customer in the Quotes sheet whose quote is tomorrow and whose status is \"draft\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them reminded. Never include their gate code. At most 30 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 1 day and status == \"draft\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your quote tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the company: your quote is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00839", "domain": "landscaping", "pattern": "reminder", "batch": true, "sop": "Every day at 5:30pm, find every customer in the Quotes sheet whose quote is in two days and whose status is \"draft\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them reminded. Never include their gate code. At most 100 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 2 days and status == \"draft\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your quote in two days\": \"Hi {r.customer}, a reminder from the company: your quote is in two days.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00840", "domain": "landscaping", "pattern": "followup", "batch": false, "sop": "Every day at 8am, look for customers marked \"accepted\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 3 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00841", "domain": "landscaping", "pattern": "followup", "batch": false, "sop": "Daily at 5:30pm, look for customers marked \"accepted\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 3 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00842", "domain": "landscaping", "pattern": "followup", "batch": false, "sop": "Daily at 8am, look for customers marked \"accepted\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 3 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00843", "domain": "landscaping", "pattern": "followup", "batch": false, "sop": "Every day at 9am, look for customers marked \"accepted\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 2 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00844", "domain": "landscaping", "pattern": "followup", "batch": false, "sop": "Daily at 8:30am, look for customers marked \"accepted\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the gate code out of the message.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 7 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00845", "domain": "landscaping", "pattern": "followup", "batch": false, "sop": "Each morning at 8am, look for customers marked \"accepted\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Don't mention the gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 7 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00846", "domain": "landscaping", "pattern": "followup", "batch": false, "sop": "Each morning at 10am, look for customers marked \"accepted\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Keep the gate code out of the message.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 10:00\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 1 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00847", "domain": "landscaping", "pattern": "followup", "batch": true, "sop": "Each morning at 9am, look for customers marked \"accepted\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 40 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 3 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00848", "domain": "landscaping", "pattern": "followup", "batch": true, "sop": "Every day at 5:30pm, look for customers marked \"accepted\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 3 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00849", "domain": "landscaping", "pattern": "followup", "batch": true, "sop": "Every day at 9am, look for customers marked \"accepted\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 1 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00850", "domain": "landscaping", "pattern": "followup", "batch": true, "sop": "Every day at 4pm, look for customers marked \"accepted\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 3 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00851", "domain": "landscaping", "pattern": "followup", "batch": true, "sop": "Every day at 5:30pm, look for customers marked \"accepted\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Keep the gate code out of the message.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 2 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00852", "domain": "landscaping", "pattern": "followup", "batch": true, "sop": "Each morning at 9am, look for customers marked \"accepted\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 7 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00853", "domain": "landscaping", "pattern": "followup", "batch": true, "sop": "Daily at 11am, look for customers marked \"accepted\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 11:00\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 7 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00854", "domain": "landscaping", "pattern": "lapsed", "batch": false, "sop": "Daily at 9am, find customers whose sent on was at least 30 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the gate code out of the message.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 30 and status != \"declined\"\n let oldest = sort old by sent_on first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the company.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00855", "domain": "landscaping", "pattern": "lapsed", "batch": false, "sop": "Each day at 6pm, find customers whose sent on was at least 90 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 18:00\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 90 and status != \"declined\"\n let oldest = sort old by sent_on first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the company.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00856", "domain": "landscaping", "pattern": "lapsed", "batch": false, "sop": "Daily at 11am, find customers whose sent on was at least 60 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Keep the gate code out of the message.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 11:00\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 60 and status != \"declined\"\n let oldest = sort old by sent_on first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the company.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00857", "domain": "landscaping", "pattern": "lapsed", "batch": false, "sop": "Daily at 6pm, find customers whose sent on was at least 60 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 18:00\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 60 and status != \"declined\"\n let oldest = sort old by sent_on first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the company.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00858", "domain": "landscaping", "pattern": "lapsed", "batch": false, "sop": "Each Tuesday at 8am, find customers whose sent on was at least 90 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Don't mention the gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every tuesday at 08:00\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 90 and status != \"declined\"\n let oldest = sort old by sent_on first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the company.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00859", "domain": "landscaping", "pattern": "lapsed", "batch": false, "sop": "Daily at 11am, find customers whose sent on was at least 42 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Keep the gate code out of the message.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 11:00\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 42 and status != \"declined\"\n let oldest = sort old by sent_on first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the company.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00860", "domain": "landscaping", "pattern": "lapsed", "batch": false, "sop": "Each morning at 8:30am, find customers whose sent on was at least 60 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 60 and status != \"declined\"\n let oldest = sort old by sent_on first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the company.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00861", "domain": "landscaping", "pattern": "lapsed", "batch": false, "sop": "Every Friday at 5:30pm, find customers whose sent on was at least 42 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every friday at 17:30\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 42 and status != \"declined\"\n let oldest = sort old by sent_on first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the company.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00862", "domain": "landscaping", "pattern": "lapsed", "batch": true, "sop": "Daily at 5:30pm, find customers whose sent on was at least 90 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 90 and status != \"declined\"\n let oldest = sort old by sent_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the company.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00863", "domain": "landscaping", "pattern": "lapsed", "batch": true, "sop": "Each day at 5:30pm, find customers whose sent on was at least 60 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Don't mention the gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 60 and status != \"declined\"\n let oldest = sort old by sent_on first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the company.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00864", "domain": "landscaping", "pattern": "lapsed", "batch": true, "sop": "Every day at 5:30pm, find customers whose sent on was at least 42 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Don't mention the gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 10 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 42 and status != \"declined\"\n let oldest = sort old by sent_on first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the company.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00865", "domain": "landscaping", "pattern": "lapsed", "batch": true, "sop": "On Wednesdays at 5:30pm, find customers whose sent on was at least 30 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the gate code out of the message.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every wednesday at 17:30\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 30 and status != \"declined\"\n let oldest = sort old by sent_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the company.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00866", "domain": "landscaping", "pattern": "lapsed", "batch": true, "sop": "Daily at 8:30am, find customers whose sent on was at least 60 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Don't mention the gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 60 and status != \"declined\"\n let oldest = sort old by sent_on first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the company.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00867", "domain": "landscaping", "pattern": "lapsed", "batch": true, "sop": "Every day at 9am, find customers whose sent on was at least 42 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 42 and status != \"declined\"\n let oldest = sort old by sent_on first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the company.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00868", "domain": "landscaping", "pattern": "lapsed", "batch": true, "sop": "On Thursdays at 10am, find customers whose sent on was at least 60 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 10 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 60 and status != \"declined\"\n let oldest = sort old by sent_on first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the company.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00869", "domain": "landscaping", "pattern": "lapsed", "batch": true, "sop": "Each Thursday at 11am, find customers whose sent on was at least 90 days ago, skipping anyone marked \"declined\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingWinBack {\n about \"Nudge customers whose quote was long ago\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Quotes\n let old = filter all where days_between(sent_on, today()) >= 90 and status != \"declined\"\n let oldest = sort old by sent_on first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the company.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00870", "domain": "landscaping", "pattern": "summary", "batch": false, "sop": "Each morning at 8am, count the customers in Quotes whose status is \"sent\", and send the numbers to me only. Don't message any customers.", "policy": "policy LandscapingPolicy {\n allow read Quotes(status, amount, customer, email)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingDailySummary {\n about \"Tell the owner how many customers are sent\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Quotes\n let these = filter all where status == \"sent\"\n let n = summarize count of these\n notify owner \"Sent customers today: {n}\"\n}"} {"id": "train-00871", "domain": "landscaping", "pattern": "summary", "batch": false, "sop": "Each Thursday at 4pm, count the customers in Quotes whose status is \"sent\" and the total quote amount, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy LandscapingPolicy {\n allow read Quotes(status, amount, customer, email)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingDailySummary {\n about \"Tell the owner how many customers are sent\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every thursday at 16:00\n\n let all = fetch Quotes\n let these = filter all where status == \"sent\"\n let n = summarize count of these\n let total = summarize sum amount of these\n if n == 0 {\n stop \"no sent customers\"\n }\n notify owner \"Sent customers: {n}, total amount: {total}\"\n}"} {"id": "train-00872", "domain": "landscaping", "pattern": "summary", "batch": false, "sop": "Each Friday at 6pm, count the customers in Quotes whose status is \"sent\", and send the numbers to me only. Don't message any customers.", "policy": "policy LandscapingPolicy {\n allow read Quotes(status, amount, customer, email, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingDailySummary {\n about \"Tell the owner how many customers are sent\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every friday at 18:00\n\n let all = fetch Quotes\n let these = filter all where status == \"sent\"\n let n = summarize count of these\n notify owner \"Sent customers today: {n}\"\n}"} {"id": "train-00873", "domain": "landscaping", "pattern": "summary", "batch": false, "sop": "Every day at 10am, count the customers in Quotes whose status is \"accepted\" and the total quote amount, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy LandscapingPolicy {\n allow read Quotes(status, amount, customer, email)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingDailySummary {\n about \"Tell the owner how many customers are accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 10:00\n\n let all = fetch Quotes\n let these = filter all where status == \"accepted\"\n let n = summarize count of these\n let total = summarize sum amount of these\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers: {n}, total amount: {total}\"\n}"} {"id": "train-00874", "domain": "landscaping", "pattern": "summary", "batch": false, "sop": "Every day at 4pm, count the customers in Quotes whose status is \"accepted\" and the total quote amount, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy LandscapingPolicy {\n allow read Quotes(status, amount, customer, email)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingDailySummary {\n about \"Tell the owner how many customers are accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Quotes\n let these = filter all where status == \"accepted\"\n let n = summarize count of these\n let total = summarize sum amount of these\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers: {n}, total amount: {total}\"\n}"} {"id": "train-00875", "domain": "landscaping", "pattern": "summary", "batch": false, "sop": "Every day at 11am, count the customers in Quotes whose status is \"draft\", and send the numbers to me only. Don't message any customers.", "policy": "policy LandscapingPolicy {\n allow read Quotes(status, amount, customer, email, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingDailySummary {\n about \"Tell the owner how many customers are draft\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 11:00\n\n let all = fetch Quotes\n let these = filter all where status == \"draft\"\n let n = summarize count of these\n notify owner \"Draft customers today: {n}\"\n}"} {"id": "train-00876", "domain": "landscaping", "pattern": "summary", "batch": false, "sop": "On Mondays at 8am, count the customers in Quotes whose status is \"sent\" and the total quote amount, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy LandscapingPolicy {\n allow read Quotes(status, amount, customer, email, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingDailySummary {\n about \"Tell the owner how many customers are sent\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every monday at 08:00\n\n let all = fetch Quotes\n let these = filter all where status == \"sent\"\n let n = summarize count of these\n let total = summarize sum amount of these\n if n == 0 {\n stop \"no sent customers\"\n }\n notify owner \"Sent customers: {n}, total amount: {total}\"\n}"} {"id": "train-00877", "domain": "landscaping", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy LandscapingRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $200 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure LandscapingRefunds {\n about \"Handle refund requests within limits\"\n policy LandscapingRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00878", "domain": "landscaping", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy LandscapingRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $120 per day\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure LandscapingRefunds {\n about \"Handle refund requests within limits\"\n policy LandscapingRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00879", "domain": "landscaping", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy LandscapingRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $225 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure LandscapingRefunds {\n about \"Handle refund requests within limits\"\n policy LandscapingRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00880", "domain": "landscaping", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy LandscapingRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $300 per day\n refund without approval up to $15\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure LandscapingRefunds {\n about \"Handle refund requests within limits\"\n policy LandscapingRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00881", "domain": "landscaping", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $75, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy LandscapingRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $450 per day\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure LandscapingRefunds {\n about \"Handle refund requests within limits\"\n policy LandscapingRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00882", "domain": "landscaping", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy LandscapingRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $150 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure LandscapingRefunds {\n about \"Handle refund requests within limits\"\n policy LandscapingRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00883", "domain": "landscaping", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy LandscapingRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $200 per day\n refund without approval up to $20\n limit sends 30 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure LandscapingRefunds {\n about \"Handle refund requests within limits\"\n policy LandscapingRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00884", "domain": "landscaping", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy LandscapingRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure LandscapingRefunds {\n about \"Handle refund requests within limits\"\n policy LandscapingRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00885", "domain": "landscaping", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Quotes, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"sent\" or \"declined\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Keep the gate code out of the message.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger when new row r in Quotes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the company! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Quotes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"sent\" or now_r.status == \"declined\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00886", "domain": "landscaping", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Quotes, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"sent\" or \"declined\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger when new row r in Quotes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the company! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Quotes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"sent\" or now_r.status == \"declined\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00887", "domain": "landscaping", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Quotes, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"sent\" or \"declined\", stop. Otherwise send one check-in message. Show me the messages for approval first. Keep the gate code out of the message.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger when new row r in Quotes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the company! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Quotes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"sent\" or now_r.status == \"declined\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00888", "domain": "landscaping", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Quotes, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"sent\" or \"declined\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger when new row r in Quotes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the company! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Quotes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"sent\" or now_r.status == \"declined\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00889", "domain": "landscaping", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Quotes, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"sent\" or \"declined\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger when new row r in Quotes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the company! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Quotes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"sent\" or now_r.status == \"declined\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00890", "domain": "landscaping", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Quotes, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"sent\" or \"declined\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Keep the gate code out of the message.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, status)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger when new row r in Quotes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the company! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Quotes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"sent\" or now_r.status == \"declined\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00891", "domain": "landscaping", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Quotes, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"sent\" or \"declined\", stop. Otherwise send one check-in message. I need to OK every message. Never include their gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger when new row r in Quotes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the company! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Quotes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"sent\" or now_r.status == \"declined\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00892", "domain": "landscaping", "pattern": "escalation", "batch": false, "sop": "Every day at 9am: for customers with a quote amount above zero whose quote passed more than 7 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 21 days late, don't message them; tell me so I can call. Don't mention the gate code. At most 40 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, amount, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let late = filter all where amount > $0.00 and days_between(sent_on, today()) > 7\n for each r in late up to 40 {\n if days_between(r.sent_on, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.amount}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a amount of {r.amount}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00893", "domain": "landscaping", "pattern": "escalation", "batch": false, "sop": "Every day at 9am: for customers with a quote amount above zero whose quote passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 14 days late, don't message them; tell me so I can call. Never include their gate code. At most 20 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, amount)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Quotes\n let late = filter all where amount > $0.00 and days_between(sent_on, today()) > 5\n for each r in late up to 20 {\n if days_between(r.sent_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.amount}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a amount of {r.amount}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00894", "domain": "landscaping", "pattern": "escalation", "batch": false, "sop": "Every Tuesday at 6pm: for customers with a quote amount above zero whose quote passed more than 3 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 14 days late, don't message them; tell me so I can call. Don't mention the gate code. At most 30 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, amount, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Quotes\n let late = filter all where amount > $0.00 and days_between(sent_on, today()) > 3\n for each r in late up to 30 {\n if days_between(r.sent_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.amount}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a amount of {r.amount}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-00895", "domain": "landscaping", "pattern": "escalation", "batch": false, "sop": "On Fridays at 9am: for customers with a quote amount above zero whose quote passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 14 days late, don't message them; tell me so I can call. Don't mention the gate code. At most 20 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, amount, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every friday at 09:00\n\n let all = fetch Quotes\n let late = filter all where amount > $0.00 and days_between(sent_on, today()) > 5\n for each r in late up to 20 {\n if days_between(r.sent_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.amount}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a amount of {r.amount}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00896", "domain": "landscaping", "pattern": "escalation", "batch": false, "sop": "Daily at 5:30pm: for customers with a quote amount above zero whose quote passed more than 3 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 14 days late, don't message them; tell me so I can call. Keep the gate code out of the message. At most 20 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, amount)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Quotes\n let late = filter all where amount > $0.00 and days_between(sent_on, today()) > 3\n for each r in late up to 20 {\n if days_between(r.sent_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.amount}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a amount of {r.amount}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00897", "domain": "landscaping", "pattern": "escalation", "batch": false, "sop": "On Thursdays at 6pm: for customers with a quote amount above zero whose quote passed more than 3 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 14 days late, don't message them; tell me so I can call. Keep the gate code out of the message. At most 40 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, amount)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every thursday at 18:00\n\n let all = fetch Quotes\n let late = filter all where amount > $0.00 and days_between(sent_on, today()) > 3\n for each r in late up to 40 {\n if days_between(r.sent_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.amount}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a amount of {r.amount}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00898", "domain": "landscaping", "pattern": "escalation", "batch": false, "sop": "Daily at 8:30am: for customers with a quote amount above zero whose quote passed more than 3 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 14 days late, don't message them; tell me so I can call. Don't mention the gate code. At most 30 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, amount)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Quotes\n let late = filter all where amount > $0.00 and days_between(sent_on, today()) > 3\n for each r in late up to 30 {\n if days_between(r.sent_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.amount}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a amount of {r.amount}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00899", "domain": "landscaping", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Keep the gate code out of the message. No more than 50.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the company! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00900", "domain": "landscaping", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Never include their gate code. No more than 100.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the company! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00901", "domain": "landscaping", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Keep the gate code out of the message. No more than 50.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the company! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00902", "domain": "landscaping", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Never include their gate code. No more than 50.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the company! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00903", "domain": "landscaping", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Never include their gate code. No more than 50.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the company! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00904", "domain": "landscaping", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Don't mention the gate code. No more than 50.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the company! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00905", "domain": "landscaping", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Keep the gate code out of the message. No more than 100.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the company! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00906", "domain": "landscaping", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Never include their gate code. No more than 50.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the company! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00907", "domain": "landscaping", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Keep the gate code out of the message. No more than 100.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the company! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00908", "domain": "landscaping", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Don't mention the gate code. No more than 50.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the company! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00909", "domain": "landscaping", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Don't mention the gate code. No more than 100.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the company! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00910", "domain": "landscaping", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Don't mention the gate code. No more than 100.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the company! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00911", "domain": "landscaping", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Don't mention the gate code. No more than 100.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the company! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00912", "domain": "landscaping", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Keep the gate code out of the message. No more than 50.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the company! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00913", "domain": "daycare", "pattern": "reminder", "batch": false, "sop": "Each morning at 8am, find every family in the Families sheet whose tuition due date is tomorrow and whose status is \"enrolled\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Never include their health notes. At most 100 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Families\n let due = filter all where due_date == today() + 1 day and status == \"enrolled\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your tuition due date tomorrow\": \"Hi {r.parent}, a reminder from the daycare: your tuition due date is tomorrow.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00914", "domain": "daycare", "pattern": "reminder", "batch": false, "sop": "Each morning at 8am, find every family in the Families sheet whose tuition due date is tomorrow and whose status is \"enrolled\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them reminded. Keep the health notes out of the message. At most 50 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Families\n let due = filter all where due_date == today() + 1 day and status == \"enrolled\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your tuition due date tomorrow\": \"Hi {r.parent}, a reminder from the daycare: your tuition due date is tomorrow.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00915", "domain": "daycare", "pattern": "reminder", "batch": false, "sop": "Each morning at 10am, find every family in the Families sheet whose tuition due date is in three days and whose status is \"enrolled\". Send each one a email reminder. I want to approve each message first. Don't mention the health notes. At most 50 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Families\n let due = filter all where due_date == today() + 3 days and status == \"enrolled\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your tuition due date in three days\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is in three days.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00916", "domain": "daycare", "pattern": "reminder", "batch": false, "sop": "Each morning at 10am, find every family in the Families sheet whose tuition due date is in two days and whose status is \"enrolled\". Send each one a email reminder. Show me the messages for approval first. Never include their health notes. At most 20 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Families\n let due = filter all where due_date == today() + 2 days and status == \"enrolled\"\n for each r in due up to 20 {\n let m = draft email to r.email subject \"Your tuition due date in two days\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is in two days.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00917", "domain": "daycare", "pattern": "reminder", "batch": false, "sop": "Each Monday at 11am, find every family in the Families sheet whose tuition due date is in three days and whose status is \"enrolled\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them notified. Keep the health notes out of the message. At most 100 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every monday at 11:00\n\n let all = fetch Families\n let due = filter all where due_date == today() + 3 days and status == \"enrolled\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your tuition due date in three days\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is in three days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00918", "domain": "daycare", "pattern": "reminder", "batch": false, "sop": "On Fridays at 4pm, find every family in the Families sheet whose tuition due date is in two days and whose status is \"enrolled\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Don't mention the health notes. At most 50 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every friday at 16:00\n\n let all = fetch Families\n let due = filter all where due_date == today() + 2 days and status == \"enrolled\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your tuition due date in two days\": \"Hi {r.parent}, a reminder from the daycare: your tuition due date is in two days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00919", "domain": "daycare", "pattern": "reminder", "batch": false, "sop": "On Thursdays at 5:30pm, find every family in the Families sheet whose tuition due date is in a week and whose status is \"enrolled\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Never include their health notes. At most 30 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Families\n let due = filter all where due_date == today() + 7 days and status == \"enrolled\"\n for each r in due up to 30 {\n let m = draft email to r.email subject \"Your tuition due date in a week\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is in a week.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00920", "domain": "daycare", "pattern": "reminder", "batch": false, "sop": "Every Wednesday at 4pm, find every family in the Families sheet whose tuition due date is in three days and whose status is \"enrolled\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them notified. Never include their health notes. At most 100 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every wednesday at 16:00\n\n let all = fetch Families\n let due = filter all where due_date == today() + 3 days and status == \"enrolled\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your tuition due date in three days\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is in three days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-00921", "domain": "daycare", "pattern": "reminder", "batch": true, "sop": "Daily at 8:30am, find every family in the Families sheet whose tuition due date is in a week and whose status is \"enrolled\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Never include their health notes. At most 20 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Families\n let due = filter all where due_date == today() + 7 days and status == \"enrolled\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your tuition due date in a week\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is in a week.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-00922", "domain": "daycare", "pattern": "reminder", "batch": true, "sop": "Each morning at 10am, find every family in the Families sheet whose tuition due date is in two days and whose status is \"enrolled\". Send each one a email reminder. I want to approve each message first. Then mark them reminded. Keep the health notes out of the message. At most 100 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Families\n let due = filter all where due_date == today() + 2 days and status == \"enrolled\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your tuition due date in two days\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is in two days.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-00923", "domain": "daycare", "pattern": "reminder", "batch": true, "sop": "Every Tuesday at 6pm, find every family in the Families sheet whose tuition due date is in a week and whose status is \"enrolled\". Send each one a email reminder. Show me the messages for approval first. Keep the health notes out of the message. At most 20 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Families\n let due = filter all where due_date == today() + 7 days and status == \"enrolled\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your tuition due date in a week\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is in a week.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00924", "domain": "daycare", "pattern": "reminder", "batch": true, "sop": "Each morning at 8:30am, find every family in the Families sheet whose tuition due date is in three days and whose status is \"enrolled\". Send each one a email reminder. Show me the messages for approval first. Keep the health notes out of the message. At most 100 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Families\n let due = filter all where due_date == today() + 3 days and status == \"enrolled\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your tuition due date in three days\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is in three days.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00925", "domain": "daycare", "pattern": "reminder", "batch": true, "sop": "Every Thursday at 11am, find every family in the Families sheet whose tuition due date is tomorrow and whose status is \"enrolled\". Send each one a email reminder. I need to OK every message. Never include their health notes. At most 20 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Families\n let due = filter all where due_date == today() + 1 day and status == \"enrolled\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your tuition due date tomorrow\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00926", "domain": "daycare", "pattern": "reminder", "batch": true, "sop": "Daily at 9am, find every family in the Families sheet whose tuition due date is in two days and whose status is \"enrolled\". Send each one a email reminder. I need to OK every message. Never include their health notes. At most 20 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Families\n let due = filter all where due_date == today() + 2 days and status == \"enrolled\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your tuition due date in two days\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is in two days.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00927", "domain": "daycare", "pattern": "reminder", "batch": true, "sop": "Daily at 4pm, find every family in the Families sheet whose tuition due date is in three days and whose status is \"enrolled\". Send each one a email reminder. Show me the messages for approval first. Never include their health notes. At most 100 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Families\n let due = filter all where due_date == today() + 3 days and status == \"enrolled\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your tuition due date in three days\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is in three days.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00928", "domain": "daycare", "pattern": "reminder", "batch": true, "sop": "On Fridays at 8:30am, find every family in the Families sheet whose tuition due date is in three days and whose status is \"enrolled\". Send each one a email reminder. I need to OK every message. Keep the health notes out of the message. At most 30 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareTuitionDueDateReminders {\n about \"Remind each family about their tuition due date\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every friday at 08:30\n\n let all = fetch Families\n let due = filter all where due_date == today() + 3 days and status == \"enrolled\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your tuition due date in three days\": \"Hi {r.parent default 'there'}, a reminder from the daycare: your tuition due date is in three days.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00929", "domain": "daycare", "pattern": "followup", "batch": false, "sop": "On Thursdays at 11am, look for familys marked \"withdrawn\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the health notes out of the message.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 7 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.parent}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00930", "domain": "daycare", "pattern": "followup", "batch": false, "sop": "Each Monday at 11am, look for familys marked \"withdrawn\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every monday at 11:00\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 7 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.parent default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00931", "domain": "daycare", "pattern": "followup", "batch": false, "sop": "Every day at 8am, look for familys marked \"withdrawn\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Keep the health notes out of the message.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 2 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.parent}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00932", "domain": "daycare", "pattern": "followup", "batch": false, "sop": "Each Wednesday at 5:30pm, look for familys marked \"withdrawn\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every wednesday at 17:30\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 3 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.parent default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00933", "domain": "daycare", "pattern": "followup", "batch": false, "sop": "Each Friday at 6pm, look for familys marked \"withdrawn\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Keep the health notes out of the message.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every friday at 18:00\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 1 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.parent default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00934", "domain": "daycare", "pattern": "followup", "batch": false, "sop": "Every day at 5:30pm, look for familys marked \"withdrawn\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 7 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.parent default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00935", "domain": "daycare", "pattern": "followup", "batch": false, "sop": "Each day at 5:30pm, look for familys marked \"withdrawn\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Keep the health notes out of the message.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 7 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.parent default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00936", "domain": "daycare", "pattern": "followup", "batch": true, "sop": "Each day at 4pm, look for familys marked \"withdrawn\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the health notes out of the message.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 2 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.parent}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00937", "domain": "daycare", "pattern": "followup", "batch": true, "sop": "Daily at 11am, look for familys marked \"withdrawn\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 2 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.parent}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00938", "domain": "daycare", "pattern": "followup", "batch": true, "sop": "Daily at 11am, look for familys marked \"withdrawn\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Keep the health notes out of the message.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 7 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.parent default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-00939", "domain": "daycare", "pattern": "followup", "batch": true, "sop": "Daily at 8:30am, look for familys marked \"withdrawn\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 7 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.parent}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00940", "domain": "daycare", "pattern": "followup", "batch": true, "sop": "Every day at 5:30pm, look for familys marked \"withdrawn\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 1 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.parent default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00941", "domain": "daycare", "pattern": "followup", "batch": true, "sop": "Each Monday at 9am, look for familys marked \"withdrawn\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every monday at 09:00\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 3 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.parent}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00942", "domain": "daycare", "pattern": "followup", "batch": true, "sop": "On Wednesdays at 6pm, look for familys marked \"withdrawn\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every wednesday at 18:00\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 3 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.parent}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00943", "domain": "daycare", "pattern": "followup", "batch": true, "sop": "Every day at 9am, look for familys marked \"withdrawn\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 1 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.parent}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-00944", "domain": "daycare", "pattern": "lapsed", "batch": false, "sop": "Each morning at 10am, find familys whose due date was at least 42 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 42 and status != \"paused\"\n let oldest = sort old by due_date first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.parent default 'there'}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00945", "domain": "daycare", "pattern": "lapsed", "batch": false, "sop": "Every Wednesday at 8:30am, find familys whose due date was at least 30 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every wednesday at 08:30\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 30 and status != \"paused\"\n let oldest = sort old by due_date first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.parent default 'there'}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00946", "domain": "daycare", "pattern": "lapsed", "batch": false, "sop": "On Thursdays at 4pm, find familys whose due date was at least 90 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every thursday at 16:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 90 and status != \"paused\"\n let oldest = sort old by due_date first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.parent}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00947", "domain": "daycare", "pattern": "lapsed", "batch": false, "sop": "Daily at 11am, find familys whose due date was at least 90 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 90 and status != \"paused\"\n let oldest = sort old by due_date first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.parent default 'there'}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00948", "domain": "daycare", "pattern": "lapsed", "batch": false, "sop": "Every Thursday at 5:30pm, find familys whose due date was at least 30 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Keep the health notes out of the message.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 30 and status != \"paused\"\n let oldest = sort old by due_date first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.parent default 'there'}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00949", "domain": "daycare", "pattern": "lapsed", "batch": false, "sop": "On Fridays at 10am, find familys whose due date was at least 42 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every friday at 10:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 42 and status != \"paused\"\n let oldest = sort old by due_date first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.parent default 'there'}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-00950", "domain": "daycare", "pattern": "lapsed", "batch": false, "sop": "Daily at 10am, find familys whose due date was at least 42 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 42 and status != \"paused\"\n let oldest = sort old by due_date first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.parent default 'there'}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00951", "domain": "daycare", "pattern": "lapsed", "batch": false, "sop": "On Thursdays at 11am, find familys whose due date was at least 30 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Keep the health notes out of the message.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 30 and status != \"paused\"\n let oldest = sort old by due_date first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.parent default 'there'}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00952", "domain": "daycare", "pattern": "lapsed", "batch": true, "sop": "Each morning at 11am, find familys whose due date was at least 90 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 90 and status != \"paused\"\n let oldest = sort old by due_date first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.parent}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00953", "domain": "daycare", "pattern": "lapsed", "batch": true, "sop": "Each day at 6pm, find familys whose due date was at least 60 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 10 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 60 and status != \"paused\"\n let oldest = sort old by due_date first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.parent}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00954", "domain": "daycare", "pattern": "lapsed", "batch": true, "sop": "Daily at 4pm, find familys whose due date was at least 60 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Keep the health notes out of the message.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 60 and status != \"paused\"\n let oldest = sort old by due_date first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.parent default 'there'}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00955", "domain": "daycare", "pattern": "lapsed", "batch": true, "sop": "Every day at 9am, find familys whose due date was at least 90 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 90 and status != \"paused\"\n let oldest = sort old by due_date first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.parent}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00956", "domain": "daycare", "pattern": "lapsed", "batch": true, "sop": "Each Thursday at 11am, find familys whose due date was at least 30 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 30 and status != \"paused\"\n let oldest = sort old by due_date first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.parent default 'there'}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00957", "domain": "daycare", "pattern": "lapsed", "batch": true, "sop": "Every day at 11am, find familys whose due date was at least 90 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 90 and status != \"paused\"\n let oldest = sort old by due_date first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.parent}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00958", "domain": "daycare", "pattern": "lapsed", "batch": true, "sop": "Each morning at 9am, find familys whose due date was at least 90 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 90 and status != \"paused\"\n let oldest = sort old by due_date first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.parent}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00959", "domain": "daycare", "pattern": "summary", "batch": false, "sop": "On Mondays at 6pm, count the familys in Families whose status is \"withdrawn\", and send the numbers to me only. Don't message any familys.", "policy": "policy DaycarePolicy {\n allow read Families(status, balance, parent, email, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareDailySummary {\n about \"Tell the owner how many familys are withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every monday at 18:00\n\n let all = fetch Families\n let these = filter all where status == \"withdrawn\"\n let n = summarize count of these\n notify owner \"Withdrawn familys today: {n}\"\n}"} {"id": "train-00960", "domain": "daycare", "pattern": "summary", "batch": false, "sop": "On Thursdays at 8:30am, count the familys in Families whose status is \"enrolled\" and the total balance, and send the numbers to me only. Don't message any familys. If there are none, don't bother me.", "policy": "policy DaycarePolicy {\n allow read Families(status, balance, parent, email)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareDailySummary {\n about \"Tell the owner how many familys are enrolled\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Families\n let these = filter all where status == \"enrolled\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no enrolled familys\"\n }\n notify owner \"Enrolled familys: {n}, total balance: {total}\"\n}"} {"id": "train-00961", "domain": "daycare", "pattern": "summary", "batch": false, "sop": "Every Wednesday at 8am, count the familys in Families whose status is \"enrolled\", and send the numbers to me only. Don't message any familys.", "policy": "policy DaycarePolicy {\n allow read Families(status, balance, parent, email)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareDailySummary {\n about \"Tell the owner how many familys are enrolled\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every wednesday at 08:00\n\n let all = fetch Families\n let these = filter all where status == \"enrolled\"\n let n = summarize count of these\n notify owner \"Enrolled familys today: {n}\"\n}"} {"id": "train-00962", "domain": "daycare", "pattern": "summary", "batch": false, "sop": "Each day at 4pm, count the familys in Families whose status is \"waitlist\", and send the numbers to me only. Don't message any familys.", "policy": "policy DaycarePolicy {\n allow read Families(status, balance, parent, email, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareDailySummary {\n about \"Tell the owner how many familys are waitlist\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Families\n let these = filter all where status == \"waitlist\"\n let n = summarize count of these\n notify owner \"Waitlist familys today: {n}\"\n}"} {"id": "train-00963", "domain": "daycare", "pattern": "summary", "batch": false, "sop": "Daily at 10am, count the familys in Families whose status is \"enrolled\", and send the numbers to me only. Don't message any familys.", "policy": "policy DaycarePolicy {\n allow read Families(status, balance, parent, email, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareDailySummary {\n about \"Tell the owner how many familys are enrolled\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Families\n let these = filter all where status == \"enrolled\"\n let n = summarize count of these\n notify owner \"Enrolled familys today: {n}\"\n}"} {"id": "train-00964", "domain": "daycare", "pattern": "summary", "batch": false, "sop": "Daily at 4pm, count the familys in Families whose status is \"waitlist\", and send the numbers to me only. Don't message any familys.", "policy": "policy DaycarePolicy {\n allow read Families(status, balance, parent, email, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareDailySummary {\n about \"Tell the owner how many familys are waitlist\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Families\n let these = filter all where status == \"waitlist\"\n let n = summarize count of these\n notify owner \"Waitlist familys today: {n}\"\n}"} {"id": "train-00965", "domain": "daycare", "pattern": "summary", "batch": false, "sop": "Daily at 8am, count the familys in Families whose status is \"enrolled\" and the total balance, and send the numbers to me only. Don't message any familys. If there are none, don't bother me.", "policy": "policy DaycarePolicy {\n allow read Families(status, balance, parent, email)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareDailySummary {\n about \"Tell the owner how many familys are enrolled\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Families\n let these = filter all where status == \"enrolled\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no enrolled familys\"\n }\n notify owner \"Enrolled familys: {n}, total balance: {total}\"\n}"} {"id": "train-00966", "domain": "daycare", "pattern": "summary", "batch": false, "sop": "On Wednesdays at 10am, count the familys in Families whose status is \"enrolled\", and send the numbers to me only. Don't message any familys.", "policy": "policy DaycarePolicy {\n allow read Families(status, balance, parent, email, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareDailySummary {\n about \"Tell the owner how many familys are enrolled\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Families\n let these = filter all where status == \"enrolled\"\n let n = summarize count of these\n notify owner \"Enrolled familys today: {n}\"\n}"} {"id": "train-00967", "domain": "daycare", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the family know (I approve that message too).", "policy": "policy DaycareRefundPolicy {\n allow read RefundRequests(request_id, parent, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $150 per day\n refund without approval up to $15\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure DaycareRefunds {\n about \"Handle refund requests within limits\"\n policy DaycareRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.parent default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00968", "domain": "daycare", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the family know (I approve that message too).", "policy": "policy DaycareRefundPolicy {\n allow read RefundRequests(request_id, parent, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure DaycareRefunds {\n about \"Handle refund requests within limits\"\n policy DaycareRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.parent}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00969", "domain": "daycare", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the family know (I approve that message too).", "policy": "policy DaycareRefundPolicy {\n allow read RefundRequests(request_id, parent, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $240 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure DaycareRefunds {\n about \"Handle refund requests within limits\"\n policy DaycareRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.parent}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00970", "domain": "daycare", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the family know (I approve that message too).", "policy": "policy DaycareRefundPolicy {\n allow read RefundRequests(request_id, parent, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure DaycareRefunds {\n about \"Handle refund requests within limits\"\n policy DaycareRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.parent default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00971", "domain": "daycare", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the family know (I approve that message too).", "policy": "policy DaycareRefundPolicy {\n allow read RefundRequests(request_id, parent, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $450 per day\n refund without approval up to $10\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure DaycareRefunds {\n about \"Handle refund requests within limits\"\n policy DaycareRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.parent default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00972", "domain": "daycare", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $75, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the family know (I approve that message too).", "policy": "policy DaycareRefundPolicy {\n allow read RefundRequests(request_id, parent, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $450 per day\n limit sends 30 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure DaycareRefunds {\n about \"Handle refund requests within limits\"\n policy DaycareRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.parent default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-00973", "domain": "daycare", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the family know (I approve that message too).", "policy": "policy DaycareRefundPolicy {\n allow read RefundRequests(request_id, parent, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $240 per day\n refund without approval up to $15\n limit sends 30 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure DaycareRefunds {\n about \"Handle refund requests within limits\"\n policy DaycareRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.parent default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-00974", "domain": "daycare", "pattern": "wait_followup", "batch": false, "sop": "When a new family is added to Families, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"waitlist\" or \"paused\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareFollowUpAfterWait {\n about \"Contact a new family, then follow up once\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger when new row r in Families\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.parent default 'there'}, thanks for choosing the daycare! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Families\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"waitlist\" or now_r.status == \"paused\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.parent}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00975", "domain": "daycare", "pattern": "wait_followup", "batch": false, "sop": "When a new family is added to Families, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"waitlist\" or \"paused\", stop. Otherwise send one check-in message. I need to OK every message. Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareFollowUpAfterWait {\n about \"Contact a new family, then follow up once\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger when new row r in Families\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.parent default 'there'}, thanks for choosing the daycare! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Families\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"waitlist\" or now_r.status == \"paused\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.parent default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00976", "domain": "daycare", "pattern": "wait_followup", "batch": false, "sop": "When a new family is added to Families, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"waitlist\" or \"paused\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareFollowUpAfterWait {\n about \"Contact a new family, then follow up once\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger when new row r in Families\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.parent}, thanks for choosing the daycare! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Families\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"waitlist\" or now_r.status == \"paused\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.parent default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00977", "domain": "daycare", "pattern": "wait_followup", "batch": false, "sop": "When a new family is added to Families, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"waitlist\" or \"paused\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareFollowUpAfterWait {\n about \"Contact a new family, then follow up once\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger when new row r in Families\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.parent default 'there'}, thanks for choosing the daycare! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Families\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"waitlist\" or now_r.status == \"paused\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.parent}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00978", "domain": "daycare", "pattern": "wait_followup", "batch": false, "sop": "When a new family is added to Families, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"waitlist\" or \"paused\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareFollowUpAfterWait {\n about \"Contact a new family, then follow up once\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger when new row r in Families\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.parent}, thanks for choosing the daycare! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Families\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"waitlist\" or now_r.status == \"paused\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.parent default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00979", "domain": "daycare", "pattern": "wait_followup", "batch": false, "sop": "When a new family is added to Families, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"waitlist\" or \"paused\", stop. Otherwise send one check-in message. I need to OK every message. Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareFollowUpAfterWait {\n about \"Contact a new family, then follow up once\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger when new row r in Families\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.parent}, thanks for choosing the daycare! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Families\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"waitlist\" or now_r.status == \"paused\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.parent default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-00980", "domain": "daycare", "pattern": "escalation", "batch": false, "sop": "Each morning at 9am: for familys with a balance above zero whose tuition due date passed more than 7 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 21 days late, don't message them; tell me so I can call. Don't mention the health notes. At most 30 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, balance)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareLateBalance {\n about \"Remind late familys; escalate very late ones\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Families\n let late = filter all where balance > $0.00 and days_between(due_date, today()) > 7\n for each r in late up to 30 {\n if days_between(r.due_date, today()) > 21 {\n notify owner \"{r.parent} is very late ({r.balance}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.parent default 'there'}, our records show a balance of {r.balance}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-00981", "domain": "daycare", "pattern": "escalation", "batch": false, "sop": "Each Monday at 5:30pm: for familys with a balance above zero whose tuition due date passed more than 5 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 14 days late, don't message them; tell me so I can call. Never include their health notes. At most 40 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, balance)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareLateBalance {\n about \"Remind late familys; escalate very late ones\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every monday at 17:30\n\n let all = fetch Families\n let late = filter all where balance > $0.00 and days_between(due_date, today()) > 5\n for each r in late up to 40 {\n if days_between(r.due_date, today()) > 14 {\n notify owner \"{r.parent} is very late ({r.balance}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.parent default 'there'}, our records show a balance of {r.balance}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-00982", "domain": "daycare", "pattern": "escalation", "batch": false, "sop": "Daily at 9am: for familys with a balance above zero whose tuition due date passed more than 5 days ago, send a polite reminder with the amount. Show me the messages for approval first. If it's more than 14 days late, don't message them; tell me so I can call. Keep the health notes out of the message. At most 40 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, balance, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareLateBalance {\n about \"Remind late familys; escalate very late ones\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Families\n let late = filter all where balance > $0.00 and days_between(due_date, today()) > 5\n for each r in late up to 40 {\n if days_between(r.due_date, today()) > 14 {\n notify owner \"{r.parent} is very late ({r.balance}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.parent default 'there'}, our records show a balance of {r.balance}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00983", "domain": "daycare", "pattern": "escalation", "batch": false, "sop": "Every Wednesday at 6pm: for familys with a balance above zero whose tuition due date passed more than 5 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 14 days late, don't message them; tell me so I can call. Never include their health notes. At most 20 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, balance, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareLateBalance {\n about \"Remind late familys; escalate very late ones\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every wednesday at 18:00\n\n let all = fetch Families\n let late = filter all where balance > $0.00 and days_between(due_date, today()) > 5\n for each r in late up to 20 {\n if days_between(r.due_date, today()) > 14 {\n notify owner \"{r.parent} is very late ({r.balance}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.parent}, our records show a balance of {r.balance}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00984", "domain": "daycare", "pattern": "escalation", "batch": false, "sop": "Every day at 6pm: for familys with a balance above zero whose tuition due date passed more than 7 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 21 days late, don't message them; tell me so I can call. Never include their health notes. At most 30 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, balance, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareLateBalance {\n about \"Remind late familys; escalate very late ones\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Families\n let late = filter all where balance > $0.00 and days_between(due_date, today()) > 7\n for each r in late up to 30 {\n if days_between(r.due_date, today()) > 21 {\n notify owner \"{r.parent} is very late ({r.balance}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.parent default 'there'}, our records show a balance of {r.balance}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00985", "domain": "daycare", "pattern": "escalation", "batch": false, "sop": "Each day at 4pm: for familys with a balance above zero whose tuition due date passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 30 days late, don't message them; tell me so I can call. Never include their health notes. At most 30 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, balance)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareLateBalance {\n about \"Remind late familys; escalate very late ones\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Families\n let late = filter all where balance > $0.00 and days_between(due_date, today()) > 5\n for each r in late up to 30 {\n if days_between(r.due_date, today()) > 30 {\n notify owner \"{r.parent} is very late ({r.balance}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.parent}, our records show a balance of {r.balance}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00986", "domain": "daycare", "pattern": "escalation", "batch": false, "sop": "Every Wednesday at 8:30am: for familys with a balance above zero whose tuition due date passed more than 3 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 14 days late, don't message them; tell me so I can call. Don't mention the health notes. At most 30 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, balance, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareLateBalance {\n about \"Remind late familys; escalate very late ones\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every wednesday at 08:30\n\n let all = fetch Families\n let late = filter all where balance > $0.00 and days_between(due_date, today()) > 3\n for each r in late up to 30 {\n if days_between(r.due_date, today()) > 14 {\n notify owner \"{r.parent} is very late ({r.balance}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.parent default 'there'}, our records show a balance of {r.balance}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00987", "domain": "daycare", "pattern": "escalation", "batch": false, "sop": "Every day at 8am: for familys with a balance above zero whose tuition due date passed more than 5 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 14 days late, don't message them; tell me so I can call. Keep the health notes out of the message. At most 40 per run.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, balance)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareLateBalance {\n about \"Remind late familys; escalate very late ones\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Families\n let late = filter all where balance > $0.00 and days_between(due_date, today()) > 5\n for each r in late up to 40 {\n if days_between(r.due_date, today()) > 14 {\n notify owner \"{r.parent} is very late ({r.balance}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.parent default 'there'}, our records show a balance of {r.balance}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-00988", "domain": "daycare", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Don't mention the health notes. No more than 100.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.parent}, come back to the daycare! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00989", "domain": "daycare", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Never include their health notes. No more than 50.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.parent default 'there'}, come back to the daycare! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00990", "domain": "daycare", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the health notes out of the message. No more than 100.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.parent}, come back to the daycare! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00991", "domain": "daycare", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Keep the health notes out of the message. No more than 50.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.parent}, come back to the daycare! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00992", "domain": "daycare", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Never include their health notes. No more than 100.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.parent}, come back to the daycare! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-00993", "domain": "daycare", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Never include their health notes. No more than 50.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.parent}, come back to the daycare! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-00994", "domain": "daycare", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Keep the health notes out of the message. No more than 100.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.parent}, come back to the daycare! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-00995", "domain": "daycare", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Don't mention the health notes. No more than 100.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.parent}, come back to the daycare! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00996", "domain": "daycare", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Keep the health notes out of the message. No more than 100.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.parent}, come back to the daycare! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00997", "domain": "daycare", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Don't mention the health notes. No more than 50.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.parent default 'there'}, come back to the daycare! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00998", "domain": "daycare", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Never include their health notes. No more than 50.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.parent default 'there'}, come back to the daycare! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-00999", "domain": "daycare", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Never include their health notes. No more than 50.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.parent default 'there'}, come back to the daycare! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01000", "domain": "daycare", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Keep the health notes out of the message. No more than 50.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.parent default 'there'}, come back to the daycare! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01001", "domain": "daycare", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the health notes out of the message. No more than 100.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.parent}, come back to the daycare! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01002", "domain": "cleaning", "pattern": "reminder", "batch": false, "sop": "Each morning at 11am, find every client in the Cleanings sheet whose cleaning is tomorrow and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Never include their door code. At most 20 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 11:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 1 day and status == \"booked\"\n for each r in due up to 20 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, a reminder from the service: your cleaning is tomorrow at {time_of(r.scheduled)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01003", "domain": "cleaning", "pattern": "reminder", "batch": false, "sop": "Every day at 9am, find every client in the Cleanings sheet whose cleaning is in two days and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Don't mention the door code. At most 30 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 2 days and status == \"booked\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, a reminder from the service: your cleaning is in two days at {time_of(r.scheduled)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01004", "domain": "cleaning", "pattern": "reminder", "batch": false, "sop": "Daily at 8:30am, find every client in the Cleanings sheet whose cleaning is tomorrow and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Keep the door code out of the message. At most 100 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 1 day and status == \"booked\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.client}, a reminder from the service: your cleaning is tomorrow at {time_of(r.scheduled)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01005", "domain": "cleaning", "pattern": "reminder", "batch": false, "sop": "Daily at 9am, find every client in the Cleanings sheet whose cleaning is in a week and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Don't mention the door code. At most 50 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 7 days and status == \"booked\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, a reminder from the service: your cleaning is in a week at {time_of(r.scheduled)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01006", "domain": "cleaning", "pattern": "reminder", "batch": false, "sop": "On Tuesdays at 5:30pm, find every client in the Cleanings sheet whose cleaning is in a week and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Then mark them reminded. Never include their door code. At most 30 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every tuesday at 17:30\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 7 days and status == \"booked\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, a reminder from the service: your cleaning is in a week at {time_of(r.scheduled)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01007", "domain": "cleaning", "pattern": "reminder", "batch": false, "sop": "Each morning at 9am, find every client in the Cleanings sheet whose cleaning is in two days and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Don't mention the door code. At most 50 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 2 days and status == \"booked\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, a reminder from the service: your cleaning is in two days at {time_of(r.scheduled)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01008", "domain": "cleaning", "pattern": "reminder", "batch": false, "sop": "Daily at 4pm, find every client in the Cleanings sheet whose cleaning is in a week and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Never include their door code. At most 30 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 7 days and status == \"booked\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.client}, a reminder from the service: your cleaning is in a week at {time_of(r.scheduled)}.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01009", "domain": "cleaning", "pattern": "reminder", "batch": false, "sop": "Each day at 4pm, find every client in the Cleanings sheet whose cleaning is tomorrow and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Then mark them notified. Keep the door code out of the message. At most 100 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 1 day and status == \"booked\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, a reminder from the service: your cleaning is tomorrow at {time_of(r.scheduled)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01010", "domain": "cleaning", "pattern": "reminder", "batch": true, "sop": "Every day at 9am, find every client in the Cleanings sheet whose cleaning is in three days and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Don't mention the door code. At most 30 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 3 days and status == \"booked\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.client default 'there'}, a reminder from the service: your cleaning is in three days at {time_of(r.scheduled)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01011", "domain": "cleaning", "pattern": "reminder", "batch": true, "sop": "On Wednesdays at 5:30pm, find every client in the Cleanings sheet whose cleaning is in two days and whose status is \"booked\". Send each one a text reminder. Nothing goes out until I've approved it. Never include their door code. At most 50 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 50 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every wednesday at 17:30\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 2 days and status == \"booked\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.client default 'there'}, a reminder from the service: your cleaning is in two days at {time_of(r.scheduled)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01012", "domain": "cleaning", "pattern": "reminder", "batch": true, "sop": "Each morning at 9am, find every client in the Cleanings sheet whose cleaning is in two days and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Then mark them reminded. Don't mention the door code. At most 50 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 50 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 2 days and status == \"booked\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.client}, a reminder from the service: your cleaning is in two days at {time_of(r.scheduled)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01013", "domain": "cleaning", "pattern": "reminder", "batch": true, "sop": "Daily at 11am, find every client in the Cleanings sheet whose cleaning is tomorrow and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Don't mention the door code. At most 50 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 50 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 11:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.client default 'there'}, a reminder from the service: your cleaning is tomorrow at {time_of(r.scheduled)}.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01014", "domain": "cleaning", "pattern": "reminder", "batch": true, "sop": "Each morning at 10am, find every client in the Cleanings sheet whose cleaning is in three days and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Don't mention the door code. At most 20 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 10:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 3 days and status == \"booked\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.client default 'there'}, a reminder from the service: your cleaning is in three days at {time_of(r.scheduled)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01015", "domain": "cleaning", "pattern": "reminder", "batch": true, "sop": "Each Thursday at 6pm, find every client in the Cleanings sheet whose cleaning is in two days and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Don't mention the door code. At most 30 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every thursday at 18:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 2 days and status == \"booked\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.client}, a reminder from the service: your cleaning is in two days at {time_of(r.scheduled)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01016", "domain": "cleaning", "pattern": "reminder", "batch": true, "sop": "Every day at 10am, find every client in the Cleanings sheet whose cleaning is in a week and whose status is \"booked\". Send each one a text reminder. Nothing goes out until I've approved it. Then mark them notified. Keep the door code out of the message. At most 100 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 10:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 7 days and status == \"booked\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.client default 'there'}, a reminder from the service: your cleaning is in a week at {time_of(r.scheduled)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01017", "domain": "cleaning", "pattern": "reminder", "batch": true, "sop": "Every Tuesday at 11am, find every client in the Cleanings sheet whose cleaning is in two days and whose status is \"booked\". Send each one a text reminder. Nothing goes out until I've approved it. Then mark them notified. Keep the door code out of the message. At most 50 per run.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 50 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningCleaningReminders {\n about \"Remind each client about their cleaning\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every tuesday at 11:00\n\n let all = fetch Cleanings\n let due = filter all where date_of(scheduled) == today() + 2 days and status == \"booked\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.client default 'there'}, a reminder from the service: your cleaning is in two days at {time_of(r.scheduled)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01018", "domain": "cleaning", "pattern": "followup", "batch": false, "sop": "Every day at 8am, look for clients marked \"skipped\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 3 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01019", "domain": "cleaning", "pattern": "followup", "batch": false, "sop": "Daily at 9am, look for clients marked \"skipped\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 7 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01020", "domain": "cleaning", "pattern": "followup", "batch": false, "sop": "Every day at 6pm, look for clients marked \"skipped\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 18:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 7 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01021", "domain": "cleaning", "pattern": "followup", "batch": false, "sop": "Each Monday at 4pm, look for clients marked \"skipped\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Don't mention the door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every monday at 16:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 3 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.client}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01022", "domain": "cleaning", "pattern": "followup", "batch": false, "sop": "Each day at 4pm, look for clients marked \"skipped\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 7 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01023", "domain": "cleaning", "pattern": "followup", "batch": false, "sop": "Each morning at 9am, look for clients marked \"skipped\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 1 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.client}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01024", "domain": "cleaning", "pattern": "followup", "batch": false, "sop": "On Mondays at 6pm, look for clients marked \"skipped\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every monday at 18:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 3 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01025", "domain": "cleaning", "pattern": "followup", "batch": true, "sop": "Each Monday at 11am, look for clients marked \"skipped\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every monday at 11:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 2 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.client default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01026", "domain": "cleaning", "pattern": "followup", "batch": true, "sop": "Daily at 5:30pm, look for clients marked \"skipped\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 1 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.client default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01027", "domain": "cleaning", "pattern": "followup", "batch": true, "sop": "Each Monday at 11am, look for clients marked \"skipped\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every monday at 11:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 3 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.client default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01028", "domain": "cleaning", "pattern": "followup", "batch": true, "sop": "Every day at 8am, look for clients marked \"skipped\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 3 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.client default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01029", "domain": "cleaning", "pattern": "followup", "batch": true, "sop": "Daily at 9am, look for clients marked \"skipped\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Don't mention the door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 40 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 1 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.client}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01030", "domain": "cleaning", "pattern": "followup", "batch": true, "sop": "On Thursdays at 8:30am, look for clients marked \"skipped\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 3 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.client default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01031", "domain": "cleaning", "pattern": "followup", "batch": true, "sop": "Every day at 11am, look for clients marked \"skipped\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 11:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 7 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.client default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01032", "domain": "cleaning", "pattern": "lapsed", "batch": false, "sop": "Each morning at 8am, find clients whose scheduled was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by scheduled first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, it's been a while! We'd love to see you again at the service.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01033", "domain": "cleaning", "pattern": "lapsed", "batch": false, "sop": "Every day at 10am, find clients whose scheduled was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 10:00\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by scheduled first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.client}, it's been a while! We'd love to see you again at the service.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01034", "domain": "cleaning", "pattern": "lapsed", "batch": false, "sop": "Daily at 8:30am, find clients whose scheduled was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by scheduled first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, it's been a while! We'd love to see you again at the service.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01035", "domain": "cleaning", "pattern": "lapsed", "batch": false, "sop": "Each Monday at 8:30am, find clients whose scheduled was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every monday at 08:30\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by scheduled first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.client}, it's been a while! We'd love to see you again at the service.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01036", "domain": "cleaning", "pattern": "lapsed", "batch": false, "sop": "Each day at 5:30pm, find clients whose scheduled was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by scheduled first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, it's been a while! We'd love to see you again at the service.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01037", "domain": "cleaning", "pattern": "lapsed", "batch": false, "sop": "Every Friday at 6pm, find clients whose scheduled was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Don't mention the door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every friday at 18:00\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by scheduled first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, it's been a while! We'd love to see you again at the service.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01038", "domain": "cleaning", "pattern": "lapsed", "batch": false, "sop": "Each morning at 8:30am, find clients whose scheduled was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by scheduled first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.client}, it's been a while! We'd love to see you again at the service.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01039", "domain": "cleaning", "pattern": "lapsed", "batch": false, "sop": "Each Wednesday at 11am, find clients whose scheduled was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every wednesday at 11:00\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by scheduled first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, it's been a while! We'd love to see you again at the service.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01040", "domain": "cleaning", "pattern": "lapsed", "batch": true, "sop": "On Fridays at 5:30pm, find clients whose scheduled was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every friday at 17:30\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by scheduled first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.client}, it's been a while! We'd love to see you again at the service.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01041", "domain": "cleaning", "pattern": "lapsed", "batch": true, "sop": "Daily at 8:30am, find clients whose scheduled was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by scheduled first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.client}, it's been a while! We'd love to see you again at the service.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01042", "domain": "cleaning", "pattern": "lapsed", "batch": true, "sop": "On Thursdays at 11am, find clients whose scheduled was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by scheduled first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.client}, it's been a while! We'd love to see you again at the service.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01043", "domain": "cleaning", "pattern": "lapsed", "batch": true, "sop": "Each morning at 10am, find clients whose scheduled was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 10:00\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by scheduled first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.client default 'there'}, it's been a while! We'd love to see you again at the service.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01044", "domain": "cleaning", "pattern": "lapsed", "batch": true, "sop": "Daily at 10am, find clients whose scheduled was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 10:00\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by scheduled first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.client default 'there'}, it's been a while! We'd love to see you again at the service.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01045", "domain": "cleaning", "pattern": "lapsed", "batch": true, "sop": "Each day at 5:30pm, find clients whose scheduled was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 10 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by scheduled first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.client default 'there'}, it's been a while! We'd love to see you again at the service.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01046", "domain": "cleaning", "pattern": "lapsed", "batch": true, "sop": "Daily at 6pm, find clients whose scheduled was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 18:00\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by scheduled first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.client default 'there'}, it's been a while! We'd love to see you again at the service.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01047", "domain": "cleaning", "pattern": "lapsed", "batch": true, "sop": "Daily at 10am, find clients whose scheduled was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningWinBack {\n about \"Nudge clients whose cleaning was long ago\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 10:00\n\n let all = fetch Cleanings\n let old = filter all where days_between(scheduled, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by scheduled first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.client}, it's been a while! We'd love to see you again at the service.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01048", "domain": "cleaning", "pattern": "summary", "batch": false, "sop": "Every day at 9am, count the clients in Cleanings whose status is \"done\" and the total fee, and send the numbers to me only. Don't message any clients. If there are none, don't bother me.", "policy": "policy CleaningPolicy {\n allow read Cleanings(status, fee, client, phone, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningDailySummary {\n about \"Tell the owner how many clients are done\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Cleanings\n let these = filter all where status == \"done\"\n let n = summarize count of these\n let total = summarize sum fee of these\n if n == 0 {\n stop \"no done clients\"\n }\n notify owner \"Done clients: {n}, total fee: {total}\"\n}"} {"id": "train-01049", "domain": "cleaning", "pattern": "summary", "batch": false, "sop": "Each morning at 8am, count the clients in Cleanings whose status is \"done\" and the total fee, and send the numbers to me only. Don't message any clients. If there are none, don't bother me.", "policy": "policy CleaningPolicy {\n allow read Cleanings(status, fee, client, phone)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningDailySummary {\n about \"Tell the owner how many clients are done\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Cleanings\n let these = filter all where status == \"done\"\n let n = summarize count of these\n let total = summarize sum fee of these\n if n == 0 {\n stop \"no done clients\"\n }\n notify owner \"Done clients: {n}, total fee: {total}\"\n}"} {"id": "train-01050", "domain": "cleaning", "pattern": "summary", "batch": false, "sop": "Every day at 11am, count the clients in Cleanings whose status is \"skipped\", and send the numbers to me only. Don't message any clients.", "policy": "policy CleaningPolicy {\n allow read Cleanings(status, fee, client, phone, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningDailySummary {\n about \"Tell the owner how many clients are skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 11:00\n\n let all = fetch Cleanings\n let these = filter all where status == \"skipped\"\n let n = summarize count of these\n notify owner \"Skipped clients today: {n}\"\n}"} {"id": "train-01051", "domain": "cleaning", "pattern": "summary", "batch": false, "sop": "Each Thursday at 11am, count the clients in Cleanings whose status is \"skipped\" and the total fee, and send the numbers to me only. Don't message any clients. If there are none, don't bother me.", "policy": "policy CleaningPolicy {\n allow read Cleanings(status, fee, client, phone, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningDailySummary {\n about \"Tell the owner how many clients are skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Cleanings\n let these = filter all where status == \"skipped\"\n let n = summarize count of these\n let total = summarize sum fee of these\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients: {n}, total fee: {total}\"\n}"} {"id": "train-01052", "domain": "cleaning", "pattern": "summary", "batch": false, "sop": "On Tuesdays at 5:30pm, count the clients in Cleanings whose status is \"skipped\" and the total fee, and send the numbers to me only. Don't message any clients. If there are none, don't bother me.", "policy": "policy CleaningPolicy {\n allow read Cleanings(status, fee, client, phone, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningDailySummary {\n about \"Tell the owner how many clients are skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every tuesday at 17:30\n\n let all = fetch Cleanings\n let these = filter all where status == \"skipped\"\n let n = summarize count of these\n let total = summarize sum fee of these\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients: {n}, total fee: {total}\"\n}"} {"id": "train-01053", "domain": "cleaning", "pattern": "summary", "batch": false, "sop": "Each morning at 8am, count the clients in Cleanings whose status is \"booked\", and send the numbers to me only. Don't message any clients.", "policy": "policy CleaningPolicy {\n allow read Cleanings(status, fee, client, phone)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningDailySummary {\n about \"Tell the owner how many clients are booked\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Cleanings\n let these = filter all where status == \"booked\"\n let n = summarize count of these\n notify owner \"Booked clients today: {n}\"\n}"} {"id": "train-01054", "domain": "cleaning", "pattern": "summary", "batch": false, "sop": "Each Monday at 8am, count the clients in Cleanings whose status is \"skipped\", and send the numbers to me only. Don't message any clients.", "policy": "policy CleaningPolicy {\n allow read Cleanings(status, fee, client, phone)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningDailySummary {\n about \"Tell the owner how many clients are skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every monday at 08:00\n\n let all = fetch Cleanings\n let these = filter all where status == \"skipped\"\n let n = summarize count of these\n notify owner \"Skipped clients today: {n}\"\n}"} {"id": "train-01055", "domain": "cleaning", "pattern": "reorder", "batch": false, "sop": "Each Monday at 8am, check Supplies. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy CleaningStockPolicy {\n allow read Supplies(supply, qty, minimum, reorder_qty, supplier, cost)\n allow supplier Supplies.supplier\n limit order $150 per action\n limit order $450 per day\n}", "sheets": "sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }", "program": "procedure CleaningReorder {\n about \"Reorder supplies below their minimum\"\n policy CleaningStockPolicy\n sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }\n trigger every monday at 08:00\n\n let all = fetch Supplies\n let low = filter all where qty < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.supply} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.supply}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.supply}\"\n }\n}"} {"id": "train-01056", "domain": "cleaning", "pattern": "reorder", "batch": false, "sop": "Daily at 11am, check Supplies. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy CleaningStockPolicy {\n allow read Supplies(supply, qty, minimum, reorder_qty, supplier, cost)\n allow supplier Supplies.supplier\n limit order $150 per action\n limit order $750 per day\n}", "sheets": "sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }", "program": "procedure CleaningReorder {\n about \"Reorder supplies below their minimum\"\n policy CleaningStockPolicy\n sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }\n trigger every day at 11:00\n\n let all = fetch Supplies\n let low = filter all where qty < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.supply} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.supply}\" from i.supplier cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.supply}\"\n }\n}"} {"id": "train-01057", "domain": "cleaning", "pattern": "reorder", "batch": false, "sop": "Daily at 8:30am, check Supplies. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy CleaningStockPolicy {\n allow read Supplies(supply, qty, minimum, reorder_qty, supplier, cost)\n allow supplier Supplies.supplier\n limit order $250 per action\n limit order $750 per day\n}", "sheets": "sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }", "program": "procedure CleaningReorder {\n about \"Reorder supplies below their minimum\"\n policy CleaningStockPolicy\n sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }\n trigger every day at 08:30\n\n let all = fetch Supplies\n let low = filter all where qty < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.cost\n if cost > $250.00 {\n notify owner \"Reorder of {i.supply} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.supply}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.supply}\"\n }\n}"} {"id": "train-01058", "domain": "cleaning", "pattern": "reorder", "batch": false, "sop": "Every day at 6pm, check Supplies. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy CleaningStockPolicy {\n allow read Supplies(supply, qty, minimum, reorder_qty, supplier, cost)\n allow supplier Supplies.supplier\n limit order $150 per action\n limit order $600 per day\n}", "sheets": "sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }", "program": "procedure CleaningReorder {\n about \"Reorder supplies below their minimum\"\n policy CleaningStockPolicy\n sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }\n trigger every day at 18:00\n\n let all = fetch Supplies\n let low = filter all where qty < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.supply} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.supply}\" from i.supplier cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.supply}\"\n }\n}"} {"id": "train-01059", "domain": "cleaning", "pattern": "reorder", "batch": false, "sop": "Each morning at 9am, check Supplies. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $200 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy CleaningStockPolicy {\n allow read Supplies(supply, qty, minimum, reorder_qty, supplier, cost)\n allow supplier Supplies.supplier\n limit order $200 per action\n limit order $800 per day\n}", "sheets": "sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }", "program": "procedure CleaningReorder {\n about \"Reorder supplies below their minimum\"\n policy CleaningStockPolicy\n sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }\n trigger every day at 09:00\n\n let all = fetch Supplies\n let low = filter all where qty < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.cost\n if cost > $200.00 {\n notify owner \"Reorder of {i.supply} would cost {cost}, over the $200 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.supply}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.supply}\"\n }\n}"} {"id": "train-01060", "domain": "cleaning", "pattern": "reorder", "batch": false, "sop": "Daily at 4pm, check Supplies. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy CleaningStockPolicy {\n allow read Supplies(supply, qty, minimum, reorder_qty, supplier, cost)\n allow supplier Supplies.supplier\n limit order $100 per action\n limit order $500 per day\n}", "sheets": "sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }", "program": "procedure CleaningReorder {\n about \"Reorder supplies below their minimum\"\n policy CleaningStockPolicy\n sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }\n trigger every day at 16:00\n\n let all = fetch Supplies\n let low = filter all where qty < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.supply} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.supply}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.supply}\"\n }\n}"} {"id": "train-01061", "domain": "cleaning", "pattern": "reorder", "batch": false, "sop": "Each day at 4pm, check Supplies. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy CleaningStockPolicy {\n allow read Supplies(supply, qty, minimum, reorder_qty, supplier, cost)\n allow supplier Supplies.supplier\n limit order $150 per action\n limit order $600 per day\n}", "sheets": "sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }", "program": "procedure CleaningReorder {\n about \"Reorder supplies below their minimum\"\n policy CleaningStockPolicy\n sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }\n trigger every day at 16:00\n\n let all = fetch Supplies\n let low = filter all where qty < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.supply} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.supply}\" from i.supplier cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.supply}\"\n }\n}"} {"id": "train-01062", "domain": "cleaning", "pattern": "reorder", "batch": false, "sop": "Each Monday at 10am, check Supplies. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy CleaningStockPolicy {\n allow read Supplies(supply, qty, minimum, reorder_qty, supplier, cost)\n allow supplier Supplies.supplier\n limit order $100 per action\n limit order $300 per day\n}", "sheets": "sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }", "program": "procedure CleaningReorder {\n about \"Reorder supplies below their minimum\"\n policy CleaningStockPolicy\n sheet Supplies \"Supplies\" { supply: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, cost: Money }\n trigger every monday at 10:00\n\n let all = fetch Supplies\n let low = filter all where qty < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.supply} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.supply}\" from i.supplier cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.supply}\"\n }\n}"} {"id": "train-01063", "domain": "cleaning", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy CleaningRefundPolicy {\n allow read RefundRequests(request_id, client, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $50 per action\n limit refund $150 per day\n refund without approval up to $10\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure CleaningRefunds {\n about \"Handle refund requests within limits\"\n policy CleaningRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01064", "domain": "cleaning", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy CleaningRefundPolicy {\n allow read RefundRequests(request_id, client, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $20\n limit sends 30 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure CleaningRefunds {\n about \"Handle refund requests within limits\"\n policy CleaningRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01065", "domain": "cleaning", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy CleaningRefundPolicy {\n allow read RefundRequests(request_id, client, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $50 per action\n limit refund $300 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure CleaningRefunds {\n about \"Handle refund requests within limits\"\n policy CleaningRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01066", "domain": "cleaning", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy CleaningRefundPolicy {\n allow read RefundRequests(request_id, client, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $500 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure CleaningRefunds {\n about \"Handle refund requests within limits\"\n policy CleaningRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01067", "domain": "cleaning", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy CleaningRefundPolicy {\n allow read RefundRequests(request_id, client, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $15\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure CleaningRefunds {\n about \"Handle refund requests within limits\"\n policy CleaningRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01068", "domain": "cleaning", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $75, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy CleaningRefundPolicy {\n allow read RefundRequests(request_id, client, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $75 per action\n limit refund $450 per day\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure CleaningRefunds {\n about \"Handle refund requests within limits\"\n policy CleaningRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01069", "domain": "cleaning", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy CleaningRefundPolicy {\n allow read RefundRequests(request_id, client, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $75 per action\n limit refund $450 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure CleaningRefunds {\n about \"Handle refund requests within limits\"\n policy CleaningRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01070", "domain": "cleaning", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the client know (I approve that message too).", "policy": "policy CleaningRefundPolicy {\n allow read RefundRequests(request_id, client, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $50 per action\n limit refund $150 per day\n refund without approval up to $10\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure CleaningRefunds {\n about \"Handle refund requests within limits\"\n policy CleaningRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, client: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01071", "domain": "cleaning", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Cleanings, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger when new row r in Cleanings\n\n let first = draft sms to r.phone: \"Hi {r.client default 'there'}, thanks for choosing the service! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Cleanings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.client default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01072", "domain": "cleaning", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Cleanings, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger when new row r in Cleanings\n\n let first = draft sms to r.phone: \"Hi {r.client}, thanks for choosing the service! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Cleanings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.client default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01073", "domain": "cleaning", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Cleanings, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger when new row r in Cleanings\n\n let first = draft sms to r.phone: \"Hi {r.client default 'there'}, thanks for choosing the service! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Cleanings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.client default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01074", "domain": "cleaning", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Cleanings, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger when new row r in Cleanings\n\n let first = draft sms to r.phone: \"Hi {r.client}, thanks for choosing the service! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Cleanings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.client default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01075", "domain": "cleaning", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Cleanings, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, status)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger when new row r in Cleanings\n\n let first = draft sms to r.phone: \"Hi {r.client}, thanks for choosing the service! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Cleanings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.client}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01076", "domain": "cleaning", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Cleanings, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger when new row r in Cleanings\n\n let first = draft sms to r.phone: \"Hi {r.client default 'there'}, thanks for choosing the service! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Cleanings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.client default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01077", "domain": "cleaning", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Cleanings, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Don't mention the door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger when new row r in Cleanings\n\n let first = draft sms to r.phone: \"Hi {r.client default 'there'}, thanks for choosing the service! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Cleanings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.client}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01078", "domain": "cleaning", "pattern": "wait_followup", "batch": false, "sop": "When a new client is added to Cleanings, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Keep the door code out of the message.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningFollowUpAfterWait {\n about \"Contact a new client, then follow up once\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger when new row r in Cleanings\n\n let first = draft sms to r.phone: \"Hi {r.client}, thanks for choosing the service! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Cleanings\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.client default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01079", "domain": "cleaning", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Never include their door code. No more than 50.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.client default 'there'}, come back to the service! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01080", "domain": "cleaning", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Never include their door code. No more than 100.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.client}, come back to the service! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01081", "domain": "cleaning", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Keep the door code out of the message. No more than 100.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.client}, come back to the service! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01082", "domain": "cleaning", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Keep the door code out of the message. No more than 100.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.client}, come back to the service! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01083", "domain": "cleaning", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Never include their door code. No more than 100.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.client}, come back to the service! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01084", "domain": "cleaning", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Don't mention the door code. No more than 50.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.client}, come back to the service! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01085", "domain": "cleaning", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Never include their door code. No more than 100.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.client}, come back to the service! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01086", "domain": "cleaning", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Never include their door code. No more than 100.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.client}, come back to the service! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01087", "domain": "cleaning", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Never include their door code. No more than 100.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.client}, come back to the service! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01088", "domain": "cleaning", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Don't mention the door code. No more than 50.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.client default 'there'}, come back to the service! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01089", "domain": "cleaning", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Never include their door code. No more than 100.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.client default 'there'}, come back to the service! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01090", "domain": "cleaning", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Don't mention the door code. No more than 50.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.client default 'there'}, come back to the service! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01091", "domain": "cleaning", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Keep the door code out of the message. No more than 50.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.client default 'there'}, come back to the service! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01092", "domain": "cleaning", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Never include their door code. No more than 100.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.client default 'there'}, come back to the service! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01093", "domain": "cleaning", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Never include their door code. No more than 50.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.client default 'there'}, come back to the service! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01094", "domain": "music", "pattern": "reminder", "batch": false, "sop": "Every day at 8:30am, find every student in the Lessons sheet whose lesson is tomorrow and whose status is \"scheduled\". Send each one a text reminder. I need to OK every message. Then mark them notified. Never include their progress notes. At most 100 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 1 day and status == \"scheduled\"\n for each r in due up to 100 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, a reminder from the school: your lesson is tomorrow at {time_of(r.lesson_at)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01095", "domain": "music", "pattern": "reminder", "batch": false, "sop": "Daily at 9am, find every student in the Lessons sheet whose lesson is tomorrow and whose status is \"scheduled\". Send each one a text reminder. I want to approve each message first. Never include their progress notes. At most 20 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 1 day and status == \"scheduled\"\n for each r in due up to 20 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, a reminder from the school: your lesson is tomorrow at {time_of(r.lesson_at)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01096", "domain": "music", "pattern": "reminder", "batch": false, "sop": "On Mondays at 8:30am, find every student in the Lessons sheet whose lesson is in a week and whose status is \"scheduled\". Send each one a text reminder. Let me check the messages before they go out. Never include their progress notes. At most 50 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every monday at 08:30\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 7 days and status == \"scheduled\"\n for each r in due up to 50 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, a reminder from the school: your lesson is in a week at {time_of(r.lesson_at)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01097", "domain": "music", "pattern": "reminder", "batch": false, "sop": "Each day at 6pm, find every student in the Lessons sheet whose lesson is in two days and whose status is \"scheduled\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Don't mention the progress notes. At most 30 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 2 days and status == \"scheduled\"\n for each r in due up to 30 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, a reminder from the school: your lesson is in two days at {time_of(r.lesson_at)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01098", "domain": "music", "pattern": "reminder", "batch": false, "sop": "Every day at 4pm, find every student in the Lessons sheet whose lesson is in a week and whose status is \"scheduled\". Send each one a text reminder. Nothing goes out until I've approved it. Then mark them notified. Don't mention the progress notes. At most 30 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 7 days and status == \"scheduled\"\n for each r in due up to 30 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, a reminder from the school: your lesson is in a week at {time_of(r.lesson_at)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01099", "domain": "music", "pattern": "reminder", "batch": false, "sop": "Each morning at 9am, find every student in the Lessons sheet whose lesson is tomorrow and whose status is \"scheduled\". Send each one a text reminder. Show me the messages for approval first. Then mark them reminded. Keep the progress notes out of the message. At most 20 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 1 day and status == \"scheduled\"\n for each r in due up to 20 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, a reminder from the school: your lesson is tomorrow at {time_of(r.lesson_at)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01100", "domain": "music", "pattern": "reminder", "batch": false, "sop": "On Tuesdays at 5:30pm, find every student in the Lessons sheet whose lesson is tomorrow and whose status is \"scheduled\". Send each one a text reminder. I want to approve each message first. Never include their progress notes. At most 100 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every tuesday at 17:30\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 1 day and status == \"scheduled\"\n for each r in due up to 100 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, a reminder from the school: your lesson is tomorrow at {time_of(r.lesson_at)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01101", "domain": "music", "pattern": "reminder", "batch": true, "sop": "Every day at 6pm, find every student in the Lessons sheet whose lesson is tomorrow and whose status is \"scheduled\". Send each one a text reminder. Show me the messages for approval first. Don't mention the progress notes. At most 20 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 1 day and status == \"scheduled\"\n let msgs = draft each r in due up to 20 sms to r.parent_phone: \"Hi {r.student default 'there'}, a reminder from the school: your lesson is tomorrow at {time_of(r.lesson_at)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01102", "domain": "music", "pattern": "reminder", "batch": true, "sop": "Each Monday at 8:30am, find every student in the Lessons sheet whose lesson is in three days and whose status is \"scheduled\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Don't mention the progress notes. At most 50 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 50 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every monday at 08:30\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 3 days and status == \"scheduled\"\n let msgs = draft each r in due up to 50 sms to r.parent_phone: \"Hi {r.student}, a reminder from the school: your lesson is in three days at {time_of(r.lesson_at)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01103", "domain": "music", "pattern": "reminder", "batch": true, "sop": "Each day at 6pm, find every student in the Lessons sheet whose lesson is in two days and whose status is \"scheduled\". Send each one a text reminder. Nothing goes out until I've approved it. Don't mention the progress notes. At most 30 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 2 days and status == \"scheduled\"\n let msgs = draft each r in due up to 30 sms to r.parent_phone: \"Hi {r.student default 'there'}, a reminder from the school: your lesson is in two days at {time_of(r.lesson_at)}.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01104", "domain": "music", "pattern": "reminder", "batch": true, "sop": "Each morning at 8:30am, find every student in the Lessons sheet whose lesson is tomorrow and whose status is \"scheduled\". Send each one a text reminder. I need to OK every message. Never include their progress notes. At most 20 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 1 day and status == \"scheduled\"\n let msgs = draft each r in due up to 20 sms to r.parent_phone: \"Hi {r.student}, a reminder from the school: your lesson is tomorrow at {time_of(r.lesson_at)}.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01105", "domain": "music", "pattern": "reminder", "batch": true, "sop": "Daily at 8am, find every student in the Lessons sheet whose lesson is tomorrow and whose status is \"scheduled\". Send each one a text reminder. I want to approve each message first. Don't mention the progress notes. At most 50 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 1 day and status == \"scheduled\"\n let msgs = draft each r in due up to 50 sms to r.parent_phone: \"Hi {r.student default 'there'}, a reminder from the school: your lesson is tomorrow at {time_of(r.lesson_at)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01106", "domain": "music", "pattern": "reminder", "batch": true, "sop": "Each Tuesday at 8:30am, find every student in the Lessons sheet whose lesson is in a week and whose status is \"scheduled\". Send each one a text reminder. Show me the messages for approval first. Then mark them reminded. Never include their progress notes. At most 100 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every tuesday at 08:30\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 7 days and status == \"scheduled\"\n let msgs = draft each r in due up to 100 sms to r.parent_phone: \"Hi {r.student default 'there'}, a reminder from the school: your lesson is in a week at {time_of(r.lesson_at)}.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01107", "domain": "music", "pattern": "reminder", "batch": true, "sop": "Each Monday at 8:30am, find every student in the Lessons sheet whose lesson is tomorrow and whose status is \"scheduled\". Send each one a text reminder. I need to OK every message. Keep the progress notes out of the message. At most 100 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every monday at 08:30\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 1 day and status == \"scheduled\"\n let msgs = draft each r in due up to 100 sms to r.parent_phone: \"Hi {r.student}, a reminder from the school: your lesson is tomorrow at {time_of(r.lesson_at)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01108", "domain": "music", "pattern": "reminder", "batch": true, "sop": "Daily at 10am, find every student in the Lessons sheet whose lesson is tomorrow and whose status is \"scheduled\". Send each one a text reminder. I want to approve each message first. Never include their progress notes. At most 20 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 1 day and status == \"scheduled\"\n let msgs = draft each r in due up to 20 sms to r.parent_phone: \"Hi {r.student}, a reminder from the school: your lesson is tomorrow at {time_of(r.lesson_at)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01109", "domain": "music", "pattern": "followup", "batch": false, "sop": "Every day at 5:30pm, look for students marked \"missed\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Don't mention the progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 2 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01110", "domain": "music", "pattern": "followup", "batch": false, "sop": "Daily at 8:30am, look for students marked \"missed\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 3 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01111", "domain": "music", "pattern": "followup", "batch": false, "sop": "Daily at 4pm, look for students marked \"missed\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 7 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01112", "domain": "music", "pattern": "followup", "batch": false, "sop": "Every day at 9am, look for students marked \"missed\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 7 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01113", "domain": "music", "pattern": "followup", "batch": false, "sop": "Daily at 9am, look for students marked \"missed\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 3 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01114", "domain": "music", "pattern": "followup", "batch": false, "sop": "Every Monday at 9am, look for students marked \"missed\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every monday at 09:00\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 1 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01115", "domain": "music", "pattern": "followup", "batch": false, "sop": "Daily at 10am, look for students marked \"missed\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 3 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01116", "domain": "music", "pattern": "followup", "batch": false, "sop": "Daily at 8:30am, look for students marked \"missed\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Don't mention the progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 2 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01117", "domain": "music", "pattern": "followup", "batch": true, "sop": "Each day at 6pm, look for students marked \"missed\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Don't mention the progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 7 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.parent_phone: \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01118", "domain": "music", "pattern": "followup", "batch": true, "sop": "On Fridays at 6pm, look for students marked \"missed\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every friday at 18:00\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 3 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.parent_phone: \"Hi {r.student}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01119", "domain": "music", "pattern": "followup", "batch": true, "sop": "Every day at 10am, look for students marked \"missed\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Don't mention the progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 7 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.parent_phone: \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01120", "domain": "music", "pattern": "followup", "batch": true, "sop": "Each day at 4pm, look for students marked \"missed\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 3 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.parent_phone: \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01121", "domain": "music", "pattern": "followup", "batch": true, "sop": "On Tuesdays at 11am, look for students marked \"missed\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every tuesday at 11:00\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 1 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.parent_phone: \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01122", "domain": "music", "pattern": "followup", "batch": true, "sop": "Daily at 8am, look for students marked \"missed\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 40 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 1 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.parent_phone: \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01123", "domain": "music", "pattern": "followup", "batch": true, "sop": "Every Wednesday at 8am, look for students marked \"missed\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every wednesday at 08:00\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 3 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.parent_phone: \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01124", "domain": "music", "pattern": "followup", "batch": true, "sop": "Daily at 8:30am, look for students marked \"missed\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Lessons\n let recent = filter all where status == \"missed\" and days_between(lesson_at, today()) <= 1 and days_between(lesson_at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.parent_phone: \"Hi {r.student}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01125", "domain": "music", "pattern": "lapsed", "batch": false, "sop": "Daily at 4pm, find students whose lesson at was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the school.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01126", "domain": "music", "pattern": "lapsed", "batch": false, "sop": "Each morning at 11am, find students whose lesson at was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the school.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01127", "domain": "music", "pattern": "lapsed", "batch": false, "sop": "Each day at 5:30pm, find students whose lesson at was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the school.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01128", "domain": "music", "pattern": "lapsed", "batch": false, "sop": "On Fridays at 9am, find students whose lesson at was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every friday at 09:00\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the school.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01129", "domain": "music", "pattern": "lapsed", "batch": false, "sop": "Daily at 5:30pm, find students whose lesson at was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the school.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01130", "domain": "music", "pattern": "lapsed", "batch": false, "sop": "Daily at 10am, find students whose lesson at was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, it's been a while! We'd love to see you again at the school.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01131", "domain": "music", "pattern": "lapsed", "batch": false, "sop": "Each morning at 10am, find students whose lesson at was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the school.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01132", "domain": "music", "pattern": "lapsed", "batch": false, "sop": "Every day at 9am, find students whose lesson at was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, it's been a while! We'd love to see you again at the school.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01133", "domain": "music", "pattern": "lapsed", "batch": true, "sop": "Daily at 8:30am, find students whose lesson at was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 10\n let msgs = draft each r in oldest up to 10 sms to r.parent_phone: \"Hi {r.student}, it's been a while! We'd love to see you again at the school.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01134", "domain": "music", "pattern": "lapsed", "batch": true, "sop": "Each morning at 8:30am, find students whose lesson at was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 20\n let msgs = draft each r in oldest up to 20 sms to r.parent_phone: \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the school.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01135", "domain": "music", "pattern": "lapsed", "batch": true, "sop": "Each Monday at 8:30am, find students whose lesson at was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every monday at 08:30\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 15\n let msgs = draft each r in oldest up to 15 sms to r.parent_phone: \"Hi {r.student}, it's been a while! We'd love to see you again at the school.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01136", "domain": "music", "pattern": "lapsed", "batch": true, "sop": "Every Friday at 10am, find students whose lesson at was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every friday at 10:00\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 15\n let msgs = draft each r in oldest up to 15 sms to r.parent_phone: \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the school.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01137", "domain": "music", "pattern": "lapsed", "batch": true, "sop": "Every day at 9am, find students whose lesson at was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 20\n let msgs = draft each r in oldest up to 20 sms to r.parent_phone: \"Hi {r.student}, it's been a while! We'd love to see you again at the school.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01138", "domain": "music", "pattern": "lapsed", "batch": true, "sop": "Every Tuesday at 5:30pm, find students whose lesson at was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every tuesday at 17:30\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 20\n let msgs = draft each r in oldest up to 20 sms to r.parent_phone: \"Hi {r.student}, it's been a while! We'd love to see you again at the school.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01139", "domain": "music", "pattern": "lapsed", "batch": true, "sop": "Every Wednesday at 8am, find students whose lesson at was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 10 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every wednesday at 08:00\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 10\n let msgs = draft each r in oldest up to 10 sms to r.parent_phone: \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the school.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01140", "domain": "music", "pattern": "lapsed", "batch": true, "sop": "Every day at 11am, find students whose lesson at was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Don't mention the progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicWinBack {\n about \"Nudge students whose lesson was long ago\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Lessons\n let old = filter all where days_between(lesson_at, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by lesson_at first 20\n let msgs = draft each r in oldest up to 20 sms to r.parent_phone: \"Hi {r.student default 'there'}, it's been a while! We'd love to see you again at the school.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01141", "domain": "music", "pattern": "summary", "batch": false, "sop": "On Mondays at 8am, count the students in Lessons whose status is \"missed\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy MusicPolicy {\n allow read Lessons(status, balance, student, parent_phone, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicDailySummary {\n about \"Tell the owner how many students are missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every monday at 08:00\n\n let all = fetch Lessons\n let these = filter all where status == \"missed\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students: {n}, total balance: {total}\"\n}"} {"id": "train-01142", "domain": "music", "pattern": "summary", "batch": false, "sop": "Each Tuesday at 11am, count the students in Lessons whose status is \"missed\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy MusicPolicy {\n allow read Lessons(status, balance, student, parent_phone)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicDailySummary {\n about \"Tell the owner how many students are missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every tuesday at 11:00\n\n let all = fetch Lessons\n let these = filter all where status == \"missed\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students: {n}, total balance: {total}\"\n}"} {"id": "train-01143", "domain": "music", "pattern": "summary", "batch": false, "sop": "Daily at 6pm, count the students in Lessons whose status is \"missed\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy MusicPolicy {\n allow read Lessons(status, balance, student, parent_phone)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicDailySummary {\n about \"Tell the owner how many students are missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Lessons\n let these = filter all where status == \"missed\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students: {n}, total balance: {total}\"\n}"} {"id": "train-01144", "domain": "music", "pattern": "summary", "batch": false, "sop": "Each Thursday at 6pm, count the students in Lessons whose status is \"scheduled\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy MusicPolicy {\n allow read Lessons(status, balance, student, parent_phone, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicDailySummary {\n about \"Tell the owner how many students are scheduled\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every thursday at 18:00\n\n let all = fetch Lessons\n let these = filter all where status == \"scheduled\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no scheduled students\"\n }\n notify owner \"Scheduled students: {n}, total balance: {total}\"\n}"} {"id": "train-01145", "domain": "music", "pattern": "summary", "batch": false, "sop": "Each day at 4pm, count the students in Lessons whose status is \"scheduled\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy MusicPolicy {\n allow read Lessons(status, balance, student, parent_phone, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicDailySummary {\n about \"Tell the owner how many students are scheduled\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Lessons\n let these = filter all where status == \"scheduled\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no scheduled students\"\n }\n notify owner \"Scheduled students: {n}, total balance: {total}\"\n}"} {"id": "train-01146", "domain": "music", "pattern": "summary", "batch": false, "sop": "Every day at 10am, count the students in Lessons whose status is \"missed\", and send the numbers to me only. Don't message any students.", "policy": "policy MusicPolicy {\n allow read Lessons(status, balance, student, parent_phone, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicDailySummary {\n about \"Tell the owner how many students are missed\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Lessons\n let these = filter all where status == \"missed\"\n let n = summarize count of these\n notify owner \"Missed students today: {n}\"\n}"} {"id": "train-01147", "domain": "music", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy MusicRefundPolicy {\n allow read RefundRequests(request_id, student, parent_phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_phone\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $15\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure MusicRefunds {\n about \"Handle refund requests within limits\"\n policy MusicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01148", "domain": "music", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy MusicRefundPolicy {\n allow read RefundRequests(request_id, student, parent_phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_phone\n limit refund $100 per action\n limit refund $500 per day\n refund without approval up to $20\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure MusicRefunds {\n about \"Handle refund requests within limits\"\n policy MusicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01149", "domain": "music", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy MusicRefundPolicy {\n allow read RefundRequests(request_id, student, parent_phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_phone\n limit refund $40 per action\n limit refund $120 per day\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure MusicRefunds {\n about \"Handle refund requests within limits\"\n policy MusicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01150", "domain": "music", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy MusicRefundPolicy {\n allow read RefundRequests(request_id, student, parent_phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_phone\n limit refund $40 per action\n limit refund $240 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure MusicRefunds {\n about \"Handle refund requests within limits\"\n policy MusicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01151", "domain": "music", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy MusicRefundPolicy {\n allow read RefundRequests(request_id, student, parent_phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_phone\n limit refund $75 per action\n limit refund $450 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure MusicRefunds {\n about \"Handle refund requests within limits\"\n policy MusicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01152", "domain": "music", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy MusicRefundPolicy {\n allow read RefundRequests(request_id, student, parent_phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_phone\n limit refund $75 per action\n limit refund $450 per day\n refund without approval up to $10\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure MusicRefunds {\n about \"Handle refund requests within limits\"\n policy MusicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.parent_phone: \"Hi {r.student}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01153", "domain": "music", "pattern": "confirm_new", "batch": false, "sop": "When a new lesson is added to Lessons: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (i want to approve each message first), put it on the Studios calendar for 30 minutes, and mark it confirmed. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, balance)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow calendar Studios\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\ncalendar Studios \"Studios\"", "program": "procedure MusicConfirmNewLesson {\n about \"Confirm a new lesson and add it to the calendar\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n calendar Studios \"Studios\"\n trigger when new row r in Lessons\n\n if r.lesson_at < now() + 12 hours {\n notify owner \"Short-notice lesson for {r.student} at {r.lesson_at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.parent_phone: \"Hi {r.student}, your lesson with the school is confirmed for {r.lesson_at}.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Studios { title: \"{r.student}\", at: r.lesson_at, length: 30 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01154", "domain": "music", "pattern": "confirm_new", "batch": false, "sop": "When a new lesson is added to Lessons: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (i need to ok every message), put it on the Studios calendar for 90 minutes, and mark it confirmed. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, balance, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow calendar Studios\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\ncalendar Studios \"Studios\"", "program": "procedure MusicConfirmNewLesson {\n about \"Confirm a new lesson and add it to the calendar\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n calendar Studios \"Studios\"\n trigger when new row r in Lessons\n\n if r.lesson_at < now() + 2 hours {\n notify owner \"Short-notice lesson for {r.student} at {r.lesson_at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, your lesson with the school is confirmed for {r.lesson_at}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Studios { title: \"{r.student}\", at: r.lesson_at, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01155", "domain": "music", "pattern": "confirm_new", "batch": false, "sop": "When a new lesson is added to Lessons: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Studios calendar for 60 minutes, and mark it confirmed. Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, balance, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow calendar Studios\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\ncalendar Studios \"Studios\"", "program": "procedure MusicConfirmNewLesson {\n about \"Confirm a new lesson and add it to the calendar\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n calendar Studios \"Studios\"\n trigger when new row r in Lessons\n\n if r.lesson_at < now() + 12 hours {\n notify owner \"Short-notice lesson for {r.student} at {r.lesson_at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, your lesson with the school is confirmed for {r.lesson_at}.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Studios { title: \"{r.student}\", at: r.lesson_at, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01156", "domain": "music", "pattern": "confirm_new", "batch": false, "sop": "When a new lesson is added to Lessons: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (i need to ok every message), put it on the Studios calendar for 90 minutes, and mark it confirmed. Don't mention the progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, balance)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow calendar Studios\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\ncalendar Studios \"Studios\"", "program": "procedure MusicConfirmNewLesson {\n about \"Confirm a new lesson and add it to the calendar\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n calendar Studios \"Studios\"\n trigger when new row r in Lessons\n\n if r.lesson_at < now() + 12 hours {\n notify owner \"Short-notice lesson for {r.student} at {r.lesson_at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, your lesson with the school is confirmed for {r.lesson_at}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Studios { title: \"{r.student}\", at: r.lesson_at, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01157", "domain": "music", "pattern": "confirm_new", "batch": false, "sop": "When a new lesson is added to Lessons: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (nothing goes out until i've approved it), put it on the Studios calendar for 90 minutes, and mark it confirmed. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, balance)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow calendar Studios\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\ncalendar Studios \"Studios\"", "program": "procedure MusicConfirmNewLesson {\n about \"Confirm a new lesson and add it to the calendar\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n calendar Studios \"Studios\"\n trigger when new row r in Lessons\n\n if r.lesson_at < now() + 12 hours {\n notify owner \"Short-notice lesson for {r.student} at {r.lesson_at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.parent_phone: \"Hi {r.student}, your lesson with the school is confirmed for {r.lesson_at}.\"\n let ok = request approval of m from owner timeout 1 day else stop \"confirmation not approved\"\n send ok\n let ev = book Studios { title: \"{r.student}\", at: r.lesson_at, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01158", "domain": "music", "pattern": "confirm_new", "batch": false, "sop": "When a new lesson is added to Lessons: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (i want to approve each message first), put it on the Studios calendar for 90 minutes, and mark it confirmed. Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, balance, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow calendar Studios\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\ncalendar Studios \"Studios\"", "program": "procedure MusicConfirmNewLesson {\n about \"Confirm a new lesson and add it to the calendar\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n calendar Studios \"Studios\"\n trigger when new row r in Lessons\n\n if r.lesson_at < now() + 2 hours {\n notify owner \"Short-notice lesson for {r.student} at {r.lesson_at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, your lesson with the school is confirmed for {r.lesson_at}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Studios { title: \"{r.student}\", at: r.lesson_at, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01159", "domain": "music", "pattern": "confirm_new", "batch": false, "sop": "When a new lesson is added to Lessons: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (nothing goes out until i've approved it), put it on the Studios calendar for 60 minutes, and mark it confirmed. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, balance)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow calendar Studios\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\ncalendar Studios \"Studios\"", "program": "procedure MusicConfirmNewLesson {\n about \"Confirm a new lesson and add it to the calendar\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n calendar Studios \"Studios\"\n trigger when new row r in Lessons\n\n if r.lesson_at < now() + 24 hours {\n notify owner \"Short-notice lesson for {r.student} at {r.lesson_at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, your lesson with the school is confirmed for {r.lesson_at}.\"\n let ok = request approval of m from owner timeout 1 day else stop \"confirmation not approved\"\n send ok\n let ev = book Studios { title: \"{r.student}\", at: r.lesson_at, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01160", "domain": "music", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Lessons, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger when new row r in Lessons\n\n let first = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, thanks for choosing the school! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Lessons\n let now_r = find all where parent_phone == r.parent_phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.parent_phone: \"Hi {now_r.student default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01161", "domain": "music", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Lessons, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger when new row r in Lessons\n\n let first = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, thanks for choosing the school! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Lessons\n let now_r = find all where parent_phone == r.parent_phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.parent_phone: \"Hi {now_r.student}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01162", "domain": "music", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Lessons, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger when new row r in Lessons\n\n let first = draft sms to r.parent_phone: \"Hi {r.student}, thanks for choosing the school! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Lessons\n let now_r = find all where parent_phone == r.parent_phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.parent_phone: \"Hi {now_r.student}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01163", "domain": "music", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Lessons, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Don't mention the progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger when new row r in Lessons\n\n let first = draft sms to r.parent_phone: \"Hi {r.student}, thanks for choosing the school! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Lessons\n let now_r = find all where parent_phone == r.parent_phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.parent_phone: \"Hi {now_r.student default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01164", "domain": "music", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Lessons, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Keep the progress notes out of the message.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger when new row r in Lessons\n\n let first = draft sms to r.parent_phone: \"Hi {r.student}, thanks for choosing the school! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Lessons\n let now_r = find all where parent_phone == r.parent_phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.parent_phone: \"Hi {now_r.student}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01165", "domain": "music", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Lessons, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger when new row r in Lessons\n\n let first = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, thanks for choosing the school! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Lessons\n let now_r = find all where parent_phone == r.parent_phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.parent_phone: \"Hi {now_r.student default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01166", "domain": "music", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Lessons, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger when new row r in Lessons\n\n let first = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, thanks for choosing the school! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Lessons\n let now_r = find all where parent_phone == r.parent_phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.parent_phone: \"Hi {now_r.student}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01167", "domain": "music", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Don't mention the progress notes. No more than 50.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, come back to the school! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01168", "domain": "music", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Never include their progress notes. No more than 100.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, come back to the school! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01169", "domain": "music", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Don't mention the progress notes. No more than 100.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, come back to the school! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01170", "domain": "music", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the progress notes out of the message. No more than 50.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, come back to the school! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01171", "domain": "music", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Don't mention the progress notes. No more than 100.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, come back to the school! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01172", "domain": "music", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Don't mention the progress notes. No more than 50.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, come back to the school! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01173", "domain": "music", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Don't mention the progress notes. No more than 100.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, come back to the school! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01174", "domain": "music", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Don't mention the progress notes. No more than 50.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.parent_phone: \"Hi {r.student}, come back to the school! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01175", "domain": "music", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Never include their progress notes. No more than 100.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.parent_phone: \"Hi {r.student default 'there'}, come back to the school! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01176", "domain": "music", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Never include their progress notes. No more than 50.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.parent_phone: \"Hi {r.student}, come back to the school! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01177", "domain": "music", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Keep the progress notes out of the message. No more than 50.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.parent_phone: \"Hi {r.student default 'there'}, come back to the school! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01178", "domain": "music", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Never include their progress notes. No more than 100.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.parent_phone: \"Hi {r.student}, come back to the school! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01179", "domain": "music", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Keep the progress notes out of the message. No more than 50.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.parent_phone: \"Hi {r.student default 'there'}, come back to the school! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01180", "domain": "music", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Never include their progress notes. No more than 100.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.parent_phone: \"Hi {r.student default 'there'}, come back to the school! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01181", "domain": "music", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Don't mention the progress notes. No more than 50.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.parent_phone: \"Hi {r.student default 'there'}, come back to the school! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01182", "domain": "music", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose lesson at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Never include their progress notes. No more than 50.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure MusicOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Lessons\n let targets = filter all where status == \"cancelled\" and days_between(lesson_at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.parent_phone: \"Hi {r.student}, come back to the school! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01183", "domain": "bikeshop", "pattern": "reminder", "batch": false, "sop": "Every Monday at 8:30am, find every customer in the Repairs sheet whose repair is tomorrow and whose status is \"waiting\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Don't mention the lock code. At most 20 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every monday at 08:30\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 1 day and status == \"waiting\"\n for each r in due up to 20 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, a reminder from the shop: your repair is tomorrow.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01184", "domain": "bikeshop", "pattern": "reminder", "batch": false, "sop": "Every Friday at 10am, find every customer in the Repairs sheet whose repair is in two days and whose status is \"waiting\". Send each one a text reminder. Nothing goes out until I've approved it. Then mark them notified. Never include their lock code. At most 50 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every friday at 10:00\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 2 days and status == \"waiting\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.customer}, a reminder from the shop: your repair is in two days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01185", "domain": "bikeshop", "pattern": "reminder", "batch": false, "sop": "Every Tuesday at 8am, find every customer in the Repairs sheet whose repair is in a week and whose status is \"waiting\". Send each one a text reminder. Let me check the messages before they go out. Don't mention the lock code. At most 50 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every tuesday at 08:00\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 7 days and status == \"waiting\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.customer}, a reminder from the shop: your repair is in a week.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01186", "domain": "bikeshop", "pattern": "reminder", "batch": false, "sop": "Each morning at 8:30am, find every customer in the Repairs sheet whose repair is in a week and whose status is \"waiting\". Send each one a text reminder. Show me the messages for approval first. Keep the lock code out of the message. At most 30 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 7 days and status == \"waiting\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, a reminder from the shop: your repair is in a week.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01187", "domain": "bikeshop", "pattern": "reminder", "batch": false, "sop": "Every day at 5:30pm, find every customer in the Repairs sheet whose repair is in two days and whose status is \"waiting\". Send each one a text reminder. Nothing goes out until I've approved it. Never include their lock code. At most 20 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 2 days and status == \"waiting\"\n for each r in due up to 20 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, a reminder from the shop: your repair is in two days.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01188", "domain": "bikeshop", "pattern": "reminder", "batch": false, "sop": "On Mondays at 11am, find every customer in the Repairs sheet whose repair is in a week and whose status is \"waiting\". Send each one a text reminder. I want to approve each message first. Then mark them notified. Don't mention the lock code. At most 30 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every monday at 11:00\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 7 days and status == \"waiting\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, a reminder from the shop: your repair is in a week.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01189", "domain": "bikeshop", "pattern": "reminder", "batch": false, "sop": "Daily at 9am, find every customer in the Repairs sheet whose repair is in two days and whose status is \"waiting\". Send each one a text reminder. I need to OK every message. Then mark them notified. Never include their lock code. At most 30 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 2 days and status == \"waiting\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.customer}, a reminder from the shop: your repair is in two days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01190", "domain": "bikeshop", "pattern": "reminder", "batch": false, "sop": "Each morning at 10am, find every customer in the Repairs sheet whose repair is in two days and whose status is \"waiting\". Send each one a text reminder. Show me the messages for approval first. Keep the lock code out of the message. At most 100 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 10:00\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 2 days and status == \"waiting\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, a reminder from the shop: your repair is in two days.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01191", "domain": "bikeshop", "pattern": "reminder", "batch": true, "sop": "Each Thursday at 11am, find every customer in the Repairs sheet whose repair is tomorrow and whose status is \"waiting\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Don't mention the lock code. At most 50 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 1 day and status == \"waiting\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.customer default 'there'}, a reminder from the shop: your repair is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01192", "domain": "bikeshop", "pattern": "reminder", "batch": true, "sop": "Every day at 8:30am, find every customer in the Repairs sheet whose repair is tomorrow and whose status is \"waiting\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Never include their lock code. At most 30 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 1 day and status == \"waiting\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.customer default 'there'}, a reminder from the shop: your repair is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01193", "domain": "bikeshop", "pattern": "reminder", "batch": true, "sop": "On Fridays at 8:30am, find every customer in the Repairs sheet whose repair is tomorrow and whose status is \"waiting\". Send each one a text reminder. I want to approve each message first. Then mark them notified. Never include their lock code. At most 20 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every friday at 08:30\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 1 day and status == \"waiting\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.customer default 'there'}, a reminder from the shop: your repair is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01194", "domain": "bikeshop", "pattern": "reminder", "batch": true, "sop": "Each Thursday at 4pm, find every customer in the Repairs sheet whose repair is tomorrow and whose status is \"waiting\". Send each one a text reminder. Show me the messages for approval first. Don't mention the lock code. At most 100 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 100 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every thursday at 16:00\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 1 day and status == \"waiting\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.customer}, a reminder from the shop: your repair is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01195", "domain": "bikeshop", "pattern": "reminder", "batch": true, "sop": "Every Monday at 9am, find every customer in the Repairs sheet whose repair is tomorrow and whose status is \"waiting\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Don't mention the lock code. At most 20 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every monday at 09:00\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 1 day and status == \"waiting\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.customer default 'there'}, a reminder from the shop: your repair is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01196", "domain": "bikeshop", "pattern": "reminder", "batch": true, "sop": "Each day at 5:30pm, find every customer in the Repairs sheet whose repair is in three days and whose status is \"waiting\". Send each one a text reminder. I want to approve each message first. Then mark them notified. Never include their lock code. At most 30 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 3 days and status == \"waiting\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.customer}, a reminder from the shop: your repair is in three days.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01197", "domain": "bikeshop", "pattern": "reminder", "batch": true, "sop": "Each day at 6pm, find every customer in the Repairs sheet whose repair is tomorrow and whose status is \"waiting\". Send each one a text reminder. I want to approve each message first. Then mark them notified. Keep the lock code out of the message. At most 30 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 18:00\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 1 day and status == \"waiting\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.customer default 'there'}, a reminder from the shop: your repair is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01198", "domain": "bikeshop", "pattern": "followup", "batch": false, "sop": "Daily at 8am, look for customers marked \"picked-up\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 7 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01199", "domain": "bikeshop", "pattern": "followup", "batch": false, "sop": "Each Thursday at 5:30pm, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 1 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01200", "domain": "bikeshop", "pattern": "followup", "batch": false, "sop": "Each day at 4pm, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 1 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01201", "domain": "bikeshop", "pattern": "followup", "batch": false, "sop": "Each Thursday at 6pm, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every thursday at 18:00\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 1 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01202", "domain": "bikeshop", "pattern": "followup", "batch": false, "sop": "Each day at 5:30pm, look for customers marked \"picked-up\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Never include their lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 2 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01203", "domain": "bikeshop", "pattern": "followup", "batch": false, "sop": "Each day at 5:30pm, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 1 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01204", "domain": "bikeshop", "pattern": "followup", "batch": false, "sop": "Each Monday at 8am, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Never include their lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every monday at 08:00\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 1 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01205", "domain": "bikeshop", "pattern": "followup", "batch": true, "sop": "On Mondays at 10am, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every monday at 10:00\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 1 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01206", "domain": "bikeshop", "pattern": "followup", "batch": true, "sop": "Every Monday at 8:30am, look for customers marked \"picked-up\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every monday at 08:30\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 3 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01207", "domain": "bikeshop", "pattern": "followup", "batch": true, "sop": "Every day at 4pm, look for customers marked \"picked-up\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 3 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01208", "domain": "bikeshop", "pattern": "followup", "batch": true, "sop": "Every Friday at 4pm, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every friday at 16:00\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 1 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01209", "domain": "bikeshop", "pattern": "followup", "batch": true, "sop": "Each Friday at 11am, look for customers marked \"picked-up\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every friday at 11:00\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 3 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01210", "domain": "bikeshop", "pattern": "followup", "batch": true, "sop": "Daily at 6pm, look for customers marked \"picked-up\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Never include their lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 18:00\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 7 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01211", "domain": "bikeshop", "pattern": "followup", "batch": true, "sop": "Every day at 11am, look for customers marked \"picked-up\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Never include their lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 11:00\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 2 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01212", "domain": "bikeshop", "pattern": "lapsed", "batch": false, "sop": "Every Tuesday at 6pm, find customers whose ready on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Show me the messages for approval first. Never include their lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ready_on first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01213", "domain": "bikeshop", "pattern": "lapsed", "batch": false, "sop": "Every day at 8am, find customers whose ready on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by ready_on first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01214", "domain": "bikeshop", "pattern": "lapsed", "batch": false, "sop": "On Wednesdays at 10am, find customers whose ready on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by ready_on first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.customer}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01215", "domain": "bikeshop", "pattern": "lapsed", "batch": false, "sop": "Daily at 8am, find customers whose ready on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Never include their lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by ready_on first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01216", "domain": "bikeshop", "pattern": "lapsed", "batch": false, "sop": "On Fridays at 5:30pm, find customers whose ready on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every friday at 17:30\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by ready_on first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01217", "domain": "bikeshop", "pattern": "lapsed", "batch": false, "sop": "Every day at 5:30pm, find customers whose ready on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by ready_on first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01218", "domain": "bikeshop", "pattern": "lapsed", "batch": false, "sop": "Every day at 5:30pm, find customers whose ready on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ready_on first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01219", "domain": "bikeshop", "pattern": "lapsed", "batch": false, "sop": "Each morning at 8am, find customers whose ready on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Never include their lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ready_on first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01220", "domain": "bikeshop", "pattern": "lapsed", "batch": true, "sop": "Each morning at 8am, find customers whose ready on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 10 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ready_on first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01221", "domain": "bikeshop", "pattern": "lapsed", "batch": true, "sop": "Each morning at 10am, find customers whose ready on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 10:00\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by ready_on first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01222", "domain": "bikeshop", "pattern": "lapsed", "batch": true, "sop": "On Mondays at 4pm, find customers whose ready on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every monday at 16:00\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ready_on first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01223", "domain": "bikeshop", "pattern": "lapsed", "batch": true, "sop": "Daily at 6pm, find customers whose ready on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 18:00\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ready_on first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.customer}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01224", "domain": "bikeshop", "pattern": "lapsed", "batch": true, "sop": "On Mondays at 9am, find customers whose ready on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every monday at 09:00\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ready_on first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01225", "domain": "bikeshop", "pattern": "lapsed", "batch": true, "sop": "Every day at 9am, find customers whose ready on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by ready_on first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.customer}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01226", "domain": "bikeshop", "pattern": "lapsed", "batch": true, "sop": "Every day at 8:30am, find customers whose ready on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by ready_on first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01227", "domain": "bikeshop", "pattern": "lapsed", "batch": true, "sop": "Each morning at 8am, find customers whose ready on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopWinBack {\n about \"Nudge customers whose repair was long ago\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Repairs\n let old = filter all where days_between(ready_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by ready_on first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.customer}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01228", "domain": "bikeshop", "pattern": "summary", "batch": false, "sop": "Each Thursday at 8am, count the customers in Repairs whose status is \"ready\" and the total estimate, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BikeshopPolicy {\n allow read Repairs(status, estimate, customer, phone)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every thursday at 08:00\n\n let all = fetch Repairs\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n let total = summarize sum estimate of these\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers: {n}, total estimate: {total}\"\n}"} {"id": "train-01229", "domain": "bikeshop", "pattern": "summary", "batch": false, "sop": "Every day at 8am, count the customers in Repairs whose status is \"ready\" and the total estimate, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BikeshopPolicy {\n allow read Repairs(status, estimate, customer, phone, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Repairs\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n let total = summarize sum estimate of these\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers: {n}, total estimate: {total}\"\n}"} {"id": "train-01230", "domain": "bikeshop", "pattern": "summary", "batch": false, "sop": "Daily at 10am, count the customers in Repairs whose status is \"waiting\", and send the numbers to me only. Don't message any customers.", "policy": "policy BikeshopPolicy {\n allow read Repairs(status, estimate, customer, phone)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopDailySummary {\n about \"Tell the owner how many customers are waiting\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 10:00\n\n let all = fetch Repairs\n let these = filter all where status == \"waiting\"\n let n = summarize count of these\n notify owner \"Waiting customers today: {n}\"\n}"} {"id": "train-01231", "domain": "bikeshop", "pattern": "summary", "batch": false, "sop": "Each day at 6pm, count the customers in Repairs whose status is \"ready\", and send the numbers to me only. Don't message any customers.", "policy": "policy BikeshopPolicy {\n allow read Repairs(status, estimate, customer, phone)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 18:00\n\n let all = fetch Repairs\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n notify owner \"Ready customers today: {n}\"\n}"} {"id": "train-01232", "domain": "bikeshop", "pattern": "summary", "batch": false, "sop": "Each morning at 9am, count the customers in Repairs whose status is \"ready\" and the total estimate, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BikeshopPolicy {\n allow read Repairs(status, estimate, customer, phone, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Repairs\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n let total = summarize sum estimate of these\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers: {n}, total estimate: {total}\"\n}"} {"id": "train-01233", "domain": "bikeshop", "pattern": "summary", "batch": false, "sop": "Every day at 4pm, count the customers in Repairs whose status is \"picked-up\" and the total estimate, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BikeshopPolicy {\n allow read Repairs(status, estimate, customer, phone)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopDailySummary {\n about \"Tell the owner how many customers are picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Repairs\n let these = filter all where status == \"picked-up\"\n let n = summarize count of these\n let total = summarize sum estimate of these\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers: {n}, total estimate: {total}\"\n}"} {"id": "train-01234", "domain": "bikeshop", "pattern": "summary", "batch": false, "sop": "Each day at 4pm, count the customers in Repairs whose status is \"picked-up\" and the total estimate, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BikeshopPolicy {\n allow read Repairs(status, estimate, customer, phone, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopDailySummary {\n about \"Tell the owner how many customers are picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Repairs\n let these = filter all where status == \"picked-up\"\n let n = summarize count of these\n let total = summarize sum estimate of these\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers: {n}, total estimate: {total}\"\n}"} {"id": "train-01235", "domain": "bikeshop", "pattern": "summary", "batch": false, "sop": "Each day at 6pm, count the customers in Repairs whose status is \"ready\" and the total estimate, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BikeshopPolicy {\n allow read Repairs(status, estimate, customer, phone)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 18:00\n\n let all = fetch Repairs\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n let total = summarize sum estimate of these\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers: {n}, total estimate: {total}\"\n}"} {"id": "train-01236", "domain": "bikeshop", "pattern": "reorder", "batch": false, "sop": "Daily at 6pm, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy BikeshopStockPolicy {\n allow read Parts(part, qty, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Parts.supplier\n limit order $100 per action\n limit order $400 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BikeshopReorder {\n about \"Reorder parts below their minimum\"\n policy BikeshopStockPolicy\n sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 18:00\n\n let all = fetch Parts\n let low = filter all where qty < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-01237", "domain": "bikeshop", "pattern": "reorder", "batch": false, "sop": "Each Thursday at 10am, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $200 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy BikeshopStockPolicy {\n allow read Parts(part, qty, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Parts.supplier\n limit order $200 per action\n limit order $1000 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BikeshopReorder {\n about \"Reorder parts below their minimum\"\n policy BikeshopStockPolicy\n sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every thursday at 10:00\n\n let all = fetch Parts\n let low = filter all where qty < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $200.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $200 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-01238", "domain": "bikeshop", "pattern": "reorder", "batch": false, "sop": "Every day at 11am, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy BikeshopStockPolicy {\n allow read Parts(part, qty, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Parts.supplier\n limit order $150 per action\n limit order $450 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BikeshopReorder {\n about \"Reorder parts below their minimum\"\n policy BikeshopStockPolicy\n sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 11:00\n\n let all = fetch Parts\n let low = filter all where qty < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-01239", "domain": "bikeshop", "pattern": "reorder", "batch": false, "sop": "Every Monday at 5:30pm, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy BikeshopStockPolicy {\n allow read Parts(part, qty, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Parts.supplier\n limit order $100 per action\n limit order $500 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BikeshopReorder {\n about \"Reorder parts below their minimum\"\n policy BikeshopStockPolicy\n sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every monday at 17:30\n\n let all = fetch Parts\n let low = filter all where qty < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-01240", "domain": "bikeshop", "pattern": "reorder", "batch": false, "sop": "Each Tuesday at 5:30pm, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 2 items per run.", "policy": "policy BikeshopStockPolicy {\n allow read Parts(part, qty, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Parts.supplier\n limit order $150 per action\n limit order $300 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BikeshopReorder {\n about \"Reorder parts below their minimum\"\n policy BikeshopStockPolicy\n sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every tuesday at 17:30\n\n let all = fetch Parts\n let low = filter all where qty < minimum\n for each i in low up to 2 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-01241", "domain": "bikeshop", "pattern": "reorder", "batch": false, "sop": "Each Friday at 11am, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy BikeshopStockPolicy {\n allow read Parts(part, qty, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Parts.supplier\n limit order $250 per action\n limit order $1250 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BikeshopReorder {\n about \"Reorder parts below their minimum\"\n policy BikeshopStockPolicy\n sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every friday at 11:00\n\n let all = fetch Parts\n let low = filter all where qty < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $250.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-01242", "domain": "bikeshop", "pattern": "reorder", "batch": false, "sop": "Every day at 10am, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy BikeshopStockPolicy {\n allow read Parts(part, qty, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Parts.supplier\n limit order $150 per action\n limit order $750 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BikeshopReorder {\n about \"Reorder parts below their minimum\"\n policy BikeshopStockPolicy\n sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 10:00\n\n let all = fetch Parts\n let low = filter all where qty < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.part}\"\n }\n}"} {"id": "train-01243", "domain": "bikeshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BikeshopRefundPolicy {\n allow read RefundRequests(request_id, customer, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure BikeshopRefunds {\n about \"Handle refund requests within limits\"\n policy BikeshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01244", "domain": "bikeshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BikeshopRefundPolicy {\n allow read RefundRequests(request_id, customer, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $240 per day\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure BikeshopRefunds {\n about \"Handle refund requests within limits\"\n policy BikeshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01245", "domain": "bikeshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $100, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BikeshopRefundPolicy {\n allow read RefundRequests(request_id, customer, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $500 per day\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure BikeshopRefunds {\n about \"Handle refund requests within limits\"\n policy BikeshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01246", "domain": "bikeshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BikeshopRefundPolicy {\n allow read RefundRequests(request_id, customer, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $240 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure BikeshopRefunds {\n about \"Handle refund requests within limits\"\n policy BikeshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01247", "domain": "bikeshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BikeshopRefundPolicy {\n allow read RefundRequests(request_id, customer, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $200 per day\n limit sends 30 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure BikeshopRefunds {\n about \"Handle refund requests within limits\"\n policy BikeshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01248", "domain": "bikeshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BikeshopRefundPolicy {\n allow read RefundRequests(request_id, customer, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $75 per action\n limit refund $375 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure BikeshopRefunds {\n about \"Handle refund requests within limits\"\n policy BikeshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01249", "domain": "bikeshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BikeshopRefundPolicy {\n allow read RefundRequests(request_id, customer, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $500 per day\n refund without approval up to $20\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure BikeshopRefunds {\n about \"Handle refund requests within limits\"\n policy BikeshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01250", "domain": "bikeshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Repairs, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger when new row r in Repairs\n\n let first = draft sms to r.phone: \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Repairs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01251", "domain": "bikeshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Repairs, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger when new row r in Repairs\n\n let first = draft sms to r.phone: \"Hi {r.customer default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Repairs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.customer}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01252", "domain": "bikeshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Repairs, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger when new row r in Repairs\n\n let first = draft sms to r.phone: \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Repairs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01253", "domain": "bikeshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Repairs, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger when new row r in Repairs\n\n let first = draft sms to r.phone: \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Repairs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.customer}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01254", "domain": "bikeshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Repairs, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger when new row r in Repairs\n\n let first = draft sms to r.phone: \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Repairs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01255", "domain": "bikeshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Repairs, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger when new row r in Repairs\n\n let first = draft sms to r.phone: \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Repairs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01256", "domain": "bikeshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Repairs, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Keep the lock code out of the message.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger when new row r in Repairs\n\n let first = draft sms to r.phone: \"Hi {r.customer default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Repairs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01257", "domain": "bikeshop", "pattern": "escalation", "batch": false, "sop": "Each morning at 11am: for customers with a estimate above zero whose repair passed more than 7 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 21 days late, don't message them; tell me so I can call. Keep the lock code out of the message. At most 40 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, estimate)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 11:00\n\n let all = fetch Repairs\n let late = filter all where estimate > $0.00 and days_between(ready_on, today()) > 7\n for each r in late up to 40 {\n if days_between(r.ready_on, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.estimate}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.customer default 'there'}, our records show a estimate of {r.estimate}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01258", "domain": "bikeshop", "pattern": "escalation", "batch": false, "sop": "Daily at 8am: for customers with a estimate above zero whose repair passed more than 5 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 14 days late, don't message them; tell me so I can call. Never include their lock code. At most 40 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, estimate)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Repairs\n let late = filter all where estimate > $0.00 and days_between(ready_on, today()) > 5\n for each r in late up to 40 {\n if days_between(r.ready_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.estimate}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.customer}, our records show a estimate of {r.estimate}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01259", "domain": "bikeshop", "pattern": "escalation", "batch": false, "sop": "On Thursdays at 9am: for customers with a estimate above zero whose repair passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 14 days late, don't message them; tell me so I can call. Keep the lock code out of the message. At most 30 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, estimate)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every thursday at 09:00\n\n let all = fetch Repairs\n let late = filter all where estimate > $0.00 and days_between(ready_on, today()) > 5\n for each r in late up to 30 {\n if days_between(r.ready_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.estimate}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.customer}, our records show a estimate of {r.estimate}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01260", "domain": "bikeshop", "pattern": "escalation", "batch": false, "sop": "Each morning at 11am: for customers with a estimate above zero whose repair passed more than 3 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 14 days late, don't message them; tell me so I can call. Don't mention the lock code. At most 30 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, estimate)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 11:00\n\n let all = fetch Repairs\n let late = filter all where estimate > $0.00 and days_between(ready_on, today()) > 3\n for each r in late up to 30 {\n if days_between(r.ready_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.estimate}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.customer}, our records show a estimate of {r.estimate}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01261", "domain": "bikeshop", "pattern": "escalation", "batch": false, "sop": "Every Tuesday at 8am: for customers with a estimate above zero whose repair passed more than 3 days ago, send a polite reminder with the amount. Show me the messages for approval first. If it's more than 14 days late, don't message them; tell me so I can call. Never include their lock code. At most 20 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, estimate, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every tuesday at 08:00\n\n let all = fetch Repairs\n let late = filter all where estimate > $0.00 and days_between(ready_on, today()) > 3\n for each r in late up to 20 {\n if days_between(r.ready_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.estimate}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.customer}, our records show a estimate of {r.estimate}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01262", "domain": "bikeshop", "pattern": "escalation", "batch": false, "sop": "Daily at 9am: for customers with a estimate above zero whose repair passed more than 7 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 21 days late, don't message them; tell me so I can call. Keep the lock code out of the message. At most 40 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, estimate, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Repairs\n let late = filter all where estimate > $0.00 and days_between(ready_on, today()) > 7\n for each r in late up to 40 {\n if days_between(r.ready_on, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.estimate}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.customer}, our records show a estimate of {r.estimate}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01263", "domain": "bikeshop", "pattern": "escalation", "batch": false, "sop": "Every day at 9am: for customers with a estimate above zero whose repair passed more than 3 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 14 days late, don't message them; tell me so I can call. Never include their lock code. At most 40 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, estimate)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 09:00\n\n let all = fetch Repairs\n let late = filter all where estimate > $0.00 and days_between(ready_on, today()) > 3\n for each r in late up to 40 {\n if days_between(r.ready_on, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.estimate}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.customer}, our records show a estimate of {r.estimate}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-01264", "domain": "bikeshop", "pattern": "escalation", "batch": false, "sop": "Every Friday at 6pm: for customers with a estimate above zero whose repair passed more than 7 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 21 days late, don't message them; tell me so I can call. Don't mention the lock code. At most 30 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, estimate, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every friday at 18:00\n\n let all = fetch Repairs\n let late = filter all where estimate > $0.00 and days_between(ready_on, today()) > 7\n for each r in late up to 30 {\n if days_between(r.ready_on, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.estimate}). Please call.\"\n } else {\n let m = draft sms to r.phone: \"Hello {r.customer default 'there'}, our records show a estimate of {r.estimate}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01265", "domain": "bikeshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Don't mention the lock code. No more than 100.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01266", "domain": "bikeshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Don't mention the lock code. No more than 50.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01267", "domain": "bikeshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Never include their lock code. No more than 50.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.customer}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01268", "domain": "bikeshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Don't mention the lock code. No more than 50.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.customer}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01269", "domain": "bikeshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Never include their lock code. No more than 50.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.customer}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01270", "domain": "bikeshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Never include their lock code. No more than 50.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01271", "domain": "bikeshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Don't mention the lock code. No more than 50.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01272", "domain": "bikeshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Keep the lock code out of the message. No more than 50.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01273", "domain": "bikeshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Never include their lock code. No more than 100.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.customer default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01274", "domain": "bikeshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Never include their lock code. No more than 100.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.customer default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01275", "domain": "bikeshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Never include their lock code. No more than 50.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.customer}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01276", "domain": "bikeshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Don't mention the lock code. No more than 50.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.customer default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01277", "domain": "bikeshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Don't mention the lock code. No more than 100.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01278", "domain": "bikeshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Never include their lock code. No more than 100.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.customer default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01279", "domain": "bookstore", "pattern": "reminder", "batch": false, "sop": "Each Thursday at 8:30am, find every customer in the Holds sheet whose hold is tomorrow and whose status is \"waiting\". Send each one a email reminder. Let me check the messages before they go out. Then mark them reminded. Don't mention the private notes. At most 20 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 1 day and status == \"waiting\"\n for each r in due up to 20 {\n let m = draft email to r.email subject \"Your hold tomorrow\": \"Hi {r.customer}, a reminder from the store: your hold is tomorrow.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01280", "domain": "bookstore", "pattern": "reminder", "batch": false, "sop": "Each morning at 11am, find every customer in the Holds sheet whose hold is in three days and whose status is \"waiting\". Send each one a email reminder. Let me check the messages before they go out. Then mark them notified. Keep the private notes out of the message. At most 20 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 3 days and status == \"waiting\"\n for each r in due up to 20 {\n let m = draft email to r.email subject \"Your hold in three days\": \"Hi {r.customer}, a reminder from the store: your hold is in three days.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01281", "domain": "bookstore", "pattern": "reminder", "batch": false, "sop": "Each Tuesday at 5:30pm, find every customer in the Holds sheet whose hold is tomorrow and whose status is \"waiting\". Send each one a email reminder. I want to approve each message first. Then mark them reminded. Keep the private notes out of the message. At most 100 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every tuesday at 17:30\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 1 day and status == \"waiting\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your hold tomorrow\": \"Hi {r.customer}, a reminder from the store: your hold is tomorrow.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01282", "domain": "bookstore", "pattern": "reminder", "batch": false, "sop": "Each day at 5:30pm, find every customer in the Holds sheet whose hold is tomorrow and whose status is \"waiting\". Send each one a email reminder. Nothing goes out until I've approved it. Don't mention the private notes. At most 100 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 17:30\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 1 day and status == \"waiting\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your hold tomorrow\": \"Hi {r.customer}, a reminder from the store: your hold is tomorrow.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01283", "domain": "bookstore", "pattern": "reminder", "batch": false, "sop": "Every Friday at 8:30am, find every customer in the Holds sheet whose hold is tomorrow and whose status is \"waiting\". Send each one a email reminder. Let me check the messages before they go out. Keep the private notes out of the message. At most 30 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every friday at 08:30\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 1 day and status == \"waiting\"\n for each r in due up to 30 {\n let m = draft email to r.email subject \"Your hold tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the store: your hold is tomorrow.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01284", "domain": "bookstore", "pattern": "reminder", "batch": false, "sop": "Each Monday at 11am, find every customer in the Holds sheet whose hold is in two days and whose status is \"waiting\". Send each one a email reminder. Let me check the messages before they go out. Then mark them reminded. Don't mention the private notes. At most 100 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every monday at 11:00\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 2 days and status == \"waiting\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your hold in two days\": \"Hi {r.customer default 'there'}, a reminder from the store: your hold is in two days.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01285", "domain": "bookstore", "pattern": "reminder", "batch": false, "sop": "Each morning at 11am, find every customer in the Holds sheet whose hold is in two days and whose status is \"waiting\". Send each one a email reminder. I need to OK every message. Don't mention the private notes. At most 100 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 2 days and status == \"waiting\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your hold in two days\": \"Hi {r.customer}, a reminder from the store: your hold is in two days.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01286", "domain": "bookstore", "pattern": "reminder", "batch": false, "sop": "Every day at 8:30am, find every customer in the Holds sheet whose hold is in two days and whose status is \"waiting\". Send each one a email reminder. Nothing goes out until I've approved it. Don't mention the private notes. At most 50 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 2 days and status == \"waiting\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your hold in two days\": \"Hi {r.customer}, a reminder from the store: your hold is in two days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01287", "domain": "bookstore", "pattern": "reminder", "batch": true, "sop": "Every day at 11am, find every customer in the Holds sheet whose hold is in a week and whose status is \"waiting\". Send each one a email reminder. I need to OK every message. Then mark them reminded. Keep the private notes out of the message. At most 50 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 50 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 7 days and status == \"waiting\"\n let msgs = draft each r in due up to 50 email to r.email subject \"Your hold in a week\": \"Hi {r.customer default 'there'}, a reminder from the store: your hold is in a week.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01288", "domain": "bookstore", "pattern": "reminder", "batch": true, "sop": "Every day at 5:30pm, find every customer in the Holds sheet whose hold is tomorrow and whose status is \"waiting\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them notified. Keep the private notes out of the message. At most 100 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 17:30\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 1 day and status == \"waiting\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your hold tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the store: your hold is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01289", "domain": "bookstore", "pattern": "reminder", "batch": true, "sop": "Daily at 10am, find every customer in the Holds sheet whose hold is tomorrow and whose status is \"waiting\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them reminded. Keep the private notes out of the message. At most 100 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 10:00\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 1 day and status == \"waiting\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your hold tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the store: your hold is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01290", "domain": "bookstore", "pattern": "reminder", "batch": true, "sop": "Each Wednesday at 8:30am, find every customer in the Holds sheet whose hold is in two days and whose status is \"waiting\". Send each one a email reminder. I want to approve each message first. Keep the private notes out of the message. At most 50 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 50 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every wednesday at 08:30\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 2 days and status == \"waiting\"\n let msgs = draft each r in due up to 50 email to r.email subject \"Your hold in two days\": \"Hi {r.customer}, a reminder from the store: your hold is in two days.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01291", "domain": "bookstore", "pattern": "reminder", "batch": true, "sop": "Each Wednesday at 10am, find every customer in the Holds sheet whose hold is tomorrow and whose status is \"waiting\". Send each one a email reminder. I need to OK every message. Don't mention the private notes. At most 20 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 1 day and status == \"waiting\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your hold tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the store: your hold is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01292", "domain": "bookstore", "pattern": "reminder", "batch": true, "sop": "Each morning at 9am, find every customer in the Holds sheet whose hold is tomorrow and whose status is \"waiting\". Send each one a email reminder. Let me check the messages before they go out. Then mark them notified. Never include their private notes. At most 50 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 50 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 09:00\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 1 day and status == \"waiting\"\n let msgs = draft each r in due up to 50 email to r.email subject \"Your hold tomorrow\": \"Hi {r.customer}, a reminder from the store: your hold is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01293", "domain": "bookstore", "pattern": "reminder", "batch": true, "sop": "Each Tuesday at 10am, find every customer in the Holds sheet whose hold is in a week and whose status is \"waiting\". Send each one a email reminder. I need to OK every message. Then mark them notified. Never include their private notes. At most 30 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every tuesday at 10:00\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 7 days and status == \"waiting\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your hold in a week\": \"Hi {r.customer default 'there'}, a reminder from the store: your hold is in a week.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01294", "domain": "bookstore", "pattern": "followup", "batch": false, "sop": "Each Wednesday at 6pm, look for customers marked \"collected\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every wednesday at 18:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 2 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01295", "domain": "bookstore", "pattern": "followup", "batch": false, "sop": "Each morning at 11am, look for customers marked \"collected\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 2 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01296", "domain": "bookstore", "pattern": "followup", "batch": false, "sop": "Every day at 10am, look for customers marked \"collected\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Keep the private notes out of the message.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 10:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 7 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01297", "domain": "bookstore", "pattern": "followup", "batch": false, "sop": "Each morning at 10am, look for customers marked \"collected\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 10:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 3 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01298", "domain": "bookstore", "pattern": "followup", "batch": false, "sop": "Every day at 9am, look for customers marked \"collected\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 09:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 2 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01299", "domain": "bookstore", "pattern": "followup", "batch": false, "sop": "Each Thursday at 8:30am, look for customers marked \"collected\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 1 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01300", "domain": "bookstore", "pattern": "followup", "batch": false, "sop": "Daily at 11am, look for customers marked \"collected\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 1 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01301", "domain": "bookstore", "pattern": "followup", "batch": false, "sop": "On Fridays at 4pm, look for customers marked \"collected\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the private notes out of the message.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every friday at 16:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 3 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01302", "domain": "bookstore", "pattern": "followup", "batch": true, "sop": "Every Tuesday at 11am, look for customers marked \"collected\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Keep the private notes out of the message.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 40 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every tuesday at 11:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 7 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01303", "domain": "bookstore", "pattern": "followup", "batch": true, "sop": "On Tuesdays at 6pm, look for customers marked \"collected\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 2 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01304", "domain": "bookstore", "pattern": "followup", "batch": true, "sop": "Each Tuesday at 10am, look for customers marked \"collected\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every tuesday at 10:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 2 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01305", "domain": "bookstore", "pattern": "followup", "batch": true, "sop": "Daily at 11am, look for customers marked \"collected\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the private notes out of the message.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 3 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01306", "domain": "bookstore", "pattern": "followup", "batch": true, "sop": "Daily at 8:30am, look for customers marked \"collected\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 7 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01307", "domain": "bookstore", "pattern": "followup", "batch": true, "sop": "On Fridays at 11am, look for customers marked \"collected\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the private notes out of the message.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every friday at 11:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 7 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01308", "domain": "bookstore", "pattern": "followup", "batch": true, "sop": "On Thursdays at 8am, look for customers marked \"collected\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every thursday at 08:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 3 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01309", "domain": "bookstore", "pattern": "lapsed", "batch": false, "sop": "Daily at 8:30am, find customers whose held until was at least 90 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 90 and status != \"expired\"\n let oldest = sort old by held_until first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the store.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01310", "domain": "bookstore", "pattern": "lapsed", "batch": false, "sop": "On Thursdays at 5:30pm, find customers whose held until was at least 30 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Keep the private notes out of the message.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 30 and status != \"expired\"\n let oldest = sort old by held_until first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the store.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01311", "domain": "bookstore", "pattern": "lapsed", "batch": false, "sop": "Each day at 4pm, find customers whose held until was at least 30 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 16:00\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 30 and status != \"expired\"\n let oldest = sort old by held_until first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the store.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01312", "domain": "bookstore", "pattern": "lapsed", "batch": false, "sop": "Each morning at 9am, find customers whose held until was at least 60 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the private notes out of the message.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 09:00\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 60 and status != \"expired\"\n let oldest = sort old by held_until first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the store.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01313", "domain": "bookstore", "pattern": "lapsed", "batch": false, "sop": "Every day at 9am, find customers whose held until was at least 30 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 09:00\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 30 and status != \"expired\"\n let oldest = sort old by held_until first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the store.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01314", "domain": "bookstore", "pattern": "lapsed", "batch": false, "sop": "Each morning at 10am, find customers whose held until was at least 90 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 10:00\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 90 and status != \"expired\"\n let oldest = sort old by held_until first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the store.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01315", "domain": "bookstore", "pattern": "lapsed", "batch": false, "sop": "Each day at 6pm, find customers whose held until was at least 30 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 18:00\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 30 and status != \"expired\"\n let oldest = sort old by held_until first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the store.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01316", "domain": "bookstore", "pattern": "lapsed", "batch": false, "sop": "Daily at 8:30am, find customers whose held until was at least 30 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 30 and status != \"expired\"\n let oldest = sort old by held_until first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the store.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01317", "domain": "bookstore", "pattern": "lapsed", "batch": true, "sop": "Every Thursday at 10am, find customers whose held until was at least 90 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 90 and status != \"expired\"\n let oldest = sort old by held_until first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the store.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01318", "domain": "bookstore", "pattern": "lapsed", "batch": true, "sop": "Daily at 9am, find customers whose held until was at least 60 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 09:00\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 60 and status != \"expired\"\n let oldest = sort old by held_until first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the store.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01319", "domain": "bookstore", "pattern": "lapsed", "batch": true, "sop": "Daily at 11am, find customers whose held until was at least 60 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 60 and status != \"expired\"\n let oldest = sort old by held_until first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the store.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01320", "domain": "bookstore", "pattern": "lapsed", "batch": true, "sop": "Daily at 10am, find customers whose held until was at least 60 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the private notes out of the message.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 10:00\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 60 and status != \"expired\"\n let oldest = sort old by held_until first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the store.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01321", "domain": "bookstore", "pattern": "lapsed", "batch": true, "sop": "Each Friday at 8:30am, find customers whose held until was at least 42 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every friday at 08:30\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 42 and status != \"expired\"\n let oldest = sort old by held_until first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the store.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01322", "domain": "bookstore", "pattern": "lapsed", "batch": true, "sop": "Every day at 9am, find customers whose held until was at least 42 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Keep the private notes out of the message.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 09:00\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 42 and status != \"expired\"\n let oldest = sort old by held_until first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the store.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01323", "domain": "bookstore", "pattern": "lapsed", "batch": true, "sop": "Daily at 9am, find customers whose held until was at least 90 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 09:00\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 90 and status != \"expired\"\n let oldest = sort old by held_until first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the store.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01324", "domain": "bookstore", "pattern": "summary", "batch": false, "sop": "Every day at 11am, count the customers in Holds whose status is \"ready\", and send the numbers to me only. Don't message any customers.", "policy": "policy BookstorePolicy {\n allow read Holds(status, prepaid, customer, email)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Holds\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n notify owner \"Ready customers today: {n}\"\n}"} {"id": "train-01325", "domain": "bookstore", "pattern": "summary", "batch": false, "sop": "Daily at 11am, count the customers in Holds whose status is \"ready\", and send the numbers to me only. Don't message any customers.", "policy": "policy BookstorePolicy {\n allow read Holds(status, prepaid, customer, email)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Holds\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n notify owner \"Ready customers today: {n}\"\n}"} {"id": "train-01326", "domain": "bookstore", "pattern": "summary", "batch": false, "sop": "Each morning at 8:30am, count the customers in Holds whose status is \"waiting\" and the total prepaid amount, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BookstorePolicy {\n allow read Holds(status, prepaid, customer, email)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreDailySummary {\n about \"Tell the owner how many customers are waiting\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 08:30\n\n let all = fetch Holds\n let these = filter all where status == \"waiting\"\n let n = summarize count of these\n let total = summarize sum prepaid of these\n if n == 0 {\n stop \"no waiting customers\"\n }\n notify owner \"Waiting customers: {n}, total prepaid: {total}\"\n}"} {"id": "train-01327", "domain": "bookstore", "pattern": "summary", "batch": false, "sop": "Each morning at 10am, count the customers in Holds whose status is \"ready\", and send the numbers to me only. Don't message any customers.", "policy": "policy BookstorePolicy {\n allow read Holds(status, prepaid, customer, email)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 10:00\n\n let all = fetch Holds\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n notify owner \"Ready customers today: {n}\"\n}"} {"id": "train-01328", "domain": "bookstore", "pattern": "summary", "batch": false, "sop": "Every Tuesday at 6pm, count the customers in Holds whose status is \"waiting\" and the total prepaid amount, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BookstorePolicy {\n allow read Holds(status, prepaid, customer, email, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreDailySummary {\n about \"Tell the owner how many customers are waiting\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Holds\n let these = filter all where status == \"waiting\"\n let n = summarize count of these\n let total = summarize sum prepaid of these\n if n == 0 {\n stop \"no waiting customers\"\n }\n notify owner \"Waiting customers: {n}, total prepaid: {total}\"\n}"} {"id": "train-01329", "domain": "bookstore", "pattern": "summary", "batch": false, "sop": "Every day at 5:30pm, count the customers in Holds whose status is \"waiting\" and the total prepaid amount, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BookstorePolicy {\n allow read Holds(status, prepaid, customer, email)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreDailySummary {\n about \"Tell the owner how many customers are waiting\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 17:30\n\n let all = fetch Holds\n let these = filter all where status == \"waiting\"\n let n = summarize count of these\n let total = summarize sum prepaid of these\n if n == 0 {\n stop \"no waiting customers\"\n }\n notify owner \"Waiting customers: {n}, total prepaid: {total}\"\n}"} {"id": "train-01330", "domain": "bookstore", "pattern": "summary", "batch": false, "sop": "Each morning at 11am, count the customers in Holds whose status is \"ready\", and send the numbers to me only. Don't message any customers.", "policy": "policy BookstorePolicy {\n allow read Holds(status, prepaid, customer, email)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreDailySummary {\n about \"Tell the owner how many customers are ready\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Holds\n let these = filter all where status == \"ready\"\n let n = summarize count of these\n notify owner \"Ready customers today: {n}\"\n}"} {"id": "train-01331", "domain": "bookstore", "pattern": "summary", "batch": false, "sop": "Each day at 6pm, count the customers in Holds whose status is \"collected\" and the total prepaid amount, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy BookstorePolicy {\n allow read Holds(status, prepaid, customer, email)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreDailySummary {\n about \"Tell the owner how many customers are collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 18:00\n\n let all = fetch Holds\n let these = filter all where status == \"collected\"\n let n = summarize count of these\n let total = summarize sum prepaid of these\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers: {n}, total prepaid: {total}\"\n}"} {"id": "train-01332", "domain": "bookstore", "pattern": "reorder", "batch": false, "sop": "On Wednesdays at 4pm, check Inventory. For anything below its minimum, order the usual reorder amount from its distributor. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy BookstoreStockPolicy {\n allow read Inventory(title, copies, minimum, reorder_qty, distributor, unit_cost)\n allow supplier Inventory.distributor\n limit order $250 per action\n limit order $750 per day\n}", "sheets": "sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }", "program": "procedure BookstoreReorder {\n about \"Reorder books below their minimum\"\n policy BookstoreStockPolicy\n sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }\n trigger every wednesday at 16:00\n\n let all = fetch Inventory\n let low = filter all where copies < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $250.00 {\n notify owner \"Reorder of {i.title} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.title}\" from i.distributor cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.title}\"\n }\n}"} {"id": "train-01333", "domain": "bookstore", "pattern": "reorder", "batch": false, "sop": "On Fridays at 9am, check Inventory. For anything below its minimum, order the usual reorder amount from its distributor. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy BookstoreStockPolicy {\n allow read Inventory(title, copies, minimum, reorder_qty, distributor, unit_cost)\n allow supplier Inventory.distributor\n limit order $150 per action\n limit order $450 per day\n}", "sheets": "sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }", "program": "procedure BookstoreReorder {\n about \"Reorder books below their minimum\"\n policy BookstoreStockPolicy\n sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }\n trigger every friday at 09:00\n\n let all = fetch Inventory\n let low = filter all where copies < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.title} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.title}\" from i.distributor cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.title}\"\n }\n}"} {"id": "train-01334", "domain": "bookstore", "pattern": "reorder", "batch": false, "sop": "Daily at 11am, check Inventory. For anything below its minimum, order the usual reorder amount from its distributor. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy BookstoreStockPolicy {\n allow read Inventory(title, copies, minimum, reorder_qty, distributor, unit_cost)\n allow supplier Inventory.distributor\n limit order $100 per action\n limit order $500 per day\n}", "sheets": "sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }", "program": "procedure BookstoreReorder {\n about \"Reorder books below their minimum\"\n policy BookstoreStockPolicy\n sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }\n trigger every day at 11:00\n\n let all = fetch Inventory\n let low = filter all where copies < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.title} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.title}\" from i.distributor cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.title}\"\n }\n}"} {"id": "train-01335", "domain": "bookstore", "pattern": "reorder", "batch": false, "sop": "On Tuesdays at 11am, check Inventory. For anything below its minimum, order the usual reorder amount from its distributor. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 2 items per run.", "policy": "policy BookstoreStockPolicy {\n allow read Inventory(title, copies, minimum, reorder_qty, distributor, unit_cost)\n allow supplier Inventory.distributor\n limit order $150 per action\n limit order $300 per day\n}", "sheets": "sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }", "program": "procedure BookstoreReorder {\n about \"Reorder books below their minimum\"\n policy BookstoreStockPolicy\n sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }\n trigger every tuesday at 11:00\n\n let all = fetch Inventory\n let low = filter all where copies < minimum\n for each i in low up to 2 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.title} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.title}\" from i.distributor cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.title}\"\n }\n}"} {"id": "train-01336", "domain": "bookstore", "pattern": "reorder", "batch": false, "sop": "Each day at 4pm, check Inventory. For anything below its minimum, order the usual reorder amount from its distributor. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy BookstoreStockPolicy {\n allow read Inventory(title, copies, minimum, reorder_qty, distributor, unit_cost)\n allow supplier Inventory.distributor\n limit order $250 per action\n limit order $1250 per day\n}", "sheets": "sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }", "program": "procedure BookstoreReorder {\n about \"Reorder books below their minimum\"\n policy BookstoreStockPolicy\n sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }\n trigger every day at 16:00\n\n let all = fetch Inventory\n let low = filter all where copies < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $250.00 {\n notify owner \"Reorder of {i.title} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.title}\" from i.distributor cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.title}\"\n }\n}"} {"id": "train-01337", "domain": "bookstore", "pattern": "reorder", "batch": false, "sop": "Daily at 9am, check Inventory. For anything below its minimum, order the usual reorder amount from its distributor. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy BookstoreStockPolicy {\n allow read Inventory(title, copies, minimum, reorder_qty, distributor, unit_cost)\n allow supplier Inventory.distributor\n limit order $250 per action\n limit order $750 per day\n}", "sheets": "sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }", "program": "procedure BookstoreReorder {\n about \"Reorder books below their minimum\"\n policy BookstoreStockPolicy\n sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }\n trigger every day at 09:00\n\n let all = fetch Inventory\n let low = filter all where copies < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $250.00 {\n notify owner \"Reorder of {i.title} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.title}\" from i.distributor cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.title}\"\n }\n}"} {"id": "train-01338", "domain": "bookstore", "pattern": "reorder", "batch": false, "sop": "Every day at 11am, check Inventory. For anything below its minimum, order the usual reorder amount from its distributor. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy BookstoreStockPolicy {\n allow read Inventory(title, copies, minimum, reorder_qty, distributor, unit_cost)\n allow supplier Inventory.distributor\n limit order $150 per action\n limit order $750 per day\n}", "sheets": "sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }", "program": "procedure BookstoreReorder {\n about \"Reorder books below their minimum\"\n policy BookstoreStockPolicy\n sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }\n trigger every day at 11:00\n\n let all = fetch Inventory\n let low = filter all where copies < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.title} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.title}\" from i.distributor cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.title}\"\n }\n}"} {"id": "train-01339", "domain": "bookstore", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $50, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BookstoreRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $300 per day\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BookstoreRefunds {\n about \"Handle refund requests within limits\"\n policy BookstoreRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01340", "domain": "bookstore", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BookstoreRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $375 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BookstoreRefunds {\n about \"Handle refund requests within limits\"\n policy BookstoreRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01341", "domain": "bookstore", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BookstoreRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $200 per day\n refund without approval up to $20\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BookstoreRefunds {\n about \"Handle refund requests within limits\"\n policy BookstoreRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01342", "domain": "bookstore", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BookstoreRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $300 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BookstoreRefunds {\n about \"Handle refund requests within limits\"\n policy BookstoreRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01343", "domain": "bookstore", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BookstoreRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $150 per day\n refund without approval up to $20\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BookstoreRefunds {\n about \"Handle refund requests within limits\"\n policy BookstoreRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01344", "domain": "bookstore", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BookstoreRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BookstoreRefunds {\n about \"Handle refund requests within limits\"\n policy BookstoreRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01345", "domain": "bookstore", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Holds, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"ready\" or \"expired\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger when new row r in Holds\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the store! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Holds\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"expired\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01346", "domain": "bookstore", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Holds, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"ready\" or \"expired\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger when new row r in Holds\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the store! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Holds\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"expired\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01347", "domain": "bookstore", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Holds, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"ready\" or \"expired\", stop. Otherwise send one check-in message. I need to OK every message. Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger when new row r in Holds\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the store! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Holds\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"expired\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01348", "domain": "bookstore", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Holds, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"ready\" or \"expired\", stop. Otherwise send one check-in message. I want to approve each message first. Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger when new row r in Holds\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the store! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Holds\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"expired\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01349", "domain": "bookstore", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Holds, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"ready\" or \"expired\", stop. Otherwise send one check-in message. I need to OK every message. Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger when new row r in Holds\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the store! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Holds\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"expired\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01350", "domain": "bookstore", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Holds, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"ready\" or \"expired\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger when new row r in Holds\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the store! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Holds\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"expired\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01351", "domain": "bookstore", "pattern": "escalation", "batch": false, "sop": "Daily at 8am: for customers with a prepaid amount above zero whose hold passed more than 5 days ago, send a polite reminder with the amount. Show me the messages for approval first. If it's more than 30 days late, don't message them; tell me so I can call. Don't mention the private notes. At most 30 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, prepaid)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 08:00\n\n let all = fetch Holds\n let late = filter all where prepaid > $0.00 and days_between(held_until, today()) > 5\n for each r in late up to 30 {\n if days_between(r.held_until, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.prepaid}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a prepaid of {r.prepaid}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01352", "domain": "bookstore", "pattern": "escalation", "batch": false, "sop": "Every day at 8am: for customers with a prepaid amount above zero whose hold passed more than 7 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 21 days late, don't message them; tell me so I can call. Don't mention the private notes. At most 40 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, prepaid, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 08:00\n\n let all = fetch Holds\n let late = filter all where prepaid > $0.00 and days_between(held_until, today()) > 7\n for each r in late up to 40 {\n if days_between(r.held_until, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.prepaid}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a prepaid of {r.prepaid}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01353", "domain": "bookstore", "pattern": "escalation", "batch": false, "sop": "Daily at 11am: for customers with a prepaid amount above zero whose hold passed more than 5 days ago, send a polite reminder with the amount. Show me the messages for approval first. If it's more than 30 days late, don't message them; tell me so I can call. Don't mention the private notes. At most 30 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, prepaid, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 11:00\n\n let all = fetch Holds\n let late = filter all where prepaid > $0.00 and days_between(held_until, today()) > 5\n for each r in late up to 30 {\n if days_between(r.held_until, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.prepaid}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a prepaid of {r.prepaid}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01354", "domain": "bookstore", "pattern": "escalation", "batch": false, "sop": "Daily at 9am: for customers with a prepaid amount above zero whose hold passed more than 3 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 14 days late, don't message them; tell me so I can call. Never include their private notes. At most 40 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, prepaid)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 09:00\n\n let all = fetch Holds\n let late = filter all where prepaid > $0.00 and days_between(held_until, today()) > 3\n for each r in late up to 40 {\n if days_between(r.held_until, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.prepaid}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a prepaid of {r.prepaid}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-01355", "domain": "bookstore", "pattern": "escalation", "batch": false, "sop": "Every Monday at 10am: for customers with a prepaid amount above zero whose hold passed more than 7 days ago, send a polite reminder with the amount. Show me the messages for approval first. If it's more than 21 days late, don't message them; tell me so I can call. Don't mention the private notes. At most 20 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, prepaid, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every monday at 10:00\n\n let all = fetch Holds\n let late = filter all where prepaid > $0.00 and days_between(held_until, today()) > 7\n for each r in late up to 20 {\n if days_between(r.held_until, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.prepaid}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a prepaid of {r.prepaid}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-01356", "domain": "bookstore", "pattern": "escalation", "batch": false, "sop": "Each Thursday at 6pm: for customers with a prepaid amount above zero whose hold passed more than 3 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 14 days late, don't message them; tell me so I can call. Never include their private notes. At most 40 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, prepaid, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every thursday at 18:00\n\n let all = fetch Holds\n let late = filter all where prepaid > $0.00 and days_between(held_until, today()) > 3\n for each r in late up to 40 {\n if days_between(r.held_until, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.prepaid}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a prepaid of {r.prepaid}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-01357", "domain": "bookstore", "pattern": "escalation", "batch": false, "sop": "Each morning at 8am: for customers with a prepaid amount above zero whose hold passed more than 7 days ago, send a polite reminder with the amount. Show me the messages for approval first. If it's more than 21 days late, don't message them; tell me so I can call. Keep the private notes out of the message. At most 40 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, prepaid, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 08:00\n\n let all = fetch Holds\n let late = filter all where prepaid > $0.00 and days_between(held_until, today()) > 7\n for each r in late up to 40 {\n if days_between(r.held_until, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.prepaid}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a prepaid of {r.prepaid}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-01358", "domain": "bookstore", "pattern": "escalation", "batch": false, "sop": "Each Wednesday at 6pm: for customers with a prepaid amount above zero whose hold passed more than 5 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 30 days late, don't message them; tell me so I can call. Never include their private notes. At most 40 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, prepaid)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every wednesday at 18:00\n\n let all = fetch Holds\n let late = filter all where prepaid > $0.00 and days_between(held_until, today()) > 5\n for each r in late up to 40 {\n if days_between(r.held_until, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.prepaid}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a prepaid of {r.prepaid}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-01359", "domain": "bookstore", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Keep the private notes out of the message. No more than 50.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the store! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01360", "domain": "bookstore", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Never include their private notes. No more than 100.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the store! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01361", "domain": "bookstore", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Never include their private notes. No more than 100.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the store! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01362", "domain": "bookstore", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Don't mention the private notes. No more than 50.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the store! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01363", "domain": "bookstore", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the private notes out of the message. No more than 50.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the store! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01364", "domain": "bookstore", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the private notes out of the message. No more than 50.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the store! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01365", "domain": "bookstore", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Don't mention the private notes. No more than 50.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the store! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01366", "domain": "bookstore", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Never include their private notes. No more than 50.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the store! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01367", "domain": "bookstore", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Never include their private notes. No more than 50.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the store! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01368", "domain": "bookstore", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Don't mention the private notes. No more than 100.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the store! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01369", "domain": "bookstore", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Don't mention the private notes. No more than 100.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the store! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01370", "domain": "bookstore", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Don't mention the private notes. No more than 100.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the store! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01371", "domain": "yoga", "pattern": "reminder", "batch": false, "sop": "Daily at 8:30am, find every student in the Passes sheet whose class pass is in three days and whose status is \"active\". Send each one a email reminder. Show me the messages for approval first. Keep the injury notes out of the message. At most 50 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 3 days and status == \"active\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your class pass in three days\": \"Hi {r.name default 'there'}, a reminder from the studio: your class pass is in three days.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01372", "domain": "yoga", "pattern": "reminder", "batch": false, "sop": "Every day at 9am, find every student in the Passes sheet whose class pass is in two days and whose status is \"active\". Send each one a email reminder. Let me check the messages before they go out. Keep the injury notes out of the message. At most 30 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 2 days and status == \"active\"\n for each r in due up to 30 {\n let m = draft email to r.email subject \"Your class pass in two days\": \"Hi {r.name}, a reminder from the studio: your class pass is in two days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01373", "domain": "yoga", "pattern": "reminder", "batch": false, "sop": "Every day at 10am, find every student in the Passes sheet whose class pass is tomorrow and whose status is \"active\". Send each one a email reminder. I need to OK every message. Then mark them notified. Don't mention the injury notes. At most 100 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 1 day and status == \"active\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your class pass tomorrow\": \"Hi {r.name default 'there'}, a reminder from the studio: your class pass is tomorrow.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01374", "domain": "yoga", "pattern": "reminder", "batch": false, "sop": "Every day at 6pm, find every student in the Passes sheet whose class pass is in a week and whose status is \"active\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Don't mention the injury notes. At most 100 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 7 days and status == \"active\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your class pass in a week\": \"Hi {r.name default 'there'}, a reminder from the studio: your class pass is in a week.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01375", "domain": "yoga", "pattern": "reminder", "batch": false, "sop": "Each morning at 8:30am, find every student in the Passes sheet whose class pass is tomorrow and whose status is \"active\". Send each one a email reminder. Show me the messages for approval first. Never include their injury notes. At most 50 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 1 day and status == \"active\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your class pass tomorrow\": \"Hi {r.name default 'there'}, a reminder from the studio: your class pass is tomorrow.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01376", "domain": "yoga", "pattern": "reminder", "batch": false, "sop": "Each Thursday at 8:30am, find every student in the Passes sheet whose class pass is tomorrow and whose status is \"active\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them reminded. Never include their injury notes. At most 100 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 1 day and status == \"active\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your class pass tomorrow\": \"Hi {r.name default 'there'}, a reminder from the studio: your class pass is tomorrow.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01377", "domain": "yoga", "pattern": "reminder", "batch": false, "sop": "Each morning at 11am, find every student in the Passes sheet whose class pass is tomorrow and whose status is \"active\". Send each one a email reminder. Show me the messages for approval first. Then mark them notified. Never include their injury notes. At most 50 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 1 day and status == \"active\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your class pass tomorrow\": \"Hi {r.name default 'there'}, a reminder from the studio: your class pass is tomorrow.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01378", "domain": "yoga", "pattern": "reminder", "batch": false, "sop": "Each Wednesday at 4pm, find every student in the Passes sheet whose class pass is in two days and whose status is \"active\". Send each one a email reminder. Let me check the messages before they go out. Then mark them notified. Never include their injury notes. At most 50 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every wednesday at 16:00\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 2 days and status == \"active\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your class pass in two days\": \"Hi {r.name}, a reminder from the studio: your class pass is in two days.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01379", "domain": "yoga", "pattern": "reminder", "batch": true, "sop": "Each Friday at 5:30pm, find every student in the Passes sheet whose class pass is in a week and whose status is \"active\". Send each one a email reminder. I want to approve each message first. Keep the injury notes out of the message. At most 100 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every friday at 17:30\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 7 days and status == \"active\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your class pass in a week\": \"Hi {r.name default 'there'}, a reminder from the studio: your class pass is in a week.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01380", "domain": "yoga", "pattern": "reminder", "batch": true, "sop": "Daily at 8am, find every student in the Passes sheet whose class pass is in three days and whose status is \"active\". Send each one a email reminder. Let me check the messages before they go out. Don't mention the injury notes. At most 100 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 3 days and status == \"active\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your class pass in three days\": \"Hi {r.name default 'there'}, a reminder from the studio: your class pass is in three days.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01381", "domain": "yoga", "pattern": "reminder", "batch": true, "sop": "Each morning at 10am, find every student in the Passes sheet whose class pass is in three days and whose status is \"active\". Send each one a email reminder. I need to OK every message. Then mark them notified. Keep the injury notes out of the message. At most 100 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 3 days and status == \"active\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your class pass in three days\": \"Hi {r.name}, a reminder from the studio: your class pass is in three days.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01382", "domain": "yoga", "pattern": "reminder", "batch": true, "sop": "Every day at 8am, find every student in the Passes sheet whose class pass is tomorrow and whose status is \"active\". Send each one a email reminder. Show me the messages for approval first. Never include their injury notes. At most 30 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 1 day and status == \"active\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your class pass tomorrow\": \"Hi {r.name default 'there'}, a reminder from the studio: your class pass is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01383", "domain": "yoga", "pattern": "reminder", "batch": true, "sop": "Each day at 4pm, find every student in the Passes sheet whose class pass is in three days and whose status is \"active\". Send each one a email reminder. Show me the messages for approval first. Then mark them reminded. Never include their injury notes. At most 20 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 3 days and status == \"active\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your class pass in three days\": \"Hi {r.name default 'there'}, a reminder from the studio: your class pass is in three days.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01384", "domain": "yoga", "pattern": "reminder", "batch": true, "sop": "Every Wednesday at 8:30am, find every student in the Passes sheet whose class pass is in three days and whose status is \"active\". Send each one a email reminder. I need to OK every message. Never include their injury notes. At most 30 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every wednesday at 08:30\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 3 days and status == \"active\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your class pass in three days\": \"Hi {r.name default 'there'}, a reminder from the studio: your class pass is in three days.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01385", "domain": "yoga", "pattern": "reminder", "batch": true, "sop": "Each Monday at 4pm, find every student in the Passes sheet whose class pass is tomorrow and whose status is \"active\". Send each one a email reminder. Show me the messages for approval first. Then mark them reminded. Keep the injury notes out of the message. At most 30 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every monday at 16:00\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 1 day and status == \"active\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your class pass tomorrow\": \"Hi {r.name}, a reminder from the studio: your class pass is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01386", "domain": "yoga", "pattern": "reminder", "batch": true, "sop": "Each day at 6pm, find every student in the Passes sheet whose class pass is in three days and whose status is \"active\". Send each one a email reminder. I want to approve each message first. Never include their injury notes. At most 50 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 50 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaClassPassReminders {\n about \"Remind each student about their class pass\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Passes\n let due = filter all where expires_on == today() + 3 days and status == \"active\"\n let msgs = draft each r in due up to 50 email to r.email subject \"Your class pass in three days\": \"Hi {r.name default 'there'}, a reminder from the studio: your class pass is in three days.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01387", "domain": "yoga", "pattern": "followup", "batch": false, "sop": "Each day at 6pm, look for students marked \"paused\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 2 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01388", "domain": "yoga", "pattern": "followup", "batch": false, "sop": "Every day at 8:30am, look for students marked \"paused\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 1 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01389", "domain": "yoga", "pattern": "followup", "batch": false, "sop": "On Mondays at 10am, look for students marked \"paused\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every monday at 10:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 2 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01390", "domain": "yoga", "pattern": "followup", "batch": false, "sop": "Each morning at 11am, look for students marked \"paused\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 1 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01391", "domain": "yoga", "pattern": "followup", "batch": false, "sop": "Every Friday at 4pm, look for students marked \"paused\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every friday at 16:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 1 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01392", "domain": "yoga", "pattern": "followup", "batch": false, "sop": "Every Wednesday at 8:30am, look for students marked \"paused\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Keep the injury notes out of the message.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every wednesday at 08:30\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 3 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01393", "domain": "yoga", "pattern": "followup", "batch": false, "sop": "Each Thursday at 10am, look for students marked \"paused\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 7 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01394", "domain": "yoga", "pattern": "followup", "batch": true, "sop": "Each day at 4pm, look for students marked \"paused\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 7 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01395", "domain": "yoga", "pattern": "followup", "batch": true, "sop": "Every Friday at 4pm, look for students marked \"paused\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Keep the injury notes out of the message.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 40 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every friday at 16:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 2 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01396", "domain": "yoga", "pattern": "followup", "batch": true, "sop": "Every Tuesday at 6pm, look for students marked \"paused\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 7 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01397", "domain": "yoga", "pattern": "followup", "batch": true, "sop": "Every day at 8am, look for students marked \"paused\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Keep the injury notes out of the message.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 3 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01398", "domain": "yoga", "pattern": "followup", "batch": true, "sop": "Daily at 6pm, look for students marked \"paused\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 3 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01399", "domain": "yoga", "pattern": "followup", "batch": true, "sop": "Each morning at 8:30am, look for students marked \"paused\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Keep the injury notes out of the message.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 3 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01400", "domain": "yoga", "pattern": "followup", "batch": true, "sop": "Each day at 6pm, look for students marked \"paused\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 40 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 2 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01401", "domain": "yoga", "pattern": "lapsed", "batch": false, "sop": "Every day at 11am, find students whose expires on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by expires_on first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01402", "domain": "yoga", "pattern": "lapsed", "batch": false, "sop": "On Fridays at 10am, find students whose expires on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the injury notes out of the message.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every friday at 10:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by expires_on first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01403", "domain": "yoga", "pattern": "lapsed", "batch": false, "sop": "On Thursdays at 10am, find students whose expires on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by expires_on first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01404", "domain": "yoga", "pattern": "lapsed", "batch": false, "sop": "Daily at 4pm, find students whose expires on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by expires_on first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01405", "domain": "yoga", "pattern": "lapsed", "batch": false, "sop": "Each day at 4pm, find students whose expires on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by expires_on first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01406", "domain": "yoga", "pattern": "lapsed", "batch": false, "sop": "Every day at 11am, find students whose expires on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by expires_on first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01407", "domain": "yoga", "pattern": "lapsed", "batch": false, "sop": "Every Friday at 11am, find students whose expires on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every friday at 11:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by expires_on first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01408", "domain": "yoga", "pattern": "lapsed", "batch": true, "sop": "Each Monday at 6pm, find students whose expires on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Keep the injury notes out of the message.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every monday at 18:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by expires_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01409", "domain": "yoga", "pattern": "lapsed", "batch": true, "sop": "Daily at 6pm, find students whose expires on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by expires_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01410", "domain": "yoga", "pattern": "lapsed", "batch": true, "sop": "Daily at 8am, find students whose expires on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Keep the injury notes out of the message.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by expires_on first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01411", "domain": "yoga", "pattern": "lapsed", "batch": true, "sop": "Each Wednesday at 10am, find students whose expires on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Keep the injury notes out of the message.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 10 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by expires_on first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01412", "domain": "yoga", "pattern": "lapsed", "batch": true, "sop": "Daily at 5:30pm, find students whose expires on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by expires_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01413", "domain": "yoga", "pattern": "lapsed", "batch": true, "sop": "Each Wednesday at 4pm, find students whose expires on was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I want to approve each message first. Keep the injury notes out of the message.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every wednesday at 16:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by expires_on first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01414", "domain": "yoga", "pattern": "lapsed", "batch": true, "sop": "Daily at 5:30pm, find students whose expires on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by expires_on first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01415", "domain": "yoga", "pattern": "lapsed", "batch": true, "sop": "Each Thursday at 4pm, find students whose expires on was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every thursday at 16:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by expires_on first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.name}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01416", "domain": "yoga", "pattern": "summary", "batch": false, "sop": "Each day at 4pm, count the students in Passes whose status is \"active\" and the total credit, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy YogaPolicy {\n allow read Passes(status, credit, name, email, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaDailySummary {\n about \"Tell the owner how many students are active\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Passes\n let these = filter all where status == \"active\"\n let n = summarize count of these\n let total = summarize sum credit of these\n if n == 0 {\n stop \"no active students\"\n }\n notify owner \"Active students: {n}, total credit: {total}\"\n}"} {"id": "train-01417", "domain": "yoga", "pattern": "summary", "batch": false, "sop": "Each morning at 8am, count the students in Passes whose status is \"paused\" and the total credit, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy YogaPolicy {\n allow read Passes(status, credit, name, email)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaDailySummary {\n about \"Tell the owner how many students are paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Passes\n let these = filter all where status == \"paused\"\n let n = summarize count of these\n let total = summarize sum credit of these\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students: {n}, total credit: {total}\"\n}"} {"id": "train-01418", "domain": "yoga", "pattern": "summary", "batch": false, "sop": "Every day at 8am, count the students in Passes whose status is \"expired\", and send the numbers to me only. Don't message any students.", "policy": "policy YogaPolicy {\n allow read Passes(status, credit, name, email)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaDailySummary {\n about \"Tell the owner how many students are expired\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Passes\n let these = filter all where status == \"expired\"\n let n = summarize count of these\n notify owner \"Expired students today: {n}\"\n}"} {"id": "train-01419", "domain": "yoga", "pattern": "summary", "batch": false, "sop": "Each Tuesday at 11am, count the students in Passes whose status is \"paused\" and the total credit, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy YogaPolicy {\n allow read Passes(status, credit, name, email)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaDailySummary {\n about \"Tell the owner how many students are paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every tuesday at 11:00\n\n let all = fetch Passes\n let these = filter all where status == \"paused\"\n let n = summarize count of these\n let total = summarize sum credit of these\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students: {n}, total credit: {total}\"\n}"} {"id": "train-01420", "domain": "yoga", "pattern": "summary", "batch": false, "sop": "On Thursdays at 11am, count the students in Passes whose status is \"expired\" and the total credit, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy YogaPolicy {\n allow read Passes(status, credit, name, email, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaDailySummary {\n about \"Tell the owner how many students are expired\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Passes\n let these = filter all where status == \"expired\"\n let n = summarize count of these\n let total = summarize sum credit of these\n if n == 0 {\n stop \"no expired students\"\n }\n notify owner \"Expired students: {n}, total credit: {total}\"\n}"} {"id": "train-01421", "domain": "yoga", "pattern": "summary", "batch": false, "sop": "Each day at 5:30pm, count the students in Passes whose status is \"active\" and the total credit, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy YogaPolicy {\n allow read Passes(status, credit, name, email)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaDailySummary {\n about \"Tell the owner how many students are active\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Passes\n let these = filter all where status == \"active\"\n let n = summarize count of these\n let total = summarize sum credit of these\n if n == 0 {\n stop \"no active students\"\n }\n notify owner \"Active students: {n}, total credit: {total}\"\n}"} {"id": "train-01422", "domain": "yoga", "pattern": "summary", "batch": false, "sop": "Daily at 5:30pm, count the students in Passes whose status is \"paused\", and send the numbers to me only. Don't message any students.", "policy": "policy YogaPolicy {\n allow read Passes(status, credit, name, email)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaDailySummary {\n about \"Tell the owner how many students are paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Passes\n let these = filter all where status == \"paused\"\n let n = summarize count of these\n notify owner \"Paused students today: {n}\"\n}"} {"id": "train-01423", "domain": "yoga", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy YogaRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $240 per day\n refund without approval up to $15\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure YogaRefunds {\n about \"Handle refund requests within limits\"\n policy YogaRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01424", "domain": "yoga", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $75, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy YogaRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $225 per day\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure YogaRefunds {\n about \"Handle refund requests within limits\"\n policy YogaRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01425", "domain": "yoga", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy YogaRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $240 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure YogaRefunds {\n about \"Handle refund requests within limits\"\n policy YogaRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01426", "domain": "yoga", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy YogaRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $15\n limit sends 30 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure YogaRefunds {\n about \"Handle refund requests within limits\"\n policy YogaRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01427", "domain": "yoga", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy YogaRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $300 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure YogaRefunds {\n about \"Handle refund requests within limits\"\n policy YogaRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01428", "domain": "yoga", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy YogaRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $10\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure YogaRefunds {\n about \"Handle refund requests within limits\"\n policy YogaRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01429", "domain": "yoga", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy YogaRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $450 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure YogaRefunds {\n about \"Handle refund requests within limits\"\n policy YogaRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01430", "domain": "yoga", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy YogaRefundPolicy {\n allow read RefundRequests(request_id, name, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $240 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure YogaRefunds {\n about \"Handle refund requests within limits\"\n policy YogaRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, name: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01431", "domain": "yoga", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Passes, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger when new row r in Passes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name default 'there'}, thanks for choosing the studio! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Passes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01432", "domain": "yoga", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Passes, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger when new row r in Passes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name default 'there'}, thanks for choosing the studio! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Passes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01433", "domain": "yoga", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Passes, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger when new row r in Passes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name}, thanks for choosing the studio! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Passes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01434", "domain": "yoga", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Passes, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger when new row r in Passes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name default 'there'}, thanks for choosing the studio! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Passes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01435", "domain": "yoga", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Passes, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger when new row r in Passes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name default 'there'}, thanks for choosing the studio! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Passes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01436", "domain": "yoga", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Passes, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger when new row r in Passes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name}, thanks for choosing the studio! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Passes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01437", "domain": "yoga", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Passes, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger when new row r in Passes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name default 'there'}, thanks for choosing the studio! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Passes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01438", "domain": "yoga", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Passes, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"expired\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger when new row r in Passes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.name default 'there'}, thanks for choosing the studio! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Passes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"expired\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01439", "domain": "yoga", "pattern": "escalation", "batch": false, "sop": "On Wednesdays at 9am: for students with a credit above zero whose class pass passed more than 3 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 14 days late, don't message them; tell me so I can call. Never include their injury notes. At most 40 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, credit, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaLateBalance {\n about \"Remind late students; escalate very late ones\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every wednesday at 09:00\n\n let all = fetch Passes\n let late = filter all where credit > $0.00 and days_between(expires_on, today()) > 3\n for each r in late up to 40 {\n if days_between(r.expires_on, today()) > 14 {\n notify owner \"{r.name} is very late ({r.credit}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name default 'there'}, our records show a credit of {r.credit}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-01440", "domain": "yoga", "pattern": "escalation", "batch": false, "sop": "Each morning at 11am: for students with a credit above zero whose class pass passed more than 5 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 30 days late, don't message them; tell me so I can call. Keep the injury notes out of the message. At most 20 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, credit)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaLateBalance {\n about \"Remind late students; escalate very late ones\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Passes\n let late = filter all where credit > $0.00 and days_between(expires_on, today()) > 5\n for each r in late up to 20 {\n if days_between(r.expires_on, today()) > 30 {\n notify owner \"{r.name} is very late ({r.credit}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name default 'there'}, our records show a credit of {r.credit}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01441", "domain": "yoga", "pattern": "escalation", "batch": false, "sop": "Every day at 4pm: for students with a credit above zero whose class pass passed more than 3 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 14 days late, don't message them; tell me so I can call. Don't mention the injury notes. At most 30 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, credit)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaLateBalance {\n about \"Remind late students; escalate very late ones\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Passes\n let late = filter all where credit > $0.00 and days_between(expires_on, today()) > 3\n for each r in late up to 30 {\n if days_between(r.expires_on, today()) > 14 {\n notify owner \"{r.name} is very late ({r.credit}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name default 'there'}, our records show a credit of {r.credit}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01442", "domain": "yoga", "pattern": "escalation", "batch": false, "sop": "Each day at 6pm: for students with a credit above zero whose class pass passed more than 5 days ago, send a polite reminder with the amount. Show me the messages for approval first. If it's more than 30 days late, don't message them; tell me so I can call. Don't mention the injury notes. At most 40 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, credit)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaLateBalance {\n about \"Remind late students; escalate very late ones\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Passes\n let late = filter all where credit > $0.00 and days_between(expires_on, today()) > 5\n for each r in late up to 40 {\n if days_between(r.expires_on, today()) > 30 {\n notify owner \"{r.name} is very late ({r.credit}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name}, our records show a credit of {r.credit}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01443", "domain": "yoga", "pattern": "escalation", "batch": false, "sop": "On Mondays at 5:30pm: for students with a credit above zero whose class pass passed more than 5 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 14 days late, don't message them; tell me so I can call. Don't mention the injury notes. At most 20 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, credit, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaLateBalance {\n about \"Remind late students; escalate very late ones\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every monday at 17:30\n\n let all = fetch Passes\n let late = filter all where credit > $0.00 and days_between(expires_on, today()) > 5\n for each r in late up to 20 {\n if days_between(r.expires_on, today()) > 14 {\n notify owner \"{r.name} is very late ({r.credit}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name}, our records show a credit of {r.credit}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01444", "domain": "yoga", "pattern": "escalation", "batch": false, "sop": "Every day at 11am: for students with a credit above zero whose class pass passed more than 5 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 14 days late, don't message them; tell me so I can call. Never include their injury notes. At most 40 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, credit)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaLateBalance {\n about \"Remind late students; escalate very late ones\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Passes\n let late = filter all where credit > $0.00 and days_between(expires_on, today()) > 5\n for each r in late up to 40 {\n if days_between(r.expires_on, today()) > 14 {\n notify owner \"{r.name} is very late ({r.credit}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name default 'there'}, our records show a credit of {r.credit}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01445", "domain": "yoga", "pattern": "escalation", "batch": false, "sop": "Daily at 5:30pm: for students with a credit above zero whose class pass passed more than 5 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 30 days late, don't message them; tell me so I can call. Never include their injury notes. At most 30 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, credit, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaLateBalance {\n about \"Remind late students; escalate very late ones\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Passes\n let late = filter all where credit > $0.00 and days_between(expires_on, today()) > 5\n for each r in late up to 30 {\n if days_between(r.expires_on, today()) > 30 {\n notify owner \"{r.name} is very late ({r.credit}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name}, our records show a credit of {r.credit}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01446", "domain": "yoga", "pattern": "escalation", "batch": false, "sop": "Every Friday at 8am: for students with a credit above zero whose class pass passed more than 5 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 30 days late, don't message them; tell me so I can call. Keep the injury notes out of the message. At most 20 per run.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, credit)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaLateBalance {\n about \"Remind late students; escalate very late ones\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every friday at 08:00\n\n let all = fetch Passes\n let late = filter all where credit > $0.00 and days_between(expires_on, today()) > 5\n for each r in late up to 20 {\n if days_between(r.expires_on, today()) > 30 {\n notify owner \"{r.name} is very late ({r.credit}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.name}, our records show a credit of {r.credit}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01447", "domain": "yoga", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Don't mention the injury notes. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name}, come back to the studio! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01448", "domain": "yoga", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Keep the injury notes out of the message. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the studio! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01449", "domain": "yoga", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Keep the injury notes out of the message. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the studio! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01450", "domain": "yoga", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Don't mention the injury notes. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the studio! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01451", "domain": "yoga", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Keep the injury notes out of the message. No more than 100.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name}, come back to the studio! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01452", "domain": "yoga", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Don't mention the injury notes. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the studio! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01453", "domain": "yoga", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Keep the injury notes out of the message. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the studio! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01454", "domain": "yoga", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the injury notes out of the message. No more than 100.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the studio! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01455", "domain": "yoga", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Don't mention the injury notes. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the studio! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01456", "domain": "yoga", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Don't mention the injury notes. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the studio! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01457", "domain": "yoga", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Don't mention the injury notes. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the studio! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01458", "domain": "yoga", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Keep the injury notes out of the message. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the studio! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01459", "domain": "yoga", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Don't mention the injury notes. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.name}, come back to the studio! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01460", "domain": "yoga", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Never include their injury notes. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the studio! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01461", "domain": "yoga", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Keep the injury notes out of the message. No more than 50.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.name}, come back to the studio! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01462", "domain": "petgroomer", "pattern": "reminder", "batch": false, "sop": "On Wednesdays at 5:30pm, find every pet owner in the Grooms sheet whose grooming is in two days and whose status is \"booked\". Send each one a text reminder. Nothing goes out until I've approved it. Never include their behavior notes. At most 30 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every wednesday at 17:30\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 2 days and status == \"booked\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.owner}, a reminder from the salon: your grooming is in two days at {time_of(r.appointment)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01463", "domain": "petgroomer", "pattern": "reminder", "batch": false, "sop": "Every day at 8am, find every pet owner in the Grooms sheet whose grooming is in two days and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Then mark them notified. Don't mention the behavior notes. At most 100 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 2 days and status == \"booked\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.owner}, a reminder from the salon: your grooming is in two days at {time_of(r.appointment)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01464", "domain": "petgroomer", "pattern": "reminder", "batch": false, "sop": "On Thursdays at 10am, find every pet owner in the Grooms sheet whose grooming is in two days and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Then mark them reminded. Keep the behavior notes out of the message. At most 100 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 2 days and status == \"booked\"\n for each r in due up to 100 {\n let m = draft sms to r.phone: \"Hi {r.owner}, a reminder from the salon: your grooming is in two days at {time_of(r.appointment)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01465", "domain": "petgroomer", "pattern": "reminder", "batch": false, "sop": "On Mondays at 9am, find every pet owner in the Grooms sheet whose grooming is tomorrow and whose status is \"booked\". Send each one a text reminder. Nothing goes out until I've approved it. Then mark them reminded. Don't mention the behavior notes. At most 50 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every monday at 09:00\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 1 day and status == \"booked\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner}, a reminder from the salon: your grooming is tomorrow at {time_of(r.appointment)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01466", "domain": "petgroomer", "pattern": "reminder", "batch": false, "sop": "Every day at 8am, find every pet owner in the Grooms sheet whose grooming is in two days and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Then mark them reminded. Don't mention the behavior notes. At most 20 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 2 days and status == \"booked\"\n for each r in due up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, a reminder from the salon: your grooming is in two days at {time_of(r.appointment)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01467", "domain": "petgroomer", "pattern": "reminder", "batch": false, "sop": "Each morning at 8am, find every pet owner in the Grooms sheet whose grooming is in a week and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Then mark them notified. Never include their behavior notes. At most 50 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 7 days and status == \"booked\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner}, a reminder from the salon: your grooming is in a week at {time_of(r.appointment)}.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01468", "domain": "petgroomer", "pattern": "reminder", "batch": false, "sop": "On Wednesdays at 10am, find every pet owner in the Grooms sheet whose grooming is in a week and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Keep the behavior notes out of the message. At most 30 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 7 days and status == \"booked\"\n for each r in due up to 30 {\n let m = draft sms to r.phone: \"Hi {r.owner}, a reminder from the salon: your grooming is in a week at {time_of(r.appointment)}.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01469", "domain": "petgroomer", "pattern": "reminder", "batch": false, "sop": "Every Thursday at 9am, find every pet owner in the Grooms sheet whose grooming is in a week and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Keep the behavior notes out of the message. At most 50 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every thursday at 09:00\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 7 days and status == \"booked\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, a reminder from the salon: your grooming is in a week at {time_of(r.appointment)}.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01470", "domain": "petgroomer", "pattern": "reminder", "batch": true, "sop": "On Fridays at 5:30pm, find every pet owner in the Grooms sheet whose grooming is in two days and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Don't mention the behavior notes. At most 50 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 50 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every friday at 17:30\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 2 days and status == \"booked\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.owner}, a reminder from the salon: your grooming is in two days at {time_of(r.appointment)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01471", "domain": "petgroomer", "pattern": "reminder", "batch": true, "sop": "Every Thursday at 5:30pm, find every pet owner in the Grooms sheet whose grooming is in two days and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Don't mention the behavior notes. At most 100 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 100 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 2 days and status == \"booked\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.owner default 'there'}, a reminder from the salon: your grooming is in two days at {time_of(r.appointment)}.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01472", "domain": "petgroomer", "pattern": "reminder", "batch": true, "sop": "Daily at 8:30am, find every pet owner in the Grooms sheet whose grooming is in two days and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Never include their behavior notes. At most 30 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 2 days and status == \"booked\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.owner default 'there'}, a reminder from the salon: your grooming is in two days at {time_of(r.appointment)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01473", "domain": "petgroomer", "pattern": "reminder", "batch": true, "sop": "Each Wednesday at 5:30pm, find every pet owner in the Grooms sheet whose grooming is in three days and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Keep the behavior notes out of the message. At most 100 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every wednesday at 17:30\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 3 days and status == \"booked\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.owner default 'there'}, a reminder from the salon: your grooming is in three days at {time_of(r.appointment)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01474", "domain": "petgroomer", "pattern": "reminder", "batch": true, "sop": "Every day at 11am, find every pet owner in the Grooms sheet whose grooming is tomorrow and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Don't mention the behavior notes. At most 100 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 100 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 100 sms to r.phone: \"Hi {r.owner default 'there'}, a reminder from the salon: your grooming is tomorrow at {time_of(r.appointment)}.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01475", "domain": "petgroomer", "pattern": "reminder", "batch": true, "sop": "On Wednesdays at 10am, find every pet owner in the Grooms sheet whose grooming is tomorrow and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Then mark them reminded. Keep the behavior notes out of the message. At most 20 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.owner default 'there'}, a reminder from the salon: your grooming is tomorrow at {time_of(r.appointment)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01476", "domain": "petgroomer", "pattern": "reminder", "batch": true, "sop": "Daily at 10am, find every pet owner in the Grooms sheet whose grooming is in two days and whose status is \"booked\". Send each one a text reminder. Nothing goes out until I've approved it. Never include their behavior notes. At most 20 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 2 days and status == \"booked\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.owner}, a reminder from the salon: your grooming is in two days at {time_of(r.appointment)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01477", "domain": "petgroomer", "pattern": "reminder", "batch": true, "sop": "Daily at 8:30am, find every pet owner in the Grooms sheet whose grooming is in three days and whose status is \"booked\". Send each one a text reminder. Nothing goes out until I've approved it. Then mark them notified. Keep the behavior notes out of the message. At most 20 per run.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerGroomingReminders {\n about \"Remind each pet owner about their grooming\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Grooms\n let due = filter all where date_of(appointment) == today() + 3 days and status == \"booked\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.owner default 'there'}, a reminder from the salon: your grooming is in three days at {time_of(r.appointment)}.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01478", "domain": "petgroomer", "pattern": "followup", "batch": false, "sop": "Each morning at 8am, look for pet owners marked \"no-show\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 3 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01479", "domain": "petgroomer", "pattern": "followup", "batch": false, "sop": "Each morning at 9am, look for pet owners marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 2 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01480", "domain": "petgroomer", "pattern": "followup", "batch": false, "sop": "Each Tuesday at 4pm, look for pet owners marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every tuesday at 16:00\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 1 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01481", "domain": "petgroomer", "pattern": "followup", "batch": false, "sop": "Daily at 5:30pm, look for pet owners marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 2 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01482", "domain": "petgroomer", "pattern": "followup", "batch": false, "sop": "Each day at 5:30pm, look for pet owners marked \"no-show\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 7 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01483", "domain": "petgroomer", "pattern": "followup", "batch": false, "sop": "Every day at 8:30am, look for pet owners marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 1 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.owner}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01484", "domain": "petgroomer", "pattern": "followup", "batch": false, "sop": "Daily at 8am, look for pet owners marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 1 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01485", "domain": "petgroomer", "pattern": "followup", "batch": false, "sop": "Daily at 8:30am, look for pet owners marked \"no-show\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 3 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01486", "domain": "petgroomer", "pattern": "followup", "batch": true, "sop": "Daily at 8:30am, look for pet owners marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 2 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.owner}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01487", "domain": "petgroomer", "pattern": "followup", "batch": true, "sop": "Each day at 6pm, look for pet owners marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 2 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.owner}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01488", "domain": "petgroomer", "pattern": "followup", "batch": true, "sop": "Daily at 6pm, look for pet owners marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 2 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.owner}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01489", "domain": "petgroomer", "pattern": "followup", "batch": true, "sop": "Daily at 8:30am, look for pet owners marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 2 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.owner default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01490", "domain": "petgroomer", "pattern": "followup", "batch": true, "sop": "Every day at 8:30am, look for pet owners marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 1 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.owner}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01491", "domain": "petgroomer", "pattern": "followup", "batch": true, "sop": "Every Wednesday at 5:30pm, look for pet owners marked \"no-show\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every wednesday at 17:30\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 3 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.owner default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01492", "domain": "petgroomer", "pattern": "followup", "batch": true, "sop": "Each morning at 10am, look for pet owners marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 40 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 1 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.owner}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01493", "domain": "petgroomer", "pattern": "lapsed", "batch": false, "sop": "On Mondays at 10am, find pet owners whose appointment was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every monday at 10:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by appointment first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.owner}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01494", "domain": "petgroomer", "pattern": "lapsed", "batch": false, "sop": "Each day at 4pm, find pet owners whose appointment was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by appointment first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01495", "domain": "petgroomer", "pattern": "lapsed", "batch": false, "sop": "Every day at 4pm, find pet owners whose appointment was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by appointment first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01496", "domain": "petgroomer", "pattern": "lapsed", "batch": false, "sop": "Every day at 10am, find pet owners whose appointment was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by appointment first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01497", "domain": "petgroomer", "pattern": "lapsed", "batch": false, "sop": "Each Thursday at 6pm, find pet owners whose appointment was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every thursday at 18:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by appointment first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01498", "domain": "petgroomer", "pattern": "lapsed", "batch": false, "sop": "Daily at 6pm, find pet owners whose appointment was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by appointment first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01499", "domain": "petgroomer", "pattern": "lapsed", "batch": false, "sop": "Each day at 4pm, find pet owners whose appointment was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 16:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by appointment first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.owner}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01500", "domain": "petgroomer", "pattern": "lapsed", "batch": false, "sop": "Each Thursday at 8:30am, find pet owners whose appointment was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by appointment first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.owner}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01501", "domain": "petgroomer", "pattern": "lapsed", "batch": true, "sop": "On Tuesdays at 9am, find pet owners whose appointment was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every tuesday at 09:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by appointment first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.owner default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01502", "domain": "petgroomer", "pattern": "lapsed", "batch": true, "sop": "Daily at 8:30am, find pet owners whose appointment was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:30\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by appointment first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.owner default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01503", "domain": "petgroomer", "pattern": "lapsed", "batch": true, "sop": "Every Friday at 9am, find pet owners whose appointment was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every friday at 09:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by appointment first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.owner default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01504", "domain": "petgroomer", "pattern": "lapsed", "batch": true, "sop": "Daily at 9am, find pet owners whose appointment was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by appointment first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.owner}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01505", "domain": "petgroomer", "pattern": "lapsed", "batch": true, "sop": "Each morning at 8am, find pet owners whose appointment was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 08:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by appointment first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.owner default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01506", "domain": "petgroomer", "pattern": "lapsed", "batch": true, "sop": "Every Monday at 4pm, find pet owners whose appointment was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 15 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every monday at 16:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by appointment first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.owner default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01507", "domain": "petgroomer", "pattern": "lapsed", "batch": true, "sop": "Every Wednesday at 8am, find pet owners whose appointment was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every wednesday at 08:00\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by appointment first 20\n let msgs = draft each r in oldest up to 20 sms to r.phone: \"Hi {r.owner}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01508", "domain": "petgroomer", "pattern": "lapsed", "batch": true, "sop": "Every Monday at 8:30am, find pet owners whose appointment was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Show me the messages for approval first. Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerWinBack {\n about \"Nudge pet owners whose grooming was long ago\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every monday at 08:30\n\n let all = fetch Grooms\n let old = filter all where days_between(appointment, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by appointment first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.owner default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01509", "domain": "petgroomer", "pattern": "summary", "batch": false, "sop": "Every Thursday at 10am, count the pet owners in Grooms whose status is \"booked\" and the total price, and send the numbers to me only. Don't message any pet owners. If there are none, don't bother me.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(status, price, owner, phone, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerDailySummary {\n about \"Tell the owner how many pet owners are booked\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Grooms\n let these = filter all where status == \"booked\"\n let n = summarize count of these\n let total = summarize sum price of these\n if n == 0 {\n stop \"no booked pet owners\"\n }\n notify owner \"Booked pet owners: {n}, total price: {total}\"\n}"} {"id": "train-01510", "domain": "petgroomer", "pattern": "summary", "batch": false, "sop": "Every Monday at 6pm, count the pet owners in Grooms whose status is \"booked\" and the total price, and send the numbers to me only. Don't message any pet owners. If there are none, don't bother me.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(status, price, owner, phone, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerDailySummary {\n about \"Tell the owner how many pet owners are booked\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every monday at 18:00\n\n let all = fetch Grooms\n let these = filter all where status == \"booked\"\n let n = summarize count of these\n let total = summarize sum price of these\n if n == 0 {\n stop \"no booked pet owners\"\n }\n notify owner \"Booked pet owners: {n}, total price: {total}\"\n}"} {"id": "train-01511", "domain": "petgroomer", "pattern": "summary", "batch": false, "sop": "On Thursdays at 9am, count the pet owners in Grooms whose status is \"booked\" and the total price, and send the numbers to me only. Don't message any pet owners. If there are none, don't bother me.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(status, price, owner, phone, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerDailySummary {\n about \"Tell the owner how many pet owners are booked\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every thursday at 09:00\n\n let all = fetch Grooms\n let these = filter all where status == \"booked\"\n let n = summarize count of these\n let total = summarize sum price of these\n if n == 0 {\n stop \"no booked pet owners\"\n }\n notify owner \"Booked pet owners: {n}, total price: {total}\"\n}"} {"id": "train-01512", "domain": "petgroomer", "pattern": "summary", "batch": false, "sop": "Each day at 5:30pm, count the pet owners in Grooms whose status is \"no-show\" and the total price, and send the numbers to me only. Don't message any pet owners. If there are none, don't bother me.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(status, price, owner, phone, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerDailySummary {\n about \"Tell the owner how many pet owners are no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Grooms\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n let total = summarize sum price of these\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners: {n}, total price: {total}\"\n}"} {"id": "train-01513", "domain": "petgroomer", "pattern": "summary", "batch": false, "sop": "On Wednesdays at 8:30am, count the pet owners in Grooms whose status is \"no-show\" and the total price, and send the numbers to me only. Don't message any pet owners. If there are none, don't bother me.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(status, price, owner, phone)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerDailySummary {\n about \"Tell the owner how many pet owners are no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every wednesday at 08:30\n\n let all = fetch Grooms\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n let total = summarize sum price of these\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners: {n}, total price: {total}\"\n}"} {"id": "train-01514", "domain": "petgroomer", "pattern": "summary", "batch": false, "sop": "On Thursdays at 8:30am, count the pet owners in Grooms whose status is \"booked\", and send the numbers to me only. Don't message any pet owners.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(status, price, owner, phone, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerDailySummary {\n about \"Tell the owner how many pet owners are booked\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Grooms\n let these = filter all where status == \"booked\"\n let n = summarize count of these\n notify owner \"Booked pet owners today: {n}\"\n}"} {"id": "train-01515", "domain": "petgroomer", "pattern": "summary", "batch": false, "sop": "Daily at 6pm, count the pet owners in Grooms whose status is \"done\", and send the numbers to me only. Don't message any pet owners.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(status, price, owner, phone, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerDailySummary {\n about \"Tell the owner how many pet owners are done\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Grooms\n let these = filter all where status == \"done\"\n let n = summarize count of these\n notify owner \"Done pet owners today: {n}\"\n}"} {"id": "train-01516", "domain": "petgroomer", "pattern": "summary", "batch": false, "sop": "Every day at 10am, count the pet owners in Grooms whose status is \"no-show\", and send the numbers to me only. Don't message any pet owners.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(status, price, owner, phone, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerDailySummary {\n about \"Tell the owner how many pet owners are no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Grooms\n let these = filter all where status == \"no-show\"\n let n = summarize count of these\n notify owner \"No-show pet owners today: {n}\"\n}"} {"id": "train-01517", "domain": "petgroomer", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the pet owner know (I approve that message too).", "policy": "policy PetgroomerRefundPolicy {\n allow read RefundRequests(request_id, owner, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $240 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure PetgroomerRefunds {\n about \"Handle refund requests within limits\"\n policy PetgroomerRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01518", "domain": "petgroomer", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $75, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the pet owner know (I approve that message too).", "policy": "policy PetgroomerRefundPolicy {\n allow read RefundRequests(request_id, owner, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $75 per action\n limit refund $375 per day\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure PetgroomerRefunds {\n about \"Handle refund requests within limits\"\n policy PetgroomerRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01519", "domain": "petgroomer", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the pet owner know (I approve that message too).", "policy": "policy PetgroomerRefundPolicy {\n allow read RefundRequests(request_id, owner, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure PetgroomerRefunds {\n about \"Handle refund requests within limits\"\n policy PetgroomerRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01520", "domain": "petgroomer", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $100, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the pet owner know (I approve that message too).", "policy": "policy PetgroomerRefundPolicy {\n allow read RefundRequests(request_id, owner, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $600 per day\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure PetgroomerRefunds {\n about \"Handle refund requests within limits\"\n policy PetgroomerRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01521", "domain": "petgroomer", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the pet owner know (I approve that message too).", "policy": "policy PetgroomerRefundPolicy {\n allow read RefundRequests(request_id, owner, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $50 per action\n limit refund $250 per day\n refund without approval up to $20\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure PetgroomerRefunds {\n about \"Handle refund requests within limits\"\n policy PetgroomerRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01522", "domain": "petgroomer", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the pet owner know (I approve that message too).", "policy": "policy PetgroomerRefundPolicy {\n allow read RefundRequests(request_id, owner, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $20\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure PetgroomerRefunds {\n about \"Handle refund requests within limits\"\n policy PetgroomerRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01523", "domain": "petgroomer", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the pet owner know (I approve that message too).", "policy": "policy PetgroomerRefundPolicy {\n allow read RefundRequests(request_id, owner, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $20\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure PetgroomerRefunds {\n about \"Handle refund requests within limits\"\n policy PetgroomerRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01524", "domain": "petgroomer", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the pet owner know (I approve that message too).", "policy": "policy PetgroomerRefundPolicy {\n allow read RefundRequests(request_id, owner, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $100 per action\n limit refund $600 per day\n refund without approval up to $15\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure PetgroomerRefunds {\n about \"Handle refund requests within limits\"\n policy PetgroomerRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01525", "domain": "petgroomer", "pattern": "confirm_new", "batch": false, "sop": "When a new grooming is added to Grooms: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (nothing goes out until i've approved it), put it on the Tables calendar for 45 minutes, and mark it confirmed. Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, price, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow calendar Tables\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\ncalendar Tables \"Tables\"", "program": "procedure PetgroomerConfirmNewGrooming {\n about \"Confirm a new grooming and add it to the calendar\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Grooms\n\n if r.appointment < now() + 2 hours {\n notify owner \"Short-notice grooming for {r.owner} at {r.appointment}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner}, your grooming with the salon is confirmed for {r.appointment}.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.owner}\", at: r.appointment, length: 45 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01526", "domain": "petgroomer", "pattern": "confirm_new", "batch": false, "sop": "When a new grooming is added to Grooms: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (i want to approve each message first), put it on the Tables calendar for 90 minutes, and mark it confirmed. Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, price)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow calendar Tables\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\ncalendar Tables \"Tables\"", "program": "procedure PetgroomerConfirmNewGrooming {\n about \"Confirm a new grooming and add it to the calendar\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Grooms\n\n if r.appointment < now() + 12 hours {\n notify owner \"Short-notice grooming for {r.owner} at {r.appointment}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, your grooming with the salon is confirmed for {r.appointment}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.owner}\", at: r.appointment, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01527", "domain": "petgroomer", "pattern": "confirm_new", "batch": false, "sop": "When a new grooming is added to Grooms: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (show me the messages for approval first), put it on the Tables calendar for 60 minutes, and mark it confirmed. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, price)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow calendar Tables\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\ncalendar Tables \"Tables\"", "program": "procedure PetgroomerConfirmNewGrooming {\n about \"Confirm a new grooming and add it to the calendar\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Grooms\n\n if r.appointment < now() + 24 hours {\n notify owner \"Short-notice grooming for {r.owner} at {r.appointment}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, your grooming with the salon is confirmed for {r.appointment}.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.owner}\", at: r.appointment, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01528", "domain": "petgroomer", "pattern": "confirm_new", "batch": false, "sop": "When a new grooming is added to Grooms: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (nothing goes out until i've approved it), put it on the Tables calendar for 45 minutes, and mark it confirmed. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, price, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow calendar Tables\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\ncalendar Tables \"Tables\"", "program": "procedure PetgroomerConfirmNewGrooming {\n about \"Confirm a new grooming and add it to the calendar\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Grooms\n\n if r.appointment < now() + 24 hours {\n notify owner \"Short-notice grooming for {r.owner} at {r.appointment}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner}, your grooming with the salon is confirmed for {r.appointment}.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.owner}\", at: r.appointment, length: 45 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01529", "domain": "petgroomer", "pattern": "confirm_new", "batch": false, "sop": "When a new grooming is added to Grooms: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (show me the messages for approval first), put it on the Tables calendar for 60 minutes, and mark it confirmed. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, price)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow calendar Tables\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\ncalendar Tables \"Tables\"", "program": "procedure PetgroomerConfirmNewGrooming {\n about \"Confirm a new grooming and add it to the calendar\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Grooms\n\n if r.appointment < now() + 12 hours {\n notify owner \"Short-notice grooming for {r.owner} at {r.appointment}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, your grooming with the salon is confirmed for {r.appointment}.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.owner}\", at: r.appointment, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01530", "domain": "petgroomer", "pattern": "confirm_new", "batch": false, "sop": "When a new grooming is added to Grooms: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (i need to ok every message), put it on the Tables calendar for 45 minutes, and mark it confirmed. Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, price)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow calendar Tables\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\ncalendar Tables \"Tables\"", "program": "procedure PetgroomerConfirmNewGrooming {\n about \"Confirm a new grooming and add it to the calendar\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Grooms\n\n if r.appointment < now() + 2 hours {\n notify owner \"Short-notice grooming for {r.owner} at {r.appointment}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, your grooming with the salon is confirmed for {r.appointment}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.owner}\", at: r.appointment, length: 45 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01531", "domain": "petgroomer", "pattern": "confirm_new", "batch": false, "sop": "When a new grooming is added to Grooms: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (show me the messages for approval first), put it on the Tables calendar for 90 minutes, and mark it confirmed. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, price)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow calendar Tables\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\ncalendar Tables \"Tables\"", "program": "procedure PetgroomerConfirmNewGrooming {\n about \"Confirm a new grooming and add it to the calendar\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Grooms\n\n if r.appointment < now() + 12 hours {\n notify owner \"Short-notice grooming for {r.owner} at {r.appointment}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner}, your grooming with the salon is confirmed for {r.appointment}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.owner}\", at: r.appointment, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01532", "domain": "petgroomer", "pattern": "confirm_new", "batch": false, "sop": "When a new grooming is added to Grooms: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (nothing goes out until i've approved it), put it on the Tables calendar for 90 minutes, and mark it confirmed. Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, price)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow calendar Tables\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\ncalendar Tables \"Tables\"", "program": "procedure PetgroomerConfirmNewGrooming {\n about \"Confirm a new grooming and add it to the calendar\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Grooms\n\n if r.appointment < now() + 2 hours {\n notify owner \"Short-notice grooming for {r.owner} at {r.appointment}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner}, your grooming with the salon is confirmed for {r.appointment}.\"\n let ok = request approval of m from owner timeout 1 day else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.owner}\", at: r.appointment, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} {"id": "train-01533", "domain": "petgroomer", "pattern": "wait_followup", "batch": false, "sop": "When a new pet owner is added to Grooms, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerFollowUpAfterWait {\n about \"Contact a new pet owner, then follow up once\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger when new row r in Grooms\n\n let first = draft sms to r.phone: \"Hi {r.owner default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Grooms\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01534", "domain": "petgroomer", "pattern": "wait_followup", "batch": false, "sop": "When a new pet owner is added to Grooms, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerFollowUpAfterWait {\n about \"Contact a new pet owner, then follow up once\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger when new row r in Grooms\n\n let first = draft sms to r.phone: \"Hi {r.owner default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Grooms\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01535", "domain": "petgroomer", "pattern": "wait_followup", "batch": false, "sop": "When a new pet owner is added to Grooms, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerFollowUpAfterWait {\n about \"Contact a new pet owner, then follow up once\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger when new row r in Grooms\n\n let first = draft sms to r.phone: \"Hi {r.owner default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Grooms\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01536", "domain": "petgroomer", "pattern": "wait_followup", "batch": false, "sop": "When a new pet owner is added to Grooms, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Keep the behavior notes out of the message.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, status)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerFollowUpAfterWait {\n about \"Contact a new pet owner, then follow up once\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger when new row r in Grooms\n\n let first = draft sms to r.phone: \"Hi {r.owner default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Grooms\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01537", "domain": "petgroomer", "pattern": "wait_followup", "batch": false, "sop": "When a new pet owner is added to Grooms, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerFollowUpAfterWait {\n about \"Contact a new pet owner, then follow up once\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger when new row r in Grooms\n\n let first = draft sms to r.phone: \"Hi {r.owner}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Grooms\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01538", "domain": "petgroomer", "pattern": "wait_followup", "batch": false, "sop": "When a new pet owner is added to Grooms, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerFollowUpAfterWait {\n about \"Contact a new pet owner, then follow up once\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger when new row r in Grooms\n\n let first = draft sms to r.phone: \"Hi {r.owner default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Grooms\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01539", "domain": "petgroomer", "pattern": "wait_followup", "batch": false, "sop": "When a new pet owner is added to Grooms, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerFollowUpAfterWait {\n about \"Contact a new pet owner, then follow up once\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger when new row r in Grooms\n\n let first = draft sms to r.phone: \"Hi {r.owner}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Grooms\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01540", "domain": "petgroomer", "pattern": "wait_followup", "batch": false, "sop": "When a new pet owner is added to Grooms, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Don't mention the behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerFollowUpAfterWait {\n about \"Contact a new pet owner, then follow up once\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger when new row r in Grooms\n\n let first = draft sms to r.phone: \"Hi {r.owner default 'there'}, thanks for choosing the salon! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Grooms\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01541", "domain": "petgroomer", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Never include their behavior notes. No more than 50.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01542", "domain": "petgroomer", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Keep the behavior notes out of the message. No more than 50.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 150 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, come back to the salon! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01543", "domain": "petgroomer", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Never include their behavior notes. No more than 50.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, come back to the salon! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01544", "domain": "petgroomer", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Keep the behavior notes out of the message. No more than 50.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01545", "domain": "petgroomer", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Don't mention the behavior notes. No more than 50.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01546", "domain": "petgroomer", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Let me check the messages before they go out. Keep the behavior notes out of the message. No more than 100.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, come back to the salon! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01547", "domain": "petgroomer", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Don't mention the behavior notes. No more than 50.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01548", "domain": "petgroomer", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Don't mention the behavior notes. No more than 100.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.owner default 'there'}, come back to the salon! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01549", "domain": "petgroomer", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Don't mention the behavior notes. No more than 100.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.owner}, come back to the salon! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01550", "domain": "petgroomer", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Never include their behavior notes. No more than 50.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.owner}, come back to the salon! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01551", "domain": "petgroomer", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Don't mention the behavior notes. No more than 50.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.owner default 'there'}, come back to the salon! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01552", "domain": "petgroomer", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Keep the behavior notes out of the message. No more than 50.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.owner default 'there'}, come back to the salon! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01553", "domain": "petgroomer", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Keep the behavior notes out of the message. No more than 100.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.owner default 'there'}, come back to the salon! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01554", "domain": "petgroomer", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Never include their behavior notes. No more than 50.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.owner default 'there'}, come back to the salon! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01555", "domain": "printshop", "pattern": "reminder", "batch": false, "sop": "Each Monday at 5:30pm, find every customer in the Jobs sheet whose print job is in a week and whose status is \"queued\". Send each one a email reminder. Let me check the messages before they go out. Then mark them notified. Never include their file link. At most 100 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every monday at 17:30\n\n let all = fetch Jobs\n let due = filter all where due == today() + 7 days and status == \"queued\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your print job in a week\": \"Hi {r.customer default 'there'}, a reminder from the shop: your print job is in a week.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01556", "domain": "printshop", "pattern": "reminder", "batch": false, "sop": "On Wednesdays at 10am, find every customer in the Jobs sheet whose print job is tomorrow and whose status is \"queued\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Don't mention the file link. At most 30 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Jobs\n let due = filter all where due == today() + 1 day and status == \"queued\"\n for each r in due up to 30 {\n let m = draft email to r.email subject \"Your print job tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the shop: your print job is tomorrow.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01557", "domain": "printshop", "pattern": "reminder", "batch": false, "sop": "On Mondays at 4pm, find every customer in the Jobs sheet whose print job is in a week and whose status is \"queued\". Send each one a email reminder. Show me the messages for approval first. Then mark them notified. Don't mention the file link. At most 30 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every monday at 16:00\n\n let all = fetch Jobs\n let due = filter all where due == today() + 7 days and status == \"queued\"\n for each r in due up to 30 {\n let m = draft email to r.email subject \"Your print job in a week\": \"Hi {r.customer default 'there'}, a reminder from the shop: your print job is in a week.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} {"id": "train-01558", "domain": "printshop", "pattern": "reminder", "batch": false, "sop": "On Thursdays at 10am, find every customer in the Jobs sheet whose print job is tomorrow and whose status is \"queued\". Send each one a email reminder. I need to OK every message. Don't mention the file link. At most 30 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Jobs\n let due = filter all where due == today() + 1 day and status == \"queued\"\n for each r in due up to 30 {\n let m = draft email to r.email subject \"Your print job tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the shop: your print job is tomorrow.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01559", "domain": "printshop", "pattern": "reminder", "batch": false, "sop": "Each day at 6pm, find every customer in the Jobs sheet whose print job is tomorrow and whose status is \"queued\". Send each one a email reminder. Let me check the messages before they go out. Don't mention the file link. At most 50 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 18:00\n\n let all = fetch Jobs\n let due = filter all where due == today() + 1 day and status == \"queued\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your print job tomorrow\": \"Hi {r.customer}, a reminder from the shop: your print job is tomorrow.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01560", "domain": "printshop", "pattern": "reminder", "batch": false, "sop": "Daily at 8am, find every customer in the Jobs sheet whose print job is tomorrow and whose status is \"queued\". Send each one a email reminder. Let me check the messages before they go out. Don't mention the file link. At most 20 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 08:00\n\n let all = fetch Jobs\n let due = filter all where due == today() + 1 day and status == \"queued\"\n for each r in due up to 20 {\n let m = draft email to r.email subject \"Your print job tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the shop: your print job is tomorrow.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01561", "domain": "printshop", "pattern": "reminder", "batch": false, "sop": "Every day at 5:30pm, find every customer in the Jobs sheet whose print job is in three days and whose status is \"queued\". Send each one a email reminder. Let me check the messages before they go out. Keep the file link out of the message. At most 20 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 17:30\n\n let all = fetch Jobs\n let due = filter all where due == today() + 3 days and status == \"queued\"\n for each r in due up to 20 {\n let m = draft email to r.email subject \"Your print job in three days\": \"Hi {r.customer default 'there'}, a reminder from the shop: your print job is in three days.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01562", "domain": "printshop", "pattern": "reminder", "batch": true, "sop": "Each morning at 9am, find every customer in the Jobs sheet whose print job is in three days and whose status is \"queued\". Send each one a email reminder. Nothing goes out until I've approved it. Then mark them notified. Never include their file link. At most 30 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 09:00\n\n let all = fetch Jobs\n let due = filter all where due == today() + 3 days and status == \"queued\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your print job in three days\": \"Hi {r.customer}, a reminder from the shop: your print job is in three days.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01563", "domain": "printshop", "pattern": "reminder", "batch": true, "sop": "On Mondays at 11am, find every customer in the Jobs sheet whose print job is in three days and whose status is \"queued\". Send each one a email reminder. Show me the messages for approval first. Never include their file link. At most 50 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 50 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every monday at 11:00\n\n let all = fetch Jobs\n let due = filter all where due == today() + 3 days and status == \"queued\"\n let msgs = draft each r in due up to 50 email to r.email subject \"Your print job in three days\": \"Hi {r.customer default 'there'}, a reminder from the shop: your print job is in three days.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01564", "domain": "printshop", "pattern": "reminder", "batch": true, "sop": "Every day at 8:30am, find every customer in the Jobs sheet whose print job is tomorrow and whose status is \"queued\". Send each one a email reminder. Let me check the messages before they go out. Then mark them notified. Never include their file link. At most 100 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 08:30\n\n let all = fetch Jobs\n let due = filter all where due == today() + 1 day and status == \"queued\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your print job tomorrow\": \"Hi {r.customer}, a reminder from the shop: your print job is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 100 {\n update r set status = \"notified\"\n }\n}"} {"id": "train-01565", "domain": "printshop", "pattern": "reminder", "batch": true, "sop": "Each morning at 9am, find every customer in the Jobs sheet whose print job is tomorrow and whose status is \"queued\". Send each one a email reminder. Let me check the messages before they go out. Never include their file link. At most 30 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 09:00\n\n let all = fetch Jobs\n let due = filter all where due == today() + 1 day and status == \"queued\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your print job tomorrow\": \"Hi {r.customer}, a reminder from the shop: your print job is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01566", "domain": "printshop", "pattern": "reminder", "batch": true, "sop": "Every day at 4pm, find every customer in the Jobs sheet whose print job is in three days and whose status is \"queued\". Send each one a email reminder. I want to approve each message first. Then mark them reminded. Keep the file link out of the message. At most 50 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 50 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 16:00\n\n let all = fetch Jobs\n let due = filter all where due == today() + 3 days and status == \"queued\"\n let msgs = draft each r in due up to 50 email to r.email subject \"Your print job in three days\": \"Hi {r.customer default 'there'}, a reminder from the shop: your print job is in three days.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"reminded\"\n }\n}"} {"id": "train-01567", "domain": "printshop", "pattern": "reminder", "batch": true, "sop": "Every Wednesday at 6pm, find every customer in the Jobs sheet whose print job is tomorrow and whose status is \"queued\". Send each one a email reminder. I need to OK every message. Never include their file link. At most 20 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every wednesday at 18:00\n\n let all = fetch Jobs\n let due = filter all where due == today() + 1 day and status == \"queued\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your print job tomorrow\": \"Hi {r.customer}, a reminder from the shop: your print job is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01568", "domain": "printshop", "pattern": "followup", "batch": false, "sop": "On Wednesdays at 11am, look for customers marked \"collected\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every wednesday at 11:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 3 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01569", "domain": "printshop", "pattern": "followup", "batch": false, "sop": "Every Wednesday at 6pm, look for customers marked \"collected\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every wednesday at 18:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 1 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01570", "domain": "printshop", "pattern": "followup", "batch": false, "sop": "On Mondays at 4pm, look for customers marked \"collected\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every monday at 16:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 1 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01571", "domain": "printshop", "pattern": "followup", "batch": false, "sop": "Daily at 10am, look for customers marked \"collected\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 10:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 1 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01572", "domain": "printshop", "pattern": "followup", "batch": false, "sop": "Each morning at 9am, look for customers marked \"collected\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 09:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 7 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01573", "domain": "printshop", "pattern": "followup", "batch": false, "sop": "Daily at 9am, look for customers marked \"collected\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 09:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 7 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01574", "domain": "printshop", "pattern": "followup", "batch": false, "sop": "Every day at 4pm, look for customers marked \"collected\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 16:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 1 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01575", "domain": "printshop", "pattern": "followup", "batch": false, "sop": "Each day at 5:30pm, look for customers marked \"collected\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 17:30\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 1 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01576", "domain": "printshop", "pattern": "followup", "batch": true, "sop": "Each morning at 8am, look for customers marked \"collected\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 08:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 1 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01577", "domain": "printshop", "pattern": "followup", "batch": true, "sop": "Every day at 8:30am, look for customers marked \"collected\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 08:30\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 3 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01578", "domain": "printshop", "pattern": "followup", "batch": true, "sop": "Each Thursday at 8:30am, look for customers marked \"collected\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 1 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01579", "domain": "printshop", "pattern": "followup", "batch": true, "sop": "Each morning at 9am, look for customers marked \"collected\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 09:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 2 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01580", "domain": "printshop", "pattern": "followup", "batch": true, "sop": "Every Thursday at 10am, look for customers marked \"collected\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 3 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01581", "domain": "printshop", "pattern": "followup", "batch": true, "sop": "Each Wednesday at 9am, look for customers marked \"collected\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 40 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every wednesday at 09:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 7 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01582", "domain": "printshop", "pattern": "followup", "batch": true, "sop": "Every Tuesday at 8am, look for customers marked \"collected\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every tuesday at 08:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 2 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} {"id": "train-01583", "domain": "printshop", "pattern": "followup", "batch": true, "sop": "Each Wednesday at 8:30am, look for customers marked \"collected\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every wednesday at 08:30\n\n let all = fetch Jobs\n let recent = filter all where status == \"collected\" and days_between(due, today()) <= 2 and days_between(due, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.customer}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} {"id": "train-01584", "domain": "printshop", "pattern": "lapsed", "batch": false, "sop": "Each morning at 10am, find customers whose due was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 10:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by due first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01585", "domain": "printshop", "pattern": "lapsed", "batch": false, "sop": "Each morning at 11am, find customers whose due was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 11:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by due first 15\n for each r in oldest up to 15 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01586", "domain": "printshop", "pattern": "lapsed", "batch": false, "sop": "Each morning at 10am, find customers whose due was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 10:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by due first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01587", "domain": "printshop", "pattern": "lapsed", "batch": false, "sop": "Each Friday at 8:30am, find customers whose due was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. I need to OK every message. Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every friday at 08:30\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by due first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01588", "domain": "printshop", "pattern": "lapsed", "batch": false, "sop": "Every day at 4pm, find customers whose due was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 16:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by due first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01589", "domain": "printshop", "pattern": "lapsed", "batch": false, "sop": "Each Thursday at 9am, find customers whose due was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every thursday at 09:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by due first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} {"id": "train-01590", "domain": "printshop", "pattern": "lapsed", "batch": false, "sop": "Each Thursday at 10am, find customers whose due was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by due first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01591", "domain": "printshop", "pattern": "lapsed", "batch": true, "sop": "On Fridays at 8am, find customers whose due was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Show me the messages for approval first. Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every friday at 08:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by due first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01592", "domain": "printshop", "pattern": "lapsed", "batch": true, "sop": "Each morning at 11am, find customers whose due was at least 42 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 11:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 42 and status != \"cancelled\"\n let oldest = sort old by due first 20\n let msgs = draft each r in oldest up to 20 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01593", "domain": "printshop", "pattern": "lapsed", "batch": true, "sop": "Each Friday at 10am, find customers whose due was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every friday at 10:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by due first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01594", "domain": "printshop", "pattern": "lapsed", "batch": true, "sop": "Each morning at 9am, find customers whose due was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 09:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by due first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01595", "domain": "printshop", "pattern": "lapsed", "batch": true, "sop": "Each Thursday at 9am, find customers whose due was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every thursday at 09:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by due first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01596", "domain": "printshop", "pattern": "lapsed", "batch": true, "sop": "Each morning at 10am, find customers whose due was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 10:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by due first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01597", "domain": "printshop", "pattern": "lapsed", "batch": true, "sop": "Each morning at 11am, find customers whose due was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 11:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by due first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01598", "domain": "printshop", "pattern": "summary", "batch": false, "sop": "Each Thursday at 8:30am, count the customers in Jobs whose status is \"queued\" and the total quote, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy PrintshopPolicy {\n allow read Jobs(status, quote, customer, email)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopDailySummary {\n about \"Tell the owner how many customers are queued\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Jobs\n let these = filter all where status == \"queued\"\n let n = summarize count of these\n let total = summarize sum quote of these\n if n == 0 {\n stop \"no queued customers\"\n }\n notify owner \"Queued customers: {n}, total quote: {total}\"\n}"} {"id": "train-01599", "domain": "printshop", "pattern": "summary", "batch": false, "sop": "Each morning at 8:30am, count the customers in Jobs whose status is \"queued\", and send the numbers to me only. Don't message any customers.", "policy": "policy PrintshopPolicy {\n allow read Jobs(status, quote, customer, email)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopDailySummary {\n about \"Tell the owner how many customers are queued\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 08:30\n\n let all = fetch Jobs\n let these = filter all where status == \"queued\"\n let n = summarize count of these\n notify owner \"Queued customers today: {n}\"\n}"} {"id": "train-01600", "domain": "printshop", "pattern": "summary", "batch": false, "sop": "Every day at 9am, count the customers in Jobs whose status is \"queued\", and send the numbers to me only. Don't message any customers.", "policy": "policy PrintshopPolicy {\n allow read Jobs(status, quote, customer, email, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopDailySummary {\n about \"Tell the owner how many customers are queued\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 09:00\n\n let all = fetch Jobs\n let these = filter all where status == \"queued\"\n let n = summarize count of these\n notify owner \"Queued customers today: {n}\"\n}"} {"id": "train-01601", "domain": "printshop", "pattern": "summary", "batch": false, "sop": "Every day at 6pm, count the customers in Jobs whose status is \"queued\" and the total quote, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy PrintshopPolicy {\n allow read Jobs(status, quote, customer, email)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopDailySummary {\n about \"Tell the owner how many customers are queued\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 18:00\n\n let all = fetch Jobs\n let these = filter all where status == \"queued\"\n let n = summarize count of these\n let total = summarize sum quote of these\n if n == 0 {\n stop \"no queued customers\"\n }\n notify owner \"Queued customers: {n}, total quote: {total}\"\n}"} {"id": "train-01602", "domain": "printshop", "pattern": "summary", "batch": false, "sop": "Daily at 8am, count the customers in Jobs whose status is \"collected\" and the total quote, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy PrintshopPolicy {\n allow read Jobs(status, quote, customer, email)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopDailySummary {\n about \"Tell the owner how many customers are collected\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 08:00\n\n let all = fetch Jobs\n let these = filter all where status == \"collected\"\n let n = summarize count of these\n let total = summarize sum quote of these\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers: {n}, total quote: {total}\"\n}"} {"id": "train-01603", "domain": "printshop", "pattern": "summary", "batch": false, "sop": "On Wednesdays at 9am, count the customers in Jobs whose status is \"queued\" and the total quote, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy PrintshopPolicy {\n allow read Jobs(status, quote, customer, email, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopDailySummary {\n about \"Tell the owner how many customers are queued\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every wednesday at 09:00\n\n let all = fetch Jobs\n let these = filter all where status == \"queued\"\n let n = summarize count of these\n let total = summarize sum quote of these\n if n == 0 {\n stop \"no queued customers\"\n }\n notify owner \"Queued customers: {n}, total quote: {total}\"\n}"} {"id": "train-01604", "domain": "printshop", "pattern": "summary", "batch": false, "sop": "Each Tuesday at 11am, count the customers in Jobs whose status is \"queued\" and the total quote, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy PrintshopPolicy {\n allow read Jobs(status, quote, customer, email)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopDailySummary {\n about \"Tell the owner how many customers are queued\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every tuesday at 11:00\n\n let all = fetch Jobs\n let these = filter all where status == \"queued\"\n let n = summarize count of these\n let total = summarize sum quote of these\n if n == 0 {\n stop \"no queued customers\"\n }\n notify owner \"Queued customers: {n}, total quote: {total}\"\n}"} {"id": "train-01605", "domain": "printshop", "pattern": "reorder", "batch": false, "sop": "Every day at 10am, check Paper. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy PrintshopStockPolicy {\n allow read Paper(stock_name, reams, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Paper.supplier\n limit order $150 per action\n limit order $600 per day\n}", "sheets": "sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure PrintshopReorder {\n about \"Reorder paper below their minimum\"\n policy PrintshopStockPolicy\n sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 10:00\n\n let all = fetch Paper\n let low = filter all where reams < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.stock_name} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.stock_name}\" from i.supplier cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.stock_name}\"\n }\n}"} {"id": "train-01606", "domain": "printshop", "pattern": "reorder", "batch": false, "sop": "Each Tuesday at 8:30am, check Paper. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy PrintshopStockPolicy {\n allow read Paper(stock_name, reams, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Paper.supplier\n limit order $150 per action\n limit order $750 per day\n}", "sheets": "sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure PrintshopReorder {\n about \"Reorder paper below their minimum\"\n policy PrintshopStockPolicy\n sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every tuesday at 08:30\n\n let all = fetch Paper\n let low = filter all where reams < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.stock_name} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.stock_name}\" from i.supplier cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.stock_name}\"\n }\n}"} {"id": "train-01607", "domain": "printshop", "pattern": "reorder", "batch": false, "sop": "Daily at 11am, check Paper. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $250 on one order; if it would cost more, just tell me. Handle at most 2 items per run.", "policy": "policy PrintshopStockPolicy {\n allow read Paper(stock_name, reams, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Paper.supplier\n limit order $250 per action\n limit order $500 per day\n}", "sheets": "sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure PrintshopReorder {\n about \"Reorder paper below their minimum\"\n policy PrintshopStockPolicy\n sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 11:00\n\n let all = fetch Paper\n let low = filter all where reams < minimum\n for each i in low up to 2 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $250.00 {\n notify owner \"Reorder of {i.stock_name} would cost {cost}, over the $250 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.stock_name}\" from i.supplier cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.stock_name}\"\n }\n}"} {"id": "train-01608", "domain": "printshop", "pattern": "reorder", "batch": false, "sop": "Daily at 11am, check Paper. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy PrintshopStockPolicy {\n allow read Paper(stock_name, reams, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Paper.supplier\n limit order $150 per action\n limit order $450 per day\n}", "sheets": "sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure PrintshopReorder {\n about \"Reorder paper below their minimum\"\n policy PrintshopStockPolicy\n sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 11:00\n\n let all = fetch Paper\n let low = filter all where reams < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.stock_name} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.stock_name}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.stock_name}\"\n }\n}"} {"id": "train-01609", "domain": "printshop", "pattern": "reorder", "batch": false, "sop": "Daily at 8am, check Paper. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 2 items per run.", "policy": "policy PrintshopStockPolicy {\n allow read Paper(stock_name, reams, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Paper.supplier\n limit order $150 per action\n limit order $300 per day\n}", "sheets": "sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure PrintshopReorder {\n about \"Reorder paper below their minimum\"\n policy PrintshopStockPolicy\n sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 08:00\n\n let all = fetch Paper\n let low = filter all where reams < minimum\n for each i in low up to 2 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.stock_name} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.stock_name}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.stock_name}\"\n }\n}"} {"id": "train-01610", "domain": "printshop", "pattern": "reorder", "batch": false, "sop": "Daily at 4pm, check Paper. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $150 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy PrintshopStockPolicy {\n allow read Paper(stock_name, reams, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Paper.supplier\n limit order $150 per action\n limit order $600 per day\n}", "sheets": "sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure PrintshopReorder {\n about \"Reorder paper below their minimum\"\n policy PrintshopStockPolicy\n sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 16:00\n\n let all = fetch Paper\n let low = filter all where reams < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $150.00 {\n notify owner \"Reorder of {i.stock_name} would cost {cost}, over the $150 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.stock_name}\" from i.supplier cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.stock_name}\"\n }\n}"} {"id": "train-01611", "domain": "printshop", "pattern": "reorder", "batch": false, "sop": "Each Monday at 4pm, check Paper. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $200 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy PrintshopStockPolicy {\n allow read Paper(stock_name, reams, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Paper.supplier\n limit order $200 per action\n limit order $800 per day\n}", "sheets": "sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure PrintshopReorder {\n about \"Reorder paper below their minimum\"\n policy PrintshopStockPolicy\n sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every monday at 16:00\n\n let all = fetch Paper\n let low = filter all where reams < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $200.00 {\n notify owner \"Reorder of {i.stock_name} would cost {cost}, over the $200 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.stock_name}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.stock_name}\"\n }\n}"} {"id": "train-01612", "domain": "printshop", "pattern": "reorder", "batch": false, "sop": "Each day at 4pm, check Paper. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy PrintshopStockPolicy {\n allow read Paper(stock_name, reams, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Paper.supplier\n limit order $100 per action\n limit order $500 per day\n}", "sheets": "sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure PrintshopReorder {\n about \"Reorder paper below their minimum\"\n policy PrintshopStockPolicy\n sheet Paper \"Paper\" { stock_name: Text, reams: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 16:00\n\n let all = fetch Paper\n let low = filter all where reams < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.stock_name} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.stock_name}\" from i.supplier cost cost, ask owner first timeout 12 hours else skip\n log \"ordered {i.stock_name}\"\n }\n}"} {"id": "train-01613", "domain": "printshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy PrintshopRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $250 per day\n refund without approval up to $20\n limit sends 30 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure PrintshopRefunds {\n about \"Handle refund requests within limits\"\n policy PrintshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01614", "domain": "printshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $100, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy PrintshopRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $100 per action\n limit refund $300 per day\n refund without approval up to $15\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure PrintshopRefunds {\n about \"Handle refund requests within limits\"\n policy PrintshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $100.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $100. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01615", "domain": "printshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy PrintshopRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $250 per day\n refund without approval up to $10\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure PrintshopRefunds {\n about \"Handle refund requests within limits\"\n policy PrintshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01616", "domain": "printshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy PrintshopRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $375 per day\n refund without approval up to $10\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure PrintshopRefunds {\n about \"Handle refund requests within limits\"\n policy PrintshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01617", "domain": "printshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $75, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy PrintshopRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $225 per day\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure PrintshopRefunds {\n about \"Handle refund requests within limits\"\n policy PrintshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01618", "domain": "printshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy PrintshopRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $250 per day\n refund without approval up to $10\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure PrintshopRefunds {\n about \"Handle refund requests within limits\"\n policy PrintshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} {"id": "train-01619", "domain": "printshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 60 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $15 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy PrintshopRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $300 per day\n refund without approval up to $15\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure PrintshopRefunds {\n about \"Handle refund requests within limits\"\n policy PrintshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 60 {\n notify owner \"Refund request {r.request_id} is older than 60 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $15.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} {"id": "train-01620", "domain": "printshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"printed\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, status, file_link)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger when new row r in Jobs\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Jobs\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"printed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01621", "domain": "printshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"printed\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger when new row r in Jobs\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Jobs\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"printed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01622", "domain": "printshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"printed\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger when new row r in Jobs\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Jobs\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"printed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01623", "domain": "printshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"printed\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, status, file_link)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger when new row r in Jobs\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 1 day else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Jobs\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"printed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 1 day else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01624", "domain": "printshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"printed\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger when new row r in Jobs\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Jobs\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"printed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01625", "domain": "printshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"printed\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger when new row r in Jobs\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Jobs\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"printed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} {"id": "train-01626", "domain": "printshop", "pattern": "escalation", "batch": false, "sop": "Every day at 11am: for customers with a quote above zero whose print job passed more than 7 days ago, send a polite reminder with the amount. Let me check the messages before they go out. If it's more than 21 days late, don't message them; tell me so I can call. Never include their file link. At most 40 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, quote)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 11:00\n\n let all = fetch Jobs\n let late = filter all where quote > $0.00 and days_between(due, today()) > 7\n for each r in late up to 40 {\n if days_between(r.due, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.quote}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a quote of {r.quote}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01627", "domain": "printshop", "pattern": "escalation", "batch": false, "sop": "Every Thursday at 11am: for customers with a quote above zero whose print job passed more than 5 days ago, send a polite reminder with the amount. I want to approve each message first. If it's more than 30 days late, don't message them; tell me so I can call. Keep the file link out of the message. At most 20 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, quote, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Jobs\n let late = filter all where quote > $0.00 and days_between(due, today()) > 5\n for each r in late up to 20 {\n if days_between(r.due, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.quote}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a quote of {r.quote}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01628", "domain": "printshop", "pattern": "escalation", "batch": false, "sop": "Each Tuesday at 8:30am: for customers with a quote above zero whose print job passed more than 7 days ago, send a polite reminder with the amount. Show me the messages for approval first. If it's more than 21 days late, don't message them; tell me so I can call. Keep the file link out of the message. At most 30 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, quote, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every tuesday at 08:30\n\n let all = fetch Jobs\n let late = filter all where quote > $0.00 and days_between(due, today()) > 7\n for each r in late up to 30 {\n if days_between(r.due, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.quote}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a quote of {r.quote}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01629", "domain": "printshop", "pattern": "escalation", "batch": false, "sop": "Each morning at 10am: for customers with a quote above zero whose print job passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 14 days late, don't message them; tell me so I can call. Don't mention the file link. At most 30 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, quote)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 10:00\n\n let all = fetch Jobs\n let late = filter all where quote > $0.00 and days_between(due, today()) > 5\n for each r in late up to 30 {\n if days_between(r.due, today()) > 14 {\n notify owner \"{r.customer} is very late ({r.quote}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a quote of {r.quote}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-01630", "domain": "printshop", "pattern": "escalation", "batch": false, "sop": "Daily at 9am: for customers with a quote above zero whose print job passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 30 days late, don't message them; tell me so I can call. Never include their file link. At most 40 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, quote, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 09:00\n\n let all = fetch Jobs\n let late = filter all where quote > $0.00 and days_between(due, today()) > 5\n for each r in late up to 40 {\n if days_between(r.due, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.quote}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a quote of {r.quote}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01631", "domain": "printshop", "pattern": "escalation", "batch": false, "sop": "Each day at 5:30pm: for customers with a quote above zero whose print job passed more than 5 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 30 days late, don't message them; tell me so I can call. Don't mention the file link. At most 20 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, quote, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 17:30\n\n let all = fetch Jobs\n let late = filter all where quote > $0.00 and days_between(due, today()) > 5\n for each r in late up to 20 {\n if days_between(r.due, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.quote}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a quote of {r.quote}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} {"id": "train-01632", "domain": "printshop", "pattern": "escalation", "batch": false, "sop": "Daily at 9am: for customers with a quote above zero whose print job passed more than 7 days ago, send a polite reminder with the amount. I need to OK every message. If it's more than 21 days late, don't message them; tell me so I can call. Keep the file link out of the message. At most 40 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, quote)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 09:00\n\n let all = fetch Jobs\n let late = filter all where quote > $0.00 and days_between(due, today()) > 7\n for each r in late up to 40 {\n if days_between(r.due, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.quote}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer default 'there'}, our records show a quote of {r.quote}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01633", "domain": "printshop", "pattern": "escalation", "batch": false, "sop": "Each morning at 11am: for customers with a quote above zero whose print job passed more than 7 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 21 days late, don't message them; tell me so I can call. Keep the file link out of the message. At most 40 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, quote, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 11:00\n\n let all = fetch Jobs\n let late = filter all where quote > $0.00 and days_between(due, today()) > 7\n for each r in late up to 40 {\n if days_between(r.due, today()) > 21 {\n notify owner \"{r.customer} is very late ({r.quote}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a quote of {r.quote}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n }\n}"} {"id": "train-01634", "domain": "printshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Let me check the messages before they go out. Don't mention the file link. No more than 50.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01635", "domain": "printshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Keep the file link out of the message. No more than 50.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01636", "domain": "printshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Never include their file link. No more than 100.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01637", "domain": "printshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Don't mention the file link. No more than 50.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01638", "domain": "printshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Don't mention the file link. No more than 100.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01639", "domain": "printshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Never include their file link. No more than 100.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} {"id": "train-01640", "domain": "printshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Never include their file link. No more than 100.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} {"id": "train-01641", "domain": "printshop", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Keep the file link out of the message. No more than 100.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} {"id": "train-01642", "domain": "printshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Never include their file link. No more than 50.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01643", "domain": "printshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Never include their file link. No more than 100.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01644", "domain": "printshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Keep the file link out of the message. No more than 100.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01645", "domain": "printshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the file link out of the message. No more than 50.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01646", "domain": "printshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Don't mention the file link. No more than 50.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01647", "domain": "printshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Keep the file link out of the message. No more than 50.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} {"id": "train-01648", "domain": "printshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Never include their file link. No more than 50.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"}