In university, social events from concerts, workshops, community services, and conferences make up the overall university experience aside from academics. While getting to join these activities is fun and enriching, managing and organizing one yourself isn't. Leading & organizing these events can be very stressful. One of the biggest pain points of managing an event is logistics. Logistics can range from:
- Selecting the best venue to host the event
- Getting food vendors to come and prepare foods & drinks in the event
- Getting transport for people who signed up to the event venue
- Renting audio system equipment and other miscellaneous items from outside vendors
Thus, I decided to tackle these issues by automation using the Industry Marketplace. The Industry Marketplace is a vendor and industry-neutral platform that automates the trading of physical and digital goods and services. With a combination of distributed ledger technology, immutable audit logs, and standardized, machine-readable contracts, it helps to accelerate industrial automation and enable the "economy of things".
This is a Proof of Concept (POC) that leverages on the Industry Marketplace and IOTA to automate the trading of services specifically for logistics. Based on the whitelisted services, I'll be tackling the transport part for logistics.
- Mobility as a service - to transport event attendees to the event venue.
I initially planned to also use the Purchasable good operation for other logistics such as audio system equipment but looking at it in detail, it's specifically used for purchasing Feed-through modular terminal block which is unrelated to my project goals. I do hope more services will be whitelisted in the future!Project Flowchart
To provide a minimalistic and a no head-ache approach towards Event Logistics Management (in our case Transport for Event attendees) by leveraging Facebook Events, The Industry Marketplace and IOTA. This is done as follows:
- Automation of sending a Call for Proposal from Service Requester to a Service Provider based on the number of days before an Event starts. Example: If we create an event on May 20th and we set the Call for Proposal 10 days before the Event starts, then a Request will be automatically sent to Providers on May 10th. All Event details at that time (i.e Number of attendees, Location, Dates & Price) will be used in the Call for Proposal.
- Automation of rejecting or accepting a Proposal from a Service Provider based on your total budget allocated towards the Event (See Step 5 and Step 6 for more details)
- Events - From the flow diagram above, we'll be primarily using the Facebook SDK in our project. Why Facebook? It's the biggest social platform out there and is one of the easiest ways to create events. Plus being the biggest platform out there means that the documentation is generally going to be better to work with.
- Transport Logistics Manager - We'll be using a Python environment with the Tkinter framework to create a graphical interface to manage and automate our events. Also, the main reason why we'll be using Python is that it speeds up the development when using the Python Quickstart Helper Library used for the Industry Market Place.
- Industry Market Place - As mentioned previously, we'll be using a Quickstart Library in Python to speed up the development in interfacing with our Transport Logistics Manager.
The demonstration is split into 3 parts to illustrate the whole workflow of the project.
- Adding an Event but no Call for Proposal sent since the difference between the date now and the date of the event does not match the number of days input in the program. Once a background service checks that the dates matches, only then the Requester will send a Call for Proposal
- Adding an Event and a Call for Proposal is sent since the difference between the date now and the date of the event matches the number of days input in the program. Note: I used an event here that had already passed and so I set the trigger to send the Call for Proposal even when the event expires for demonstration purposes
- And finally, we have our autonomous vehicle to fulfill the request to send the Event Attendees after the Proposal sent by the Provider has been accepted by the Requester. I had to juggle between navigating my laptop and recording on my phone for this one so it's a bit messy.
This is the first and easiest step to accomplish. You'll need to have a Facebook account to follow through and once you've created an event (use this link if you do not know how to), you should be able to see this. I'm using Facebook's dark mode and the new Facebook design so you should see something a bit different if you're using Facebook Classic.
To work with Facebook SDK's, you'll need two things in this order:
- Your own Facebook developer account here
- A new Facebook App to generate an access token to use Facebook SDK's. Go here to obtain your access token after creating an app.
First, grab your Event ID as highlighted below.
Head over to this link where we'll explore how to grab the details of our new event using the Graph Explorer. Paste in the Event ID from the previous step and press 'Submit'.
You'll see the "Search for a field" on the left of the Explorer page and it's from here you'll be able to query details such as the number of attendees, location, dates and so much more!
In this project, we're interested in three specific details:
- Number of Attendees - to be used as the baseline when calculating the total IOTA budget to allocate when requesting for the 'mobility as a service' operation. If the Service Provider is asking for more than this total IOTA budget then the Proposal is immediately rejected.
- Location (Latitude & Longitude) - destination place to send the attendees when requesting for the 'mobility as a service' operation
- Date of the Event - to be used as a variable to automate when you'll choose to send the Request Proposal. Example: Automate sending of Request Proposal one week before Event date given current details of Number of Attendees and the Location.
Here are the query results of what we're interested in. Perfect!
Project Limitation: In this project, the details of the event are assumed to be updated everyday (Example: increasing attendee counts each day), however, I've not yet implemented this functionality due to time constraints.Step 4 - Install the following necessary Python modules in your system
Below is the excellent accompanying video guide that goes through the setup of the Industry Market Place.
The Tkinter G.U.I framework comes off the shelf with Python so there's no need to install any additional modules.
Step 5 - Building the G.U.I for our Transport Logistics Manager
The first step is to build the input text fields, where we can type in the necessary values.
- Event ID - to query the event details using Facebook Graph API
- Event Name - not needed but a good way to label our event.
- Days before event to send proposal - this helps to automate sending a Request for Proposal to a Provider at a specific deadline.
- IOTA budget per person - this helps to calculate the total budget we allocate once we obtain the number of attendees. This helps to automate whether we reject or accept a Proposal.
This will look like the following in code. All the code is available on my Github repo or the attachments section if you're trying to replicate this project.
The interface will look like the image below once you press the add event button. The "Add Event" button has a callback function which calls the Facebook Graph API in querying our event details.
Here's the code snippet for querying the event data as well as the calculations on the total IOTA budget and whether to send the Request proposal based on the dates. To make things less complicated, if the "Days before event to send proposal" field matches or is less than the number of days until the event starts then we'll send a Request for Proposal. In reality, this should be set strictly to be equal.
First, we determine the operation/service we'll be integrating with our project. What we'll be using is shown below and is based from the operations.json file given in the Python Helper Library.
Based on the ID of the operation, we can set the following fields which are provided from the eclass.json file from the Python Helper Library.
With these details, we can start to integrate the Industry Market Place in our project. To trigger the Call for Proposal, we use a global variable called 'status' which is initially set empty. When the program sets this variable to "PROPOSAL SENT" (calculated and sent automatically based on the dates), then the Call for Proposal starts. This program assumes that everyone is picked up at the same point but the rest of the fields (from eclass) are set dynamically to the event details from the queried data.
The following function below is used to automate on deciding whether to accept the proposal from Service Providers. We simply accept the proposal if it falls within our total budget and reject if is over the total budget.
Note: This project assumes there is one Service Provider and has not taken into account the possibilities of many more Service Providers sending in proposals. So the feature on deciding the best/cheapest proposal hasn't been implemented.
When the proposal has been accepted, the Service Provider would then start fulfilling the Request.
Once the service is completed we'll receive an acknowledgment that the Requester has paid.
The process is simple. Once we start fulfilling the Request, we send out an autonomous vehicle to the starting location and then to the event location. To demonstrate this, we'll build a simple robot car using an ESP32 that is interfaced with our project through a TCP server/client program. I used the PlatformIO IDE with the Arduino framework to speed up the development.
There are 2 parts to interfacing our program with the robot car.
- TCP client in our program
- TCP server in the ESP32
Both ports on the server and client are set to be 80 and the server name is the IP address of the ESP32 which you can obtain by using the WiFi library below.
And the TCP server on the ESP32, where the TCP client will send the signal to once the Requester has approved the Proposal. Once the ESP32 receives a signal from the client, it starts to fulfill the request, and then the robot car starts to move for a predetermined time. Aside from the WiFi library used, the L298N library was used to interface to the DC motors on the robot car.
Your setup will be different than mine depending on the available hardware you have but the general concept is the same. You need a motor driver to drive the motors forward and of course, your micro-controller that sets and sends signals such as speed and direction to the motor driver that controls the motors. Here's a link for a tutorial on how to connect the whole system together with an Arduino. There'll be minimal changes if you're using an ESP32.
Here's our little autonomous vehicle in action once we run the firmware on the ESP32 and the test program on our PC.
Now we've got each and every one of our components working and after stitching them all together, we can visualize & simulate the Proof of Concept in automating the pain-points of Event Logistics.Conclusion and Thoughts
This is my first time working with IOTA and the Industry Marketplace. I've learned quite a lot about what IOTA is and its benefits towards a fast, secure, and fee-less transaction system. My project is about being able to automate the pain-points of event logistics by leveraging on IOTA and the Industry Marketplace. Even though the Industry Marketplace is relatively new, there's definitely a huge potential! Cheers to the IOTA Foundation and eCl@ss!