Field Service Platform to Google Calendar Connector
Table of Contents
I. Presentation
This project aimed to use Python, Gmail and Google Calendar APIs to overcome the absence of a true connector between ACE HYGIENE's field service platform (Praxedo) and Google calendar services.
II. Core Issue
When working at ACE HYGIENE, time lost with data entry was a key issue for the smooth running of operations. Specifically, planning operators used two different calendar services:
- the one embedded in Praxedo,
- and Google Calendar.
Entering data in Praxedo was simply mandatory. Even though entering the same data on Google Calendar was somewhat less essential, it allowed planning operators to take advantage of Google services' powerful search engine capabilities. Which meant saving considerable time later on when a specific piece of information was required.
III. Solution
A. Understanding Praxedo's job life cycle
Before proceeding, it is essential to briefly explain Praxedo's jobs life cycle. A Praxedo job has six main states:
- NEW,
- QUALIFIED,
- PRE-SCHEDULED,
- SCHEDULED,
- DONE,
- and VALIDATED.
A job can go from one state to another through the execution of particular actions. The ones that are the most interesting for this project being:
- SCHEDULING,
- RESCHEDULING,
- and UNSCHEDULING.
Refer to the following flowchart for a visual representation of said processes:
B. Leveraging Praxedo's notification system
Praxedo allows to design customized notification system through text messages and emails when a user-defined event occurs. It is then possible to create three different scenarios where everytime a SCHEDULING, RESCHEDULING or UNSCHEDULING event occurs, an email is sent to an ACE HYGIENE service email address.
Each of these emails contains all relevant information related to the job, among which:
- the names of the involved technician(s),
- the job id, type, datetime and details,
- the client information,
- where the service takes place,
- and the available contacts.
C. Using Google API
Once structured emails are sent to an ACE HYGIENE service email address, the next step is to retrieve these emails using Gmail API. My target emails were all labeled a certain way and I only wanted unread ones.
The response of the API call being a JSON object, it is then fairly straightforward to restructure it with only the necessary data inside. The result of this manipulation is a list of dictionaries (each corresponding to a job object) which will be saved as a file named job_ledger.json
. Every further action related to those jobs on Google Calendar (SCHEDULING, RESCHEDULING, UNSCHEDULING) will be recorded on the very same file.
The very beginning of the script could be therefore represented as follows:
D. Script logic
The rest of the script will then depend of what is in the job_ledger.json
file. The following flowchart explains the script's logic.