Creating a "Visual Calendar of Schedules" as an FME Server Dashboard

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

Introduction

The workspace attached to this article, described in detail below, will guide you how to create the Visual Calendar Dashboard, as depicted above, for use in FME Server. This workflow heavily relies on a template created by FullCalendar and leveraging the Google Calendar and FME Server REST APIs. The workspace can be scheduled to run on FME Server providing you with an updated overview of when your FME Server Schedules will run!

vAz3kvyY2Het6c3NRBu1kOd3PHSqv4PLokroX8wULWAAP5b2Yk6vqRTtmaxX-a_WZI3Q10OtbfeVXLszuYMS7vVykIGcMPafxupS2JndOqLmNHfQ1C1VtIpR2BZn77Kq-b9ffdTQ

Learn how to create your own “Visual Calendar” Dashboard of FME Server Schedules.

 

Requirements

FME Desktop and Server (2017.1.2 or Newer)
Google Account (Developer Key for Calendar API)

 

Step-by-step Instructions

1. Get a Google Account and Calendar API Key

6HyINc08z21f_85DhseS79A2D2pyc9sW8mxHzDC9WA9C2hebg4abVw8nwinopG22Dsin1EASmTklfA6IZlB8-OjvpMUMjJ9s3WHpF0RyMhS0ThUVTzqb55G-zR7KMRtqzak06-Pz

Create a Google account (or use an existing one) and visit the Google Developer API Dashboard. Here you will have to enable the Google Calendar API and then create an API Key – there are plenty of great ‘How To’ resources available to help.

 

2. Make Google Calendar Public and Determine the Google Calendar ID

Lz0CI7DVY_0ko5HmkOSgxPtJp_FQ_d5SUx_-hLixqxtaAkVGQr8ApzGPrpaeOA0x3xHWWK653GTIVxyieB0S5CPe-RwJIU1qKYak7k9RlGBR9YtX3UIjcu70m5pKa_Wd0DkQWyhc

The logic for this workflow revolves around reading and writing to an existing Public Google Calendar. You can use any calendar that you have created on your Google account, or link to an external one. Remember that it has to be publicly accessible! It is important to search for current instructions if you need help determining the Calendar ID.

 

3. Get an FME Server Token

cp1Z3NvKT8x4_Dcqc3qejw_VxTvtvtc_9sBQFyseA2jU2UEqXUf43B-Iu3RxsoHb7iwxa_Gt_zT22IC2rKOg1X2pVS9j0Cr2VAUk5gxiWjbyyNK3ZXwGZjtRFJ_VZd_bo2A836Fv

For this workflow to gather details from FME Server, you need to obtain a valid fme token to access the REST API. It is preferred to get the token from a user that is a member of the fmeadmin role.

 

4. The Workspace and Template HTML

0Kl7pjLY3rFRKmy6i10RLDM8VlCCwN5YVzqSYPJ0Pp4pBi-re9hHo9RhLyGgvB9H3pJn-vQngK3zyUpuwNUevX0iD_Qn4TVXIDk_O6MgXiUdPN8dorXoxwirkd_chyCmnZVDF1fs

Download the attached FME Workspace. You can set FME to “Run with Prompt” and replace all the default values with information obtained in the first three steps.

For a more detailed look into the workspace, read Workspace Overview below.

 

5. Publish to FME Server and Configure Published Parameters

Publish this workspace to FME Server. You can either manually run the workspace or configure it to run daily on a schedule. Just make sure to adjust all of the Published Parameters to match your unique values and – voila! A visual calendar for you to see all of your FME Server Schedules.

 

Workspace Overview

Bookmark 1. GET FME Server Schedule List

qGr89dqJn5oIx3Itjj6HeM0G_QUB1iczc7JeP0HyRPt9JBgxGO9LprNrhUAg-UbDVcP6YRKiFMDy0GYlQEb2LSAVtuFMCJYIdHyIDA1MuU--9v3aadn2wxuWdx9400laDDM7bsHB

The Creator transformer starts the workflow with a null feature to invoke the HTTPCaller. This transformer then gathers a response from the FME Server REST API, /fmerest/v3/schedules, of all the FME Server Schedules. The return is in JSON format, and the FeatureWriter saves the output to file for use later in the workspace.

 

