Skip to content

πŸ“ The Office Automation Framework (OAF) is an extensible Python framework for automating office tasks

License

Notifications You must be signed in to change notification settings

mscbuild/office_automation_framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

98 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“¦ Office Automation Framework (OAF)

The Office Automation Framework (OAF) is an extensible Python framework for automating office tasks:

  • πŸ“Š Data processing,
  • πŸ“„ Report generation (HTML/PDF),
  • πŸ“¬ Email distribution,
  • πŸ“ File management,
  • ⏰ Task scheduling,
  • πŸ–₯ CLI management.

The framework is supplied as a pip package and can be used:

  • As a command-line utility

  • As a library

  • As a basis for a microservice or API

🎯 What is the project for?

In most companies:

  • Reports are compiled manually

  • Excel files are copied and edited manually

  • PDF reports are not generated in a standardized manner

  • Distribution is done manually

  • There is no uniform reporting standard

❌ This leads to:

  • errors

  • wasted time

  • lack of transparency

  • difficulty scaling

OAF solves these problems by providing a unified framework for automation.

πŸ’‘ Why do you need this particular framework?

Problem OAF Solution
Disjointed scripts Unified architecture
No reporting standards Jinja2 templates
Manual PDF export HTML β†’ PDF
No CLI Full-fledged oaf command
Difficult to scale Modular structure
No access roles Access levels

πŸ—‚ Project structure

office_automation_framework/
β”‚
β”œβ”€β”€ oaf/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ config.py
β”‚   β”œβ”€β”€ logging.py
β”‚
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ loader.py
β”‚   β”‚   β”œβ”€β”€ processor.py
β”‚   β”‚   └── exporter.py
β”‚
β”‚   β”œβ”€β”€ reports/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ html.py
β”‚   β”‚   β”œβ”€β”€ pdf.py
β”‚   β”‚   └── templates/
β”‚   β”‚       └── financial_report_template.html
β”‚
β”‚   β”œβ”€β”€ files/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── manager.py
β”‚
β”‚   β”œβ”€β”€ mail/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── sender.py
β”‚
β”‚   β”œβ”€β”€ scheduler/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── scheduler.py
β”‚
β”‚   └── security/
β”‚       β”œβ”€β”€ __init__.py
β”‚       └── access.py
β”‚
β”œβ”€β”€ examples/
β”‚   └── daily_financial_report.py
β”‚
β”œβ”€β”€ pyproject.toml
β”œβ”€β”€ README.md
└── LICENSE

πŸ— Project architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ CLI (oaf)  β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Business Logic  β”‚
β”‚ (reports, data) β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Infrastructure    β”‚
β”‚ files, mail, pdf  β”‚
└───────────── β”€β”€β”€β”€β”€β”˜

The project is not tied to a UI, database, or webβ€”it can be easily integrated into any environment.

πŸ“Œ C4 β€” Context Diagram

Objective: to show why the system exists and with whom it interacts.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        Business Users        β”‚
β”‚ (Finance, Analytics, HR)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ CLI / Reports
               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Office Automation Framework (OAF) β”‚
β”‚                                     β”‚
β”‚  β€’ Data Processing                  β”‚
β”‚  β€’ Reports (HTML / PDF)             β”‚
β”‚  β€’ Scheduling                       β”‚
β”‚  β€’ Email                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
               β”‚               β”‚
               β–Ό               β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ File System β”‚   β”‚ Email Serverβ”‚
        β”‚ CSV / Excel β”‚   β”‚ SMTP        β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“¦ C4 β€” Container Diagram

Objective: to show the main technical blocks.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 CLI (oaf)                     β”‚
β”‚  argparse / entrypoints                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            Core Application                   β”‚
β”‚                                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Data Layer β”‚  β”‚ Report     β”‚  β”‚ Securityβ”‚  β”‚
β”‚  β”‚ (Pandas)   β”‚  β”‚ Engine     β”‚  β”‚ Access  β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”‚
β”‚  β”‚ File Mgmt  β”‚  β”‚ Scheduler  β”‚               β”‚
β”‚  β”‚ os/shutil  β”‚  β”‚ schedule   β”‚               β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚               β”‚
                β–Ό               β–Ό
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚ PDF Engine β”‚   β”‚ Email SMTP β”‚
         β”‚ WeasyPrintβ”‚   β”‚ smtplib     β”‚ 
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🧱 C4 β€” Component

Reports Module
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ HTMLReport                       β”‚
β”‚  β€’ load template                 β”‚
β”‚  β€’ render context                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ PDFReport                        β”‚
β”‚  β€’ HTML β†’ PDF                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Module
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ DataLoader β”‚ β†’ β”‚ DataProcessor β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”· UML Component Diagram

+------------------+
|      CLI         |
+------------------+
          |
          v
+------------------+
| Report Service   |
+------------------+
 |        |        |
 v        v        v
Data   Templates  PDF
(Pandas) (Jinja2) (WeasyPrint)

πŸ” UML Sequence Diagram (report generation)

