You are a senior Python automation engineer and RPA specialist. Your task is to design and build a complete Python-based RPA solution for a South African customs clearing and forwarding business. π― Objective Automate repetitive customs workflows to reduce manual work, prevent errors, and eliminate delays that cause demurrage and penalties. π’ Business Context - Industry: Customs Clearing & Freight Forwarding - Country: South Africa - Key systems: - SARS eFiling portal (CUSDEC, SAD500, CUSRES) - Shipping line tracking sites (Maersk, MSC, CMA CGM) - Microsoft Outlook (email communication) - Excel files (shipment data, tariff codes, invoices) - Constraints: - Must be POPIA compliant (no sensitive data sent to external cloud services) - Must run on a local Windows PC (can run 24/7) - Must tolerate unstable websites and session timeouts βοΈ Required Automations (Priority Order) 1. Container Tracking Bot (HIGH PRIORITY) - Input: List of container numbers from Excel or CSV - Actions: - Open shipping line tracking websites - Search each container - Extract status (e.g., βDischargedβ, βIn Transitβ) - Output: - If status changes to βDischargedβ β send email notification - Log all statuses to a local file (CSV or database) 2. Invoice Processing + Duty Calculation - Input: PDF invoices in a folder - Actions: - Extract data using OCR (values, HS codes if available) - Map to tariff table (from Excel or CSV) - Calculate duties and VAT - Output: - Generate structured Excel summary - Optional: email quote to client 3. SARS Pre-fill Automation (NOT full auto-submit) - Input: Excel sheet with shipment data - Actions: - Open SARS eFiling - Navigate to CUSDEC form - Populate fields automatically - Output: - Leave final submission for human review - Take screenshots for audit trail 4. CUSRES Monitoring Bot - Actions: - Log into SARS eFiling - Check for new responses - Output: - If rejected β send alert email with reason - Maintain log history π§° Technical Requirements - Use Python - Preferred libraries: - Playwright (web automation) - PyAutoGUI (fallback for UI automation) - pandas (Excel handling) - pytesseract or similar (OCR) - smtplib (email notifications) - Code must be: - Modular (separate files per bot) - Well-commented - Easy for a beginner to modify π₯οΈ Environment Setup Provide: - Step-by-step installation guide - Required pip installs - Folder structure - How to run each bot - How to schedule using Windows Task Scheduler π Reliability & Safety - Handle: - Website changes (use robust selectors) - Timeouts and retries - Login failures - Include logging system: - Timestamped logs - Error reporting - Never hardcode sensitive credentials β use environment variables π€ Output Format Deliver: 1. Full working Python scripts 2. Setup instructions (step-by-step) 3. Example input files (Excel/CSV) 4. Explanation of how each bot works 5. Suggestions for scaling or improving π Goal The final system must: - Save at least 2β4 hours of manual work per day - Reduce human error in customs entries - Ensure no missed container status updates - Be maintainable by someone with basic Python knowledge Start with the Container Tracking Bot first, then proceed to the others.
Sign in to leave a comment


No comments yet. Be the first!