Skip to main content

Generate milestone birthday letters for employees and deliver them through managers.

Project description

HR Birthday Letter Generator

A simple Python project to generate milestone birthday letters for employees and deliver them through managers. It can be used from the command line or through a small desktop app for office users.

Project structure

  • generate_birthday_letters.py - package entrypoint script
  • birthday_letters_app.py - desktop app entrypoint
  • Start Birthday Letters.bat - Windows launcher for the desktop app
  • hr_birthday_letters/ - package source code
  • hr_birthday_letters/templates/ - language-specific mail cover and PDF letter templates
  • employees.csv - sample employee data file
  • tests/ - unit tests
  • output/ - generated mail cover text files and PDF letters are saved here by default

CSV Format

Required columns:

  • Name
  • DateOfBirth (YYYY-MM-DD)
  • Manager
  • Language (matches a template file such as en.txt or nl.txt)

Optional columns:

  • ManagerEmail (required when creating Outlook mails)
  • EmployeeEmail
  • Department
  • Location

Example:

Name,DateOfBirth,Manager,ManagerEmail,Language,Department,Location
Alice Johnson,1996-05-28,Michael Smith,michael.smith@example.com,en,Engineering,New York
Ella Rodriguez,2001-05-28,Michael Smith,michael.smith@example.com,nl,Engineering,New York

Templates

Templates are plain text files stored in hr_birthday_letters/templates/ by default. The employee Language value selects matching templates for both outputs:

  • The mail cover text uses hr_birthday_letters/templates/cover/<language>.txt
  • The PDF birthday letter uses hr_birthday_letters/templates/letter/<language>.txt

For example, en uses both:

  • hr_birthday_letters/templates/cover/en.txt
  • hr_birthday_letters/templates/letter/en.txt

The cover text is high level and addressed to the manager. The PDF letter is addressed to the employee whose birthday milestone is being recognized.

Available placeholders:

  • $date
  • $manager
  • $manager_email
  • $employee_name
  • $employee_email
  • $birthday
  • $age
  • $department
  • $location
  • $language

Install

Use Python 3.9+ and install the package in editable mode:

cd C:\Users\KRIJDI01\hr-birthday-letters
python -m pip install -e .

For Outlook desktop integration on Windows, install the optional office dependency:

python -m pip install -e ".[office]"

Desktop app

Start the app:

.\Start Birthday Letters.bat

Or run it with Python:

python birthday_letters_app.py

Or use the installed script:

hr-birthday-letters-ui

The app lets an office user:

  • Select the employee CSV, output folder, and template folder
  • Generate mail cover text files and PDF birthday letters
  • Maintain cover and PDF letter templates by language
  • Create Outlook drafts with the PDF attached
  • Open Outlook mails for review or send immediately after confirmation

Run

python generate_birthday_letters.py employees.csv

Or use the installed CLI script:

hr-birthday-letters employees.csv

To specify a different output directory:

hr-birthday-letters employees.csv --output-dir letters

To use a custom template directory:

hr-birthday-letters employees.csv --template-dir templates

To create Outlook drafts from the command line:

hr-birthday-letters employees.csv --create-outlook-drafts

Other Outlook options:

hr-birthday-letters employees.csv --open-outlook-mails
hr-birthday-letters employees.csv --send-outlook-mails

The custom directory should use the same layout:

templates/
  cover/
    en.txt
    nl.txt
  letter/
    en.txt
    nl.txt

Test

Install the test dependencies first:

python -m pip install -e .[test]
python -m pytest

How it works

  • Reads employee rows from a CSV file
  • Computes each employee's age as of today
  • Generates the cover text and PDF letter only when the age is a positive multiple of 5
  • Selects cover and letter templates using the employee's Language value
  • Saves one manager-facing mail cover text file per eligible employee
  • Saves one employee-facing birthday letter PDF per eligible employee
  • Uses ManagerEmail to create Outlook mails with the PDF attached

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hr_birthday_letters-0.1.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hr_birthday_letters-0.1.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file hr_birthday_letters-0.1.0.tar.gz.

File metadata

  • Download URL: hr_birthday_letters-0.1.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for hr_birthday_letters-0.1.0.tar.gz
Algorithm Hash digest
SHA256 694456da5215aae4590de5594e2b6b267efd51af312aa62819bf0f0648025a2b
MD5 5387cf09762e3ddb566668337b20bfba
BLAKE2b-256 bc2d20a5e09e1ba7e21b2075b19532f9484c39a8d54a706e01be7be2f93c68f5

See more details on using hashes here.

File details

Details for the file hr_birthday_letters-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hr_birthday_letters-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 414fcc54ad55c952d63de5a205ac88af348fe09d271a3950c20552750ef804e0
MD5 858096bad72f9f5abd17da1439335d79
BLAKE2b-256 954291dc6e40780121bb7ead2f90bf108037d153d0c165b5cb33ed3cc69e1a3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page