Skip to content

Instantly share code, notes, and snippets.

@Furkanzmc
Last active June 19, 2018 03:34
Show Gist options
  • Save Furkanzmc/84350513a2e2aee3b05827b884b18f22 to your computer and use it in GitHub Desktop.
Save Furkanzmc/84350513a2e2aee3b05827b884b18f22 to your computer and use it in GitHub Desktop.
swagger: 2.0
host: api.quantum.smeltzer.digital
schemes:
- http
- https
consumes:
- application/json
produces:
- application/json
info:
version: 0.0.1
title: 'Quantum'
contact:
email: 'furkanuzumcu@gmail.com'
description: |
# Overview
Quantum helps users asses the core components of reality on a felt and cognitive sense to guide them to the
betterment of their emotional, cognitive lives that have immediate effect in real life. Using Quantum, users will be
able to tailor their awareness around their current reality, work through difficulties and transform pain into gain.
Quantum rewards points to the users for each completed action. These points are saved in users' profile along with
information about how they earned those points.
## Privacy
Quantum lets users have **complete** control over their data. All data is encrypted and stored securely on the cloud.
Users will be able to delete their accounts along with every single data that belongs to them. They can alternatively
delete their check-ins and all other data without deleting their accounts.
Each check-in or any other skill practices can also be deleted individually. Only the users themselves will have
access to their data and nobody else, including Quantum employee.
# Profile
Users will be able to view their earned points and their last actions on their profile. Using the feeling check-ins,
they can also see a heat map of their feelings over the days/months/years.
tags:
-
name: EmotionCategory
description: |
An emotion category is a collection of feelings. Each person can have different associated feelings with the same
emotion. An emotion category is a subjective representation of the emotion.
An emotion category contains not only the base line feelings but also the opposites of the emotion category
itself. An emotion category is completely subjective and depends on the person.
-
name: Emotion
description: |
Emotion is objective and is the base for emotion category. Emotion category will not have a name but an
associated emotion with which the baseline feelings are associated.
-
name: Feeling
description: |
Feeling is a perception of events within the body. When feelings get together, they create emotions.
A feeling can have multiple opposites of itself.
-
name: Goal
description: |
A goal is the action that the person has to perform to get to a desirable output. Goals will always have a specific
action associated with it and it can be either a one-off or a repeated event. A goal is used along with an
environment skill. User will be notified of each goal at the end of the day to check the goal as done or incomplete.
-
name: Obstacle
description: |
An obstacle is something that prevents a person from reaching a desired outcome. Obstacles are used in tandem with
environment skill. Each obstacle will have opposites, the ideal situations, for that obstacle.
-
name: Ideal
description: |
A ideal is the opposite of an obstacle.
-
name: Check-in
description: |
Check-ins are used to log the user's current **feeling**. This is the main way of getting feeling data from the
user. Each check-in us logged along with the date and an additional but optional note.
Check-ins can also be done after a feeling skill session to log the feeling after the meditation so that we can
see If the meditation had any effect on user's feeling.
-
name: Cognitive Skill
description: |
Cognitive skill is supposed to help eople consider alternative thoughts to whatever they are currently thinking.
Cognitive skill is higher order and it deals with emotional concepts, and alternative thoughts.
-
name: Feeling Skill
description: |
Feelig skill will focus on prompting an alternative feeling to the current one. It deals with embodied emotions
and is accompanied with a meditation to help promote the alternative feeling.
-
name: Environment Skill
description: |
Environment skill is about overcoming an obstacle by setting goals to achive a desired output. Environment skill is
used in cases where the well being is affected y external factors and only specific set of actions can help remedy
the situation.
-
name: User
description: |
Description goes here.
-
name: Meditation
description: |
Description goes here.
-
name: Point
description: |
A point holds information about how much coin the user has earned by completing which task.
paths:
/feeling-checkins/:
post:
summary: Check-in a New Emotion
description: You can create a new emotion check-in using this endpoint.
operationId: checkInEmotion
tags:
- Check-in
parameters:
-
name: body
in: body
required: true
schema:
$ref: '#/definitions/FeelingCheckIn'
responses:
200:
description: Successful response.
schema:
type: object
properties:
checkin:
$ref: '#/definitions/FeelingCheckIn'
403:
description: User does not have permission to view this endpoint.
schema:
$ref: '#/definitions/Error'
401:
description: User is not authorized.
schema:
$ref: '#/definitions/Error'
get:
summary: List Emotion Check-ins
description: |
List all emotion check-ins. The default number of items in one page is 15.
operationId: listFeelingCheckIns
tags:
- Check-in
parameters:
-
name: start_date
type: string
format: date-time
description: |
UTC ISO date time string. If this parameter is set, the check-ins whose `checkin_date` is later than this
will be listed.
example: '2018-02-05T12:32'
required: false
-
name: end_date
type: string
format: date-time
description: |
UTC ISO date time string. If this parameter is set, the check-ins whose `checkin_date` is sooner than this
will be listed.
example: '2018-02-05T17:32'
required: false
-
name: emotion
type: integer
format: int32
description: The emotion ID to filter for.
example: 2
required: false
-
name: page
type: integer
format: int32
description: The page number to show.
example: sadness
required: false
responses:
200:
description: Successful response
schema:
allOf:
- $ref: '#/definitions/Pagination'
- type: object
properties:
checkins:
type: array
items:
$ref: '#/definitions/FeelingCheckIn'
403:
description: User does not have permission to view this endpoint.
schema:
$ref: '#/definitions/Error'
401:
description: User is not authorized.
schema:
$ref: '#/definitions/Error'
/feeling-checkins/{checkin_id}/:
get:
summary: Get Check-in Details
description: |
Returns the details of the checkin.
tags:
- Check-in
responses:
200:
description: Successful.
schema:
type: object
properties:
checkin:
$ref: '#/definitions/FeelingCheckIn'
404:
description: Resource cannot be found.
schema:
$ref: '#/definitions/Error'
403:
description: User does not have permission to view this endpoint.
schema:
$ref: '#/definitions/Error'
401:
description: User is not authorized.
schema:
$ref: '#/definitions/Error'
delete:
summary: Delete a Check-in
description: |
The user can decide to delete his/her check-in at any time.
tags:
- Check-in
responses:
200:
description: Successful. Returns the deleted resource.
schema:
type: object
properties:
checkin:
$ref: '#/definitions/FeelingCheckIn'
404:
description: Resource cannot be found.
schema:
$ref: '#/definitions/Error'
403:
description: User does not have permission to view this endpoint.
schema:
$ref: '#/definitions/Error'
401:
description: User is not authorized.
schema:
$ref: '#/definitions/Error'
/emotions/:
get:
summary: List Emotions
description: |
New emotions can be dynamically added to the database. It's a good idea to keep it up to date locally.
tags:
- Emotion
responses:
200:
description: Successful.
schema:
type: object
properties:
emotions:
type: array
items:
$ref: '#/definitions/Emotion'
403:
description: User does not have permission to view this endpoint.
schema:
$ref: '#/definitions/Error'
401:
description: User is not authorized.
schema:
$ref: '#/definitions/Error'
head:
summary: Peek at Emotions
description: |
New emotions can be dynamically added to the database. It's a good idea to keep it up to date locally.
tags:
- Emotion
responses:
200:
description: Successful. Returns an empty body with response headers.
headers:
Last-Modified:
description: Returns the UTC ISO date time string representing the date this resource was last modified.
schema:
type: string
format: date-time
example: '2018-05-03T12:35'
403:
description: User does not have permission to view this endpoint.
schema:
$ref: '#/definitions/Error'
401:
description: User is not authorized.
schema:
$ref: '#/definitions/Error'
/feelings/:
get:
summary: List Feelings
description: |
New feelings can be dynamically added to the database. It's a good idea to keep it up to date locally.
tags:
- Feeling
responses:
200:
description: Successful.
schema:
type: object
properties:
feelings:
type: array
items:
$ref: '#/definitions/Feeling'
403:
description: User does not have permission to view this endpoint.
schema:
$ref: '#/definitions/Error'
401:
description: User is not authorized.
schema:
$ref: '#/definitions/Error'
head:
summary: Peek at Feelings
description: |
New feelings can be dynamically added to the database. It's a good idea to keep it up to date locally.
tags:
- Feeling
responses:
200:
description: Successful. Returns an empty body with response headers.
headers:
Last-Modified:
description: Returns the UTC ISO date time string representing the date this resource was last modified.
schema:
type: string
format: date-time
example: '2018-05-03T12:35'
403:
description: User does not have permission to view this endpoint.
schema:
$ref: '#/definitions/Error'
401:
description: User is not authorized.
schema:
$ref: '#/definitions/Error'
definitions:
Emotion:
type: object
description: Represents an objective emotion.
properties:
id:
type: integer
format: int64
example: 23
name:
type: string
format: char[64]
description: Name of the emotion. Name of the translation will be translated based on the request language.
example: Sadness
required: true
baseline_feelings:
type: array
description: A list of objectively associated feelings for this emotion.
items:
$ref: '#/definitions/Feeling'
EmotionCategory:
type: object
description: Represents a category that consists of feelings that are subjectively associated with an emotion.
properties:
id:
type: integer
format: int64
example: 23
emotion:
$ref: '#/definitions/Emotion'
associated_feelings:
type: array
description: A list of subjectively associated feelings for this emotion.
items:
$ref: '#/definitions/Feeling'
Feeling:
type: object
description: Represents a feeling.
properties:
id:
type: integer
format: int64
example: 23
name:
type: string
format: char[64]
description: Name of the feeling.
example: warm
required: true
emojis:
type: array
description: |
The unicode emoji representations of the feeling. A feeling can have multiple emojis ffiliated with it.
That's why we are keeping an array here.
items:
type: string
example: U+1F605
required: false
opposites:
$ref: '#/definitions/Feeling'
FeelingCheckIn:
type: object
description: Represents a check-in.
properties:
id:
type: integer
format: int64
example: 23
feeling:
$ref: '#/definitions/Feeling'
checkin_date:
type: string
format: date-time
description: UTC ISO date string. This is added automatically.
example: '2018-05-03T22:35'
required: false
note:
type: string
format: char[2048]
description: Additional notes that the user provides about their emotional state.
example: I like turtles.
required: false
Point:
type: object
properties:
id:
type: integer
format: int64
example: 23
amount:
type: integer
description: The amount of points earned.
example: 30
activity:
$ref: '#/definitions/ErrorCode'
Pagination:
type: object
properties:
next_page:
type: integer
description: If there's no next page, this will be null.
example: 3
previous_page:
type: integer
description: If there's no next page, this will be null.
example: 1
has_next_page:
type: boolean
description: Indicates whether the response has a next page.
example: true
has_previous_page:
type: boolean
description: Indicates whether the response has a previous page.
example: true
page_count:
type: integer
description: Shows the total number of pages for the response.
example: 3
Error:
type: object
properties:
code:
$ref: '#/definitions/ErrorCode'
message:
type: string
example: Human readable error string.
description: |
This is the human readable error message. The right place to handle the error programmatically would be
to read `code` and `parameters` keys. This message can potentially be used to present to the user.
parameters:
type: object
properties:
field:
type: array
description: |
Each item in the array details the error. These errors are human readable so it can be showed to the
user. If `Accept-Language` header is specified, these errors will be translated to that language.
items:
type: string
example: Error description.
ErrorCode:
type: string
description: |
This is a specialized error code to describe the issue.
enum:
- unspecified
PointActivityType:
type: integer
description: |
This holds the types of activities that rewards points.
- `0`: User has earned points by checking in.
- `1`: User jas earned points by completing a cognitive skill.
- `2`: User jas earned points by completing a feeling skill.
- `3`: User jas earned points by completing a environment skill.
enum:
- 0
- 1
- 2
- 3
Meditation:
type: object
description: A meditation object that contains necessary information for a meditation session.
properties:
id:
type: integer
example: 1
CognitiveSkill:
type: object
description: |
Represents a cognitive skill input.
properties:
id:
type: integer
example: 1
pain_point:
$ref: '#/definitions/Emotion'
pain_associated_thought:
type: string
format: char[2048]
exmple: I feel rejected by those I love.
required: false
description: Additional information to support the pain point.
pain_point_opposite:
$ref: '#/definitions/Emotion'
accepting_thought_feeling:
$ref: '#/definitions/Feeling'
accepting_thought:
type: string
format: char[2048]
exmple: I am here on this earth and at least I love myself.
required: false
description: An optional text to support what it feels like to have the `pain_point_opposite`.
FeelingSkill:
type: object
description: |
Represents a feeling skill input.
properties:
id:
type: integer
format: int64
example: 1
pain_point:
$ref: '#/definitions/Feeling'
pain_point_opposite:
$ref: '#/definitions/Feeling'
meditation:
$ref: '#/definitions/Meditation'
GoalFrequency:
type: integer
description: |
This holds the types of activities that rewards points.
- `0`: Daily
- `1`: Weekly
- `2`: Monthly
- `3`: Twice a month
- `4`: Twice a week
- `5`: 3 times a week
- `6`: 4 times a week
- `7`: 5 times a week
- `8`: 6 times a week
enum:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
Goal:
type: object
description: |
Goal is used with `EnvironmentSkill`.
TODO: Find a way to group goals together and crete multiple ones to check If they were checked or not.
properties:
id:
type: integer
example: 1
action:
type: string
format: char[1048]
description: The action to complete.
example: Apply to at least 1 job a week.
frequency:
$ref: '#/definitions/GoalFrequency'
dates:
type: array
description: This can be used to set custom dates for goals that does not repeat.
items:
type: string
description: UTC ISO date string.
example: '2018-05-06T14:45'
Ideal:
type: object
description: |
Represents an ideal.
properties:
id:
type: integer
example: 1
name:
type: string
format: char[64]
description: Name of the ideal. The name will be translated based on the request language.
example: Work Ease
Obstacle:
type: object
description: |
Represents an obstacle.
properties:
id:
type: integer
example: 1
name:
type: string
format: char[64]
description: Name of the obstacle. The name will be translated based on the request language.
example: Work Issues
opposites:
$ref: '#/definitions/Ideal'
EnvironmentSkill:
type: object
description: |
Represents an environment skill input.
properties:
id:
type: integer
example: 1
obstacle:
$ref: '#/definitions/Obstacle'
ideal:
$ref: '#/definitions/Ideal'
goal:
$ref: '#/definitions/Goal'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment