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
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.
| 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 |
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ββββββββββββββ
β 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.
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 β
βββββββββββββββ βββββββββββββββ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 β
ββββββββββββββ ββββββββββββββReports Module
ββββββββββββββββββββββββββββββββββββ
β HTMLReport β
β β’ load template β
β β’ render context β
βββββββββββββββββ¬βββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββββββ
β PDFReport β
β β’ HTML β PDF β
ββββββββββββββββββββββββββββββββββββ
Data Module
ββββββββββββββ βββββββββββββββββ
β DataLoader β β β DataProcessor β
ββββββββββββββ βββββββββββββββββ+------------------+
| CLI |
+------------------+
|
v
+------------------+
| Report Service |
+------------------+
| | |
v v v
Data Templates PDF
(Pandas) (Jinja2) (WeasyPrint)User
β
β oaf report generate
βΌ
CLI
β validate args
β
βΌ
HTMLReport
β render template
β
βΌ
PDFReport
β create PDF
β
βΌ
FileSystem
β save report.pdf
βΌ
Userπ Language
- Python 3.9+
-
Pandas β loading, cleaning, and aggregating data
-
OpenPyXL β Excel formatting
-
Jinja2 β HTML templates
-
Chart.js β interactive charts
-
WeasyPrint β HTML β PDF
-
smtplib
-
email.message
os,shutil
- schedule
-
argparse
-
pip entry points
π Data Processing
-
CSV / Excel
-
Cleaning and Normalization
-
Pivot Tables
-
Aggregations
-
HTML (corporate style)
-
PDF (print, archive)
-
Charts
-
Multiple tables
-
KPI blocks
-
Access levels:
-
public
-
internal
-
confidential
-
privacy warnings
-
logical data isolation
oaf report generate-
Report parameters
-
Templates
-
Output files
-
CI/CD ready
-
Sending PDF
-
Attachments
-
SMTP Configuration
-
Daily reports
-
Automatic launch
-
Finance
-
Sales
-
HR
-
Logistics
-
P&L
-
cash flow
-
budgets
-
variances
-
Daily PDF saving
-
Date structure
-
Unified style
-
Unified templates
-
Access control
OAF is designed from the ground up to grow.
π§ 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
-
β± Time Savings
-
π Error Reduction
-
π Transparent Analytics
-
π§© Scalability
-
π Security
-
π Rapid Automation
-
Python developers
-
Analysts
-
Finance departments
-
IT departments
-
DevOps
| Format | Usage |
|---|---|
| pip package | local scripts |
| CLI | automation |
| library | integration |
| service | enterprise systems |
git clone https://github.com/mscbuild/office_automation_framework.git
cd office_automation_frameworkmkdir office_automation_framework
cd office_automation_frameworkpip install -r requirements.txtpip install weasyprintbrew install cairo pango gdk-pixbuf libffi
pip install weasyprintsudo apt install libcairo2 libpango-1.0-0 libgdk-pixbuf2.0-0
pip install weasyprintπ Preparing Input Data
Create a file:
data/sales.xlsxColumns:
manager | amountpython examples/daily_financial_report.pyoutput/
βββ summary.xlsx
βββ report.pdfπ§ The letter is sent automatically.
πΉ Quick manual test
python -c "from oaf.data.loader import DataLoader; print(DataLoader)"(Temporarily comment out MailSender in daily_financial_report.py)
python examples/daily_financial_report.pyExpected:
-
summary.xlsx
-
report.pdf
Installing pytest
pip install pytestRunning tests
pytestgit pull
source venv/bin/activate
pip install -r requirements.txt
pytest
python examples/daily_financial_report.pyMIT License