Bookmark 2. GET Google Calendar Event Ids and DELETE All

Z6BBio-eRmuJ1nMadpFMPLfuwqLS4_P0Wo9uyvparbyixtNztj4GBFH8u0dFQ_pvxy8Ys9d6IAtXZFVWHQ4NWbwVqSuqdg7s9mlDOylCUtj87JUSY2WQU8TbO3gCel3VBEf8gZtE

The next HTTPCaller in this workflow gathers a list, again in JSON, of all Events in the Google Calendar by accessing a Google Calendar REST API endpoint. The JSONFlattener and ListExploder will expose each Event as an individual feature for FME to process. The second HTTPCaller in this Bookmark then issues the DELETE command against each Calendar Event – this operation is necessary since this workflow does not have logic to determine which FME Server Schedules already exist as Events. The Sampler transformer is used here to reduce the number of features flowing into the next Bookmark.
Note: This effectively deletes every item in the specified Google Calendar. It is important to be aware of this!

 

Bookmark 3. Read Each Schedule as Feature and Filter Disabled

WWEItmawb25er1NVrBPTMZe0ZOtXYq6KeVcEWCV3UjAgj9FKVW9QqbbnQ4NFykauZmjELX3QJ3pE2lAcLnla0bR5fXDh5A6mnvyzeVLV75QjHzJ9C5QzQ22aPbxtn3f3xCGjOYPN

The FeatureReader will read back the JSON response saved earlier – if the Sampler was not previously used, this transformer would create redundant features by reading in the same dataset multiple times. The combination of AttributeExposer and ListExploder creates a separate feature for each FME Server Schedule. TestFilter simply removes any disabled Schedules that are not important to track in the Google Calendar.

 

Bookmark 4. Create and Format JSON for Google Calendar REST API

Ox5Lk7CTgrPoGH6P6gUaIg2HN1NnJqYVkJbEUSPygeX3AnVnNbPfInXtH907VQFHiOfZgd8LnrseJY-Clq515AzQiLNg2VgzVKJpMJSdhX9AUK37hVBHLjPM0vFrN1zGNVALHpG_

There are a lot of transformers here to do attribute manipulation. The AttributeExposer and AttributeValueMapper work together ensuring that the values returned by FME Server’s REST API are compatible with the Google Calendar REST API. DateTimeConverter, DateTimeCalculator, and, again, DateTimeConverter are used here to provide an arbitrary length (30 minutes) for each FME Server Schedule. The AttributeManager creates a JSON-formatted string for passing to the Google Calendar REST API. Use of the JSONValidator ensures that the string will not be rejected.

 

Bookmark 5. POST FME Server Schedules to Google Calendar

45vXIrrMeDHtp4Yl8ww3XP9fRaI_u59bcJGkxe-yTEzdslt39mP60GtyorWihKM8tPrjSFV7CRY_VIw8osf1Pup6zlxeh3zZJ1KRZZSjdHFxB0hUh9Ux_JAYNrmCzy1rcoIiW0LI

HTTPCaller is used here once again to interact with the Google Calendar REST API. This transformer is configured to POST – or add – all the FME Server Schedules to Google Calendar as unique Events. Another Sampler is used to reduce the feature count flowing to the next Bookmark.

 

Bookmark 6. HTML Template Magic

Yq2htbqerDlHP8A3mjy54HZxW2ROch1vykSx59hlgWR2XqGN2NviQN5caG8f6R5Ql2HjN8G543jxfqw7Ktr5o_QlbOBicRJtZ4VmMV-qfapM1Uw5HCaSq5e7JtFhpgedmuHTbihF

If the Sampler was not previously used, then for every FME Server Schedule posted to Google Calendar, there would be a new HTML file written – which wouldn’t be very efficient. The AttributeCreator placed here contains all of the raw HTML used, with many Published Parameter references allowing for dynamic output based on user input. The HTML Writer is configured to place the resulting output into the proper Dashboards Repository on FME Server where it is automatically made available on the Dashboards page in the Web Interface.

 

Please note that there are no plans to maintain this workspace, or the contents of this Knowledge Center Article. If you would like to ask more questions or share your enhancements to this workflow, please start a thread on the FME Community!

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.