How devashishmaurya/opd works
Project type and purpose
• This is a lightweight Python-based “tool” whose sole purpose is to generate OPD (out‑patient department) slips and prescriptions by reading data from a Google Sheet, applying a rendering template (render.yaml), and producing PDF outputs (prescription.pdf, slip reports).
File structure
• Top‑level scripts and modules:
• app.py – The main entry point / orchestrator
• report.py – PDF/report‐generation logic
• google_sheet.py – Google Sheets API client wrapper
• sheetUtil.py – Utility functions for parsing & transforming sheet data
• test.py – Unit/integration tests
• get-pip.py – Bootstrap pip installer (one‐off helper)
• Configuration & assets:
• render.yaml – Template definitions (fields, layout, styling)
• requirements.txt – Dependency list
• prescription.pdf – Sample output or static asset
• README.md simply notes “opd slips,” confirming the PDF generation focus.
Key external dependency
• Google Sheets API
Main components
a. Client/Trigger
• CLI or scheduler that invokes app.py
b. Configuration Loader
• render.yaml reader
c. Google Sheets Service
• google_sheet.py calling Google API
d. Data Processing Layer
• sheetUtil.py transforms raw rows into domain objects
e. Report Generation Layer
• report.py uses domain objects + template to render PDF
f. Output Store
• File system (local folder) or downstream distribution
g. Tests
• test.py (can be shown off to the side)
Relationships & data flow
• From app.py → Configuration Loader (reads render.yaml)
• app.py → Google Sheets Service → external Google API
• Raw data → sheetUtil.py → normalized data
• Normalized data + template → report.py → PDF output
• PDF output → local file system (prescription.pdf, slip_NNN.pdf)
Architectural patterns & principles
• Single‐process, layered‐architecture script
• Separation of concerns: API client, utilities, report generation, configuration
• Config driven (render.yaml) to support template changes without code edits