User
 β”‚
 β”‚ oaf report generate
 β–Ό
CLI
 β”‚ validate args
 β”‚
 β–Ό
HTMLReport
 β”‚ render template
 β”‚
 β–Ό
PDFReport
 β”‚ create PDF
 β”‚
 β–Ό
FileSystem
 β”‚ save report.pdf
 β–Ό
User

🧰 Tech Stack

🐍 Language

  • Python 3.9+

πŸ“Š Data

  • Pandas β€” loading, cleaning, and aggregating data

  • OpenPyXL β€” Excel formatting

πŸ“„ Reports

  • Jinja2 β€” HTML templates

  • Chart.js β€” interactive charts

  • WeasyPrint β€” HTML β†’ PDF

πŸ“¬ Mail

  • smtplib

  • email.message

πŸ“ Files

  • os, shutil

⏰ Planning

  • schedule

πŸ–₯ CLI

  • argparse

  • pip entry points

πŸš€ Key Features

πŸ“Š Data Processing

  • CSV / Excel

  • Cleaning and Normalization

  • Pivot Tables

  • Aggregations

πŸ“„ Report generation

  • HTML (corporate style)

  • PDF (print, archive)

  • Charts

  • Multiple tables

  • KPI blocks

πŸ” Security

  • Access levels:

  • public

  • internal

  • confidential

  • privacy warnings

  • logical data isolation

πŸ–₯ CLI

oaf report generate
  • Report parameters

  • Templates

  • Output files

  • CI/CD ready

πŸ“¬ Email

  • Sending PDF

  • Attachments

  • SMTP Configuration

⏰ Planner

  • Daily reports

  • Automatic launch

πŸ§ͺ Typical use cases

πŸ“… Daily Reports

  • Finance

  • Sales

  • HR

  • Logistics

πŸ“ˆ Financial analytics

  • P&L

  • cash flow

  • budgets

  • variances

πŸ—‚ Archiving

  • Daily PDF saving

  • Date structure

🏒 Corporate reporting

  • Unified style

  • Unified templates

  • Access control

🧩 Design for Extension

OAF is designed from the ground up to grow.

πŸ”œ Possible additions

πŸ”§ CLI

oaf report email

oaf report schedule

oaf data validate

🌐 Web / API

  • FastAPI

  • REST / GraphQL

  • authorization

🐳 DevOps

  • Docker

  • Kubernetes CronJob

  • GitHub Actions

πŸ” Security

  • PDF password

  • watermark

  • encryption

  • RBAC

πŸ“Š BI

  • Power BI

  • Tableau

  • unloading

πŸ—„ Storage

  • PostgreSQL

  • S3 / MinIO

  • SharePoint

πŸ“ˆ Business Benefits

  • ⏱ Time Savings

  • πŸ“‰ Error Reduction

  • πŸ“Š Transparent Analytics

  • 🧩 Scalability

  • πŸ” Security

  • πŸš€ Rapid Automation

🧠 Who is this project for?

  • Python developers

  • Analysts

  • Finance departments

  • IT departments

  • DevOps

πŸ“¦ Usage formats

Format Usage
pip package local scripts
CLI automation
library integration
service enterprise systems

πŸ› οΈ Installation

git clone https://github.com/mscbuild/office_automation_framework.git
cd office_automation_framework

πŸ”Ή Step 1: Clone or create a folder

mkdir office_automation_framework
cd office_automation_framework

πŸ”Ή Step 2: Install dependencies

pip install -r requirements.txt

⚠️ Additional for PDF (WeasyPrint) Windows

pip install weasyprint

🍎 macOS

brew install cairo pango gdk-pixbuf libffi
pip install weasyprint

🐧 Ubuntu / Debian

sudo apt install libcairo2 libpango-1.0-0 libgdk-pixbuf2.0-0
pip install weasyprint

β–Ά 2️⃣ Application (launch)

πŸ“Š Preparing Input Data

Create a file:

data/sales.xlsx

Columns:

manager | amount

πŸš€ Launch a daily report

python examples/daily_financial_report.py

πŸ“ Result:

output/
β”œβ”€β”€ summary.xlsx
└── report.pdf

πŸ“§ The letter is sent automatically.

πŸ§ͺ 3️⃣ Testing (simple)

πŸ”Ή Quick manual test

python -c "from oaf.data.loader import DataLoader; print(DataLoader)"

πŸ”Ή Testing report generation without email

(Temporarily comment out MailSender in daily_financial_report.py)

python examples/daily_financial_report.py

Expected:

  • summary.xlsx

  • report.pdf

πŸ§ͺ 4️⃣ Automated tests (optional, recommended)

Installing pytest

pip install pytest

Running tests

pytest

πŸ”„ 5️⃣ Typical developer workflow

git pull
source venv/bin/activate
pip install -r requirements.txt
pytest
python examples/daily_financial_report.py

πŸ“œ LICENSE (MIT)

MIT License

About

πŸ“ The Office Automation Framework (OAF) is an extensible Python framework for automating office tasks

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published