Skip to content

bxdavies/ShiftCreator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📘 ShiftCreator

ShiftCreator is an interactive Python tool that automatically generates Outlook calendar events based on a repeating shift pattern. It authenticates using Microsoft’s Interactive Browser Login and inserts events directly into your chosen Outlook calendar using the Microsoft Graph API.

The tool includes a clean Rich‑powered terminal UI, supports both Simple Mode and Advanced Mode, and validates user input to prevent mistakes.

✨ Features

  • Interactive wizard with Simple and Advanced modes
  • Microsoft Graph authentication via InteractiveBrowserCredential
  • Creates events in any Outlook calendar
  • Configurable:
    • Shift pattern
    • Day/night start times
    • Shift duration
    • Calendar name
  • Rich terminal UI (tables, colours, progress bars)
  • Validates dates, timezones, and user inputs
  • Supports .env configuration for secrets

📦 Installation

Clone the repository:

git clone https://github.com/yourusername/shiftcreator.git  
cd shiftcreator

Install dependencies:

pip install -r requirements.txt

🔐 Environment Setup

Create a .env file in the project root:

CLIENT_ID=your_azure_app_client_id  
TENANT_ID=your_azure_tenant_id

These values come from your Azure App Registration.

Azure App Requirements

Your app registration must be configured as a public client:

  • Redirect URI: http://localhost:8400
  • "Allow public client flows" enabled
  • API Permissions:
    • Calendars.ReadWrite (delegated)

🕒 Shift Pattern

ShiftCreator uses a repeating 28‑day cycle defined as:

SHIFT_PATTERN =  
  ('night', 3)  
  ('day', 2)  
  ('night', 4)  
  ('day', 2)  
  ('day', 3)

This means:

Block 1 — Night — 3 days
Block 2 — Day — 2 days
Block 3 — Night — 4 days
Block 4 — Day — 2 days
Block 5 — Day — 3 days

After each block, the pattern includes an equal number of off‑days before the next block begins.
The cycle repeats until the requested number of days is generated.

🔎 Important

When the tool asks for the shift pattern start date, enter the date on which the first block begins — the start of the first Night (3 days) block.

🚀 Usage

Run the tool:

python shiftcreator.py

You will be prompted to choose:

Simple Mode

Asks for:

  • Start date
  • Number of days

Uses defaults:

  • Calendar name: work
  • Day shift start: 06:00
  • Night shift start: 18:00
  • Duration: 12 hours

Advanced Mode

Allows you to customise:

  • Calendar name
  • Start date
  • Number of days
  • Day shift start hour
  • Night shift start hour
  • Shift duration

📧 Outlook Requirements

Before running the tool, ensure:

  • Your Outlook account has a calendar named "work" (or whichever name you choose)

  • Outlook categories:

    • Day Shift
    • Night Shift

    already exist
    (Microsoft Graph requires categories to be created before assigning them)

📄 License

MIT License. See LICENSE for details.

About

Automatically generates Outlook calendar events based on a repeating shift pattern

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages