Scheduler App on Google Actions 
Tags: 2020devgrad, octograd2020, showdev
Published: 2020-05-20 22:33:22

---
title: Scheduler App on Google Actions 
published: true
description: I just graduated from Pandit Deendayal Petroleum University, and this was my final project.
tags: 2020devgrad, octograd2020, showdev 
---

## Project: [PDPU Scheduler] (https://assistant.google.com/services/a/uid/000000e634a014e0)

### 🤔 What's PDPU Scheduler?

It's a Google Assistant action 🤖 that tells you about which classes and labs you have today.

### 💡 IDEA:
Whenever a new semester starts, the HoD (Head of Department) of our University mails all the students their daily schedule for labs and lectures. Remembering that schedule during the initial days of the new semester was difficult, Also as the days go by and as the new emails start piling up, that mail with the schedule gets lost. While searching for that email after a few days was another painful task. Every single student faced this issue.

One day while reading about [Actions on Google](https://developers.google.com/assistant), I thought why not make a voice application to solve that problem for me and all the students facing this issue. 

I tried to solve that problem by creating a Google Assistant application, where one just has to ask about the lecture, where that lecture is, whose lecture it is, it also shows the full schedule for that particular day, etc. 

### How I built it?

At the time of developing this, I didn't know any Databases, so I stored the schedule in a simple JSON file.

First of all, I converted the schedule sheet to the JSON file.
Something like this.
```
[
  {
    "Sunday": {
      "L*": {
        "type": "Free"
      }
    }
  },
  {
    "Monday": {
      "L9": {
        "type": "Lecture",
        "position": "first",
        "name": "Software Engineering",
        "Professor": "DEF"
      },
      "L10": {
        "type": "Lecture",
        "position": null,
        "name": "Operating System",
        "Professor": "MNO"
      },
      "L11": {
        "type": "Lecture",
        "position": null,
        "name": "Radio Frequency Engineering",
        "Professor": "PQR"
      },
      "L12": {
        "type": "Free"
      },
      "L13": {
        "type": "LAB",
        "h1": {
          "name": "RF Engineering Lab",
          "Professor": "PQR"
        },
        "h2": {
          "name": "OS Lab",
          "Professor": "ABC"
        },
        "h3": {
          "name": "DBMS Lab",
          "Professor": "XYZ"
        }
      },
      "L15": {
        "type": "Free"
      },

```

As you can see, its an array of objects containing schedule day-wise and with their time.

Top-level property is the day of the week, then comes the lecture/lab time, if its a lab then the next object under that level is the batch, in this case, `h1`, `h2`, `h3` are the batches of my class.

`L10` represents lecture at 10:00 Hours
`L15` represents lecture at 15:00 Hours

One of the major problems I encountered while developing this project was to figure out the timezone and provide the information accordingly.
Because the person might be in different timezone and the server where this function would be deployed in, would be in the different timezone so to figure out that issue I used a npm package called [Momentjs] (https://momentjs.com/), which does all the heavy lifting of converting the timezone, adding and subtracting from the current time and date.

Once that's out of the way, next is simply configuring the dialogflow to trigger the function based on the user's intent.

Tech Stack used:
- [Node.js] (https://nodejs.org/)
- [DialogFlow](https://dialogflow.com/)

Deployed at [Firebase Cloud Functions](https://firebase.google.com/products/functions)

I've deployed this application on Cloud Functions and within just one week of launching this app, I got more than 1000 conversations with users within 10 days. 


## [Demo Link] (https://assistant.google.com/services/a/uid/000000e634a014e0)
 

## Link to Code: {% github nish17/scheduler %}

[Final Note]: Feel free to modify it and use it based on your needs, also pull requests for adding new features/updating something are always welcome.

if you liked this project, please consider starring this project on Github.

Thank you.