Glia API Overview - Glia-mh/Glia-Web-Client GitHub Wiki

Glia API overview

Goal of the API

The intent behind the api, is twofold. For one, it more effectively allows Glia to track the state and evolution of its system and its users. However, the more tangible goal is to serve as a state manager for the entire system. Because pubnub's channel architecture is so dynamic, it is hard to keep track of which users correspond to which channels, and even how many channels exist at a given time.

Models

User:

{ "id": 1, "gliaID": "ed20aefc-b1f8-49c3-bdb8-575f880c7b7e", "conversationID": 1, "progress": 0 }

Conversation:

{ "id": 1, "conversationID": 1, "conversationTitle": "Pratik's Conversation", "counselorID": "cfc6b34b-92ce-4720-b4db-63a4683a8e8b" },

Counselor:

{ "id": 1, "counselorID": "cfc6b34b-92ce-4720-b4db-63a4683a8e8b", "counselorName": "Pratik Doshi", "counselorBio": "Pratik is a senior pursuing a Bachelor’s in Health Promotion Disease Prevention and a progressive Master’s in Global Medicine-Health Management Track. He has experience with organizational development, leadership, research and health care.", "counselorImageURL": "https://gliamentalhealth.org/images/pratik.jpg" }

Explanation

The API does a few things:

  1. It stores information of counselors. Currently, there is no GUI interface to add counselors, it must be posted directly to the API

  2. It stores information about the Conversations, such as the title, and the counselor associated with them. This is so that the client can pull up the correct counselor information given a conversation.

  3. It stores the User count. This is done so that we may track the number of users that exist, and use that to determine which conversation to place new users.

Other things of note

The API also supports an endpoint that provides the user and conversation count. As users are added, the conversation ID they are placed into is determined by the following equation:

f(x) = Truncate(# of users / 4) + 1

Its not the most elegant of solutions, but it does fill out a channel with 4 users, before moving on to the next one. Note, this does not include counselors!

⚠️ **GitHub.com Fallback** ⚠️