Arbin-QuickBase Sync Tool
A Python-based automation tool that monitors Arbin battery test logs and synchronizes test statuses (Start, Stop, Resume) with a QuickBase database.
OVERVIEW
This script automates the manual task of updating battery test statuses. It parses local .htm monitor logs generated by Arbin testers, identifies recent activities within a user-defined time threshold, and performs a bulk update to QuickBase via the REST API.
Key Features
- HTML Parsing: Uses BeautifulSoup to extract timestamps and system messages from Arbin monitor files.
- Intelligent Filtering: Filters logs based on a rolling time window (e.g., last 4 hours) to avoid redundant processing.
- O(1) Status Mapping: Employs dictionary lookups to efficiently match Arbin test names and channel numbers to QuickBase records.
- Bulk API Updates: Minimizes API calls by batching record updates into a single JSON payload.
TECHNICAL STACK
- Language: Python 3.9+
- Libraries: pandas (Data manipulation), BeautifulSoup4 (HTML parsing), requests (API interaction).
- Database: QuickBase (JSON REST API).
GETTING STARTED
Prerequisites:
- Python installed on your machine.
- A QuickBase User Token with permissions to modify the "Cell Test" table.
- Installation:
Clone the repository:
Bash
git clone https://github.com/tuanhlv/updateArbinTA.git
- Install dependencies:
Bash
pip install pandas beautifulsoup4 requests
- Configuration:
Update the following variables in updateArbinTA.py:
- tester: Set this to your specific Arbin unit name (e.g., 'Arbin #8').
- token: Your QuickBase User Token.
- threshold: The look-back period for log entries (default is 4 hours).
HOW IT WORKS
- Extraction: The script reads the HTML log and extracts raw timestamps and message strings.
- Processing: It identifies "Succeeded to start", "Succeeded to stop", and "Succeeded to resume" events.
- Data Alignment: It queries QuickBase for records matching the active channels and uses a priority-based lookup (Test Name first, then Channel Number) to determine the new status.
- Syncing: Only records where the status has actually changed are pushed back to QuickBase to ensure data integrity and efficiency.
ROADMAP
[ ] Implement Object-Oriented Programming (OOP) refactor for better modularity.
[ ] Add Pydantic models for data validation.
[ ] Integrate automated error logging and email alerts.
[ ] Containerize the application using Docker for cloud deployment.