Memair Docs logoMemair Docs

Welcome

Welcome to the Memair API documentation.

This API document is designed for those interested in developing on our platform. Memair is continuously under development and this API will evolve.

Memair stores userā€™s data in structured models which are designed to extract maximum insight for users.

If you find any of these resources poorly explained or have other suggestions please create an issue or join the contributors list by submitting a PR.

Deprecation Policy

Memair adheres to a deprecation schedule however, any endpoint or data structure may be changed or deprecated if there is a security issue.

Alpha endpoints

Alpha endpoints are in active development and will likely change or become deprecated.

Beta endpoints

Beta endpoints are being tested more widely with beta users and are unlikely to change. Any non backward compatible changes or deprecation will have at least 4 weeks notice.

Gamma endpoints

Gamma endpoints have been thoroughly tested. Any non backward compatible changes or deprecation will have at least 6 months notice.

Notices

No deprecation notices at this moment

Bug Beer Bounty šŸžšŸŗāš“ļø

Find a Bug and Iā€™ll buy you a beer šŸ» and give you an honourable mention here.

Bugs

  • Double inputs for Biometrics Pratyusa Ray
  • GraphiQL sometimes hangs on ā€œLoadingā€¦ā€, temporary fix is to hit refresh

API Rate Limits

There are no hard set API limits. Out of courtesy please limit api requests to;

  • one request per 5 seconds for large create mutations
  • one request per second for all other queries and mutations

We would appreciate feedback on system performance.

Quick Access

If you would like to have a quick play with the api, click here to generate an access token for the currently logged in user. This access token is temporary (10 days). Create an app for longer lasting access tokens.

Otto the sandbox user

Otto is a sandbox user with some data to explore.

To expore Ottoā€™s data, use the access token; 0000000000000000000000000000000000000000000000000000000000000000

You can start exploring Ottoā€™s data now using the Jypyter notebook hosted by My Binder.

Ottoā€™s data is reset periodically.

Create an App

Log into the Memair App

Developer Tools > API Keys > New Application

Select the appropriate scopes required for the app.

Once you have created an app, create a pull request to publish it in Memairā€™s App Store.

Request Authorization

Send user to;

https://memair.com/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=http://redirect.com&response_type=code&scope=location_read+location_write

And collect USER_CODE in the call back url

Request Access Token

To request the access token, you should use the returned code from above and exchange it for an access token.

curl \
  -F grant_type=authorization_code \
  -F client_id=YOUR_CLIENT_ID \
  -F client_secret=YOUR_CLIENT_SECRET \
  -F code=USERS_CODE \
  -F redirect_uri=http://redirect.com \
  -X POST https://memair.com/oauth/token
{
  "access-token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
  "token_type": "bearer",
  "created_at": 1457567765
}
{
  "error": true,
  "message": "Invalid score"
}

Access Token Details

Access Token details can be access though the GraphQL API (see below for more details on GraphQL). Accessible details include expire & revoke status, scopes, and associated userā€™s details.

query {
  AccessToken {
    expired
    revoked
    location_read
    scopes
  }
}

curl \
  -H 'access-token: 0000000000000000000000000000000000000000000000000000000000000000' \
  -d '{AccessToken{expired revoked location_read scopes}}' \
  -X POST https://memair.com/graphql
from memair import Memair

user = Memair('0000000000000000000000000000000000000000000000000000000000000000')
query = "{AccessToken{expired revoked location_read scopes}}"
response = user.query(query)
print(response)
{
  "data": {
    "AccessTokenDetails": [
      {
        "expired": false,
        "revoked": false,
        "location_read": true,
        "scopes": "location_read location_write public"
      }
    ]
  }  
}

{
  "data": {
    "AccessToken": null
  }
  "errors": {
    "message": "No Access Token used to access this endpoint. You are likely accessing this endpoint through GraphiQL so are not using an Access Token"
  }
}

Revoke Access Token

Revoked tokens will no longer work. It is good practice to revoke tokens when they are no longer needed or if they are exposed. Revoking an Access Token can be access though the GraphQL API (see below for more details on GraphQL).

Note: You can not revoke Ottoā€™s access token

mutation {
  RevokeAccessToken {
    revoked
  }
}

curl \
  -H 'access-token: 0000000000000000000000000000000000000000000000000000000000000000' \
  -d 'mutation{RevokeAccessToken{revoked}}' \
  -X POST https://memair.com/graphql
from memair import Memair

user = Memair('0000000000000000000000000000000000000000000000000000000000000000')
query = "mutation{RevokeAccessToken{revoked}}"
response = user.query(query)
print(response)
{
  "data": {
    "RevokeAccessToken": [
      {
        "revoked": true
      }
    ]
  }  
}

{
  "data": {
    "RevokeAccessToken": null
  }
  "errors": {
    "message": "Otto's token can not revoked, others may want to play with his data"
  }
}

About GraphQL

GraphQL is a powerful API query language

GraphQL is a data query language which provides an alternative to REST and ad-hoc web service architectures. It allows clients to define the structure of the data required, and exactly the same structure of the data is returned from the server. It is a strongly typed runtime which allows clients to dictate what data is needed, therefore preventing excessively large amounts of data being returned.

Memairā€™s implementation of GraphQL allows for large (10,000 records) import and export of data per query or mutation. Create mutations are processed in the background and you can monitor the jobs progress using the Create Status query.

GraphiQL

An interactive console for GraphQL

GraphiQL is an interactive console for GraphQL queries. GraphiQL queries are scoped to the currently logged in user.

GraphiQL Console

GraphQL is self documenting. GraphiQL includes a Documentation Explorer which shows the various Query and Mutation options

GraphiQL Documentation

Curl Example

Example Curl queries for Memair

Parameters
query
GraphQL query. See above for more details
access-token
access token with correct scopes for memories being accessed. See Request Access Token for more details
curl \
  -H 'access-token: 0000000000000000000000000000000000000000000000000000000000000000' \
  -d '{Biometrics(first: 1 order: desc order_by: timestamp type: weight) {timestamp value biometric_type {name unit}}}' \
  -X POST https://memair.com/graphql
{
  "data": {
    "Biometrics": [{
      "timestamp": "2018-09-16T23:20:58Z",
      "value": 100.0,
      "biometric_type": {
        "name": "Body Weight",
        "unit": "Kilogram"
      }
    }]
  }
}

{
  "errors": [
    {
      "message": "Field 'foobar' doesn't exist on type 'Biometric'",
      "locations": [{"line":1,"column":32}]
    }
  ],
  "data": {}
}

Python Example

Example Python queries for Memair

Memiar offers a Python3 package to simplify GraphQL queries and mutations.

from memair import Memair

user = Memair('0000000000000000000000000000000000000000000000000000000000000000')
query = """
{
  Biometrics(
    first: 1
    order: desc
    order_by: timestamp
    type: weight
  )
  {
    timestamp
    value
    biometric_type {
      name
      unit
    }
  }
}"""
response = user.query(query)
print(response)
{
  "data": {
    "Biometrics": [{
      "timestamp": "2018-09-16T23:20:58Z",
      "value": 100.0,
      "biometric_type": {
        "name": "Body Weight",
        "unit": "Kilogram"
      }
    }]
  }
}

{
  "errors": [
    {
      "message": "Field 'foobar' doesn't exist on type 'Biometric'",
      "locations": [{"line":1,"column":32}]
    }
  ],
  "data": {}
}

Ruby Example

Example Ruby queries for Memair

Memiar offers a Ruby gem to simplify GraphQL queries and mutations.

require 'memair'

user = Memair.new('0000000000000000000000000000000000000000000000000000000000000000')
query = """
{
  Biometrics(
    first: 1
    order: desc
    order_by: timestamp
    type: weight
  )
  {
    timestamp
    value
    biometric_type {
      name
      unit
    }
  }
}"""
response = user.query(query)
puts response
{
  "data": {
    "Biometrics": [{
      "timestamp": "2018-09-16T23:20:58Z",
      "value": 100.0,
      "biometric_type": {
        "name": "Body Weight",
        "unit": "Kilogram"
      }
    }]
  }
}

{
  "errors": [
    {
      "message": "Field 'foobar' doesn't exist on type 'Biometric'",
      "locations": [{"line":1,"column":32}]
    }
  ],
  "data": {}
}

Other Examples

Other examples for GraphQL queries using Memair

If you are using another language, please contact us and we will create supporting documentation. Alternatively, Iā€™ll buy you a few drinks of your choice if you create the documentation and submit a PR.

About Memair's Models

Memairā€™s goal is to empower humans by modelling the data of human activity. These models are structured to maximise insight for individuals. Models are strongly prescribed so that they are useful across applications.

Pagination

Memair uses cursor based pagination where after is the last id of the previous page. -1 is an ignored place holder value which is useful in loops as an initial value for after.

query {
  Locations(
    first: 5
    order: desc
    order_by: timestamp
  )
  {
    id
    timestamp
  }
}

query {
  Locations(
    first: 5
    after: 42864606
    order: desc
    order_by: timestamp
  )
  {
    id
    timestamp
  }
}

{
  "data": {
    "Locations": [
      {
        "id": "42864610",
        "timestamp": "2018-11-19T10:44:00Z"
      },
      {
        "id": "42864609",
        "timestamp": "2018-11-19T10:36:38Z"
      },
      {
        "id": "42864608",
        "timestamp": "2018-11-19T10:33:38Z"
      },
      {
        "id": "42864607",
        "timestamp": "2018-11-19T10:28:38Z"
      },
      {
        "id": "42864606",
        "timestamp": "2018-11-19T10:23:38Z"
      }
    ]
  }
}
{
  "data": None,
  "errors": [
    {
      "message": "Please limit requests to 10000 records",
      "locations": [{"line": 3, "column": 3}],
      "path": ["Locations"]
    }
  ]
}

Create Status

The CreateStatus query gives you details about a Create mutation. Create mutations are processed in the background. Background processing times are dependant on the size of the job, current queue, and database load. Currently jobs take an average of 1.18 seconds to complete.

mutation {
  Create(
    biometrics: [
      {type: internal_body_temp, value: 37}
    ]
    emotions: [
      {type: happy, intensity: 8}
      {type: anxious, intensity: 2}
      {type: content, intensity: 42}
    ]
  ) {
    id
  }
}
query {
  CreateStatus(id: 123456) {
    records_processed
    records_total
    has_finished
    finished_at
    import_errors
    biometrics {
      id
      value
      biometric_type {
        name
      }
    }
    emotions {
      emotion_type {
        name
      }
      intensity
    }
  }
}
{
  "data": {
    "Create": {
      "id": "123456"
    }
  }
}
{
  "data": {
    "CreateStatus": {
      "records_processed": 4,
      "records_total": 4,
      "has_finished": true,
      "finished_at": "2019-05-28T18:04:05Z",
      "import_errors": [
        {
          "errors": {
            "intensity": [
              "must be less than or equal to 10"
            ]
          },
          "emotion": {
            "type": "content",
            "intensity": 42
          }
        }
      ],
      "biometrics": [
        {
          "id": "131",
          "value": 37,
          "biometric_type": {
            "name": "Internal Body Temperature"
          }
        }
      ],
      "emotions": [
        {
          "emotion_type": {
            "name": "Happy"
          },
          "intensity": 8
        },
        {
          "emotion_type": {
            "name": "Anxious"
          },
          "intensity": 2
        }
      ]
    }
  }
}

Insights

This model is used to surface insights to the user. Insights are represented as charts.

Model

Grain: each row contains a single insight.

Name Type Notes
id integer assigned by memair
chart json non nullable
timestamp timestamp assigned by memair if null
source string nullable
notes string nullable
updated_at timestamp assigned by memair

Example interactions

See the Documentation Explorer for full list of mutations and query filters.

query {
  Insights(
    first: 1
    order: desc
    order_by: timestamp
  ) {
    timestamp
    chart
  }
}
mutation {
  CreateInsight(
    source: "Daily insights"
    chart: {
      title: "Daily Steps"
      type: line
      category_axis: ["Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
      series: [
        {
          label: "Steps"
          data: [4129, 7621, 1723, 2372, 3342, 7983, 3130]
        }
      ]
    }
  )
  {
    timestamp
    chart
  }
}
curl \
  -H 'access-token: 0000000000000000000000000000000000000000000000000000000000000000' \
  -d '{Insights(first: 1, order: desc, order_by: timestamp) {timestamp, chart}}' \
  -X POST https://memair.com/graphql
from memair import Memair

user = Memair('0000000000000000000000000000000000000000000000000000000000000000')
query = '{Insights(first: 1, order: desc, order_by: timestamp) {timestamp, chart}}'
response = user.query(query)
print(response)
{
  "data": {
    "Insights": [
      {
        "timestamp": "2018-12-14T20:55:14Z",
        "chart": {
          "type": "line",
          "title": "Time spent",
          "series": [
            {
              "data": [
                1340,
                1440,
                1200,
                1440,
                1400,
                1380,
                1440
              ],
              "label": "Steps"
            }
          ],
          "category_axis": [
            "Saturday",
            "Sunday",
            "Monday",
            "Tuesday",
            "Wednesday",
            "Thursday",
            "Friday"
          ]
        }
      }
    ]
  }
}
{
  "data": None,
  "errors": [
    {
      "message": "Please limit requests to 10000 records",
      "locations": [{"line": 3, "column": 3}],
      "path": ["Insights"]
    }
  ]
}

Recommendations

This model is used to give the user recommendations. Insights are represented as charts. A full list of recommendation types can be accessed using the RecommendationTypes endpoint or inspecting the data-types repo. Please create a pull request or contact us to add recommendation types.

Model

Grain: each row contains a single recommendation.

Name Type Notes
id integer assigned by memair
recommendation_type recommendation type required
title string nullable
description string nullable
url string nullable
priority float required (0-100)
timestamp timestamp assigned by memair if null
source string nullable
notes string nullable
updated_at timestamp assigned by memair

Example interactions

See the Documentation Explorer for full list of mutations and query filters.

query {
  Recommendations(
    first: 1
    expired: false
    actioned: false
    type: video
    order: desc
    order_by: priority
  )
  {
    type
    url
    timestamp
    expires_at
    is_expired
    actioned_at
    is_actioned
  }
}
mutation {
  Create(
    recommendations: [
      {
        priority: 90
        expires_at: tomorrow
        type: video
        url: "https://youtu.be/LQCoHLQkFxw"
      }
    ]
  )
  {
    id
    records_total
  }
}
curl \
  -H 'access-token: 0000000000000000000000000000000000000000000000000000000000000000' \
  -d '{Recommendations(first: 1 expired: false actioned: false type: video order: desc order_by: priority){type url timestamp expires_at is_expired actioned_at is_actioned}}' \
  -X POST https://memair.com/graphql
from memair import Memair

user = Memair('0000000000000000000000000000000000000000000000000000000000000000')
query = '{Recommendations(first: 1 expired: false actioned: false type: video order: desc order_by: priority){type url timestamp expires_at is_expired actioned_at is_actioned} }'
response = user.query(query)
print(response)
{
  "data": {
    "Recommendations": [
      {
        "type": "Watch video",
        "url": "https://youtu.be/LQCoHLQkFxw",
        "timestamp": "2018-11-19T15:49:03Z",
        "expires_at": "2018-11-20T05:00:00Z",
        "is_expired": false,
        "actioned_at": null,
        "is_actioned": false
      }
    ]
  }
}
{
  "data": None,
  "errors": [
    {
      "message": "Please limit requests to 10000 records",
      "locations": [{"line": 3, "column": 3}],
      "path": ["Recommendations"]
    }
  ]
}

Biometrics

This model is used to store user data for defined biometric types like blood pressure, weight, or body temperature. A full list of biometric types can be accessed using the BiometricTypes endpoint or inspecting the data-types repo. Please create a pull request or contact us to add biometric types.

Model

Grain: 1 row per biometric type per timestamp. Duplicates will be deleted leaving the latest version.

Name Type Notes
id integer assigned by memair
biometric_type biometric type required
value integer required
timestamp timestamp assigned by memair if null
source string nullable
notes string nullable
updated_at timestamp assigned by memair

Example interactions

See the Documentation Explorer for full list of mutations and query filters.

query {
  Biometrics(
    first: 1
    order: desc
    order_by: timestamp
    type: weight
  ) {
    timestamp
    value
    biometric_type {
      name
      unit
    }
  }
}
mutation {
  Create(
    biometrics: [
      {
        value: 80
        type: weight
      }
    ]
  )
  {
    id
    records_total
  }
}
curl \
  -H 'access-token: 0000000000000000000000000000000000000000000000000000000000000000' \
  -d '{Biometrics(first: 1 order: desc order_by: timestamp type: weight) {timestamp value biometric_type {name unit}}}' \
  -X POST https://memair.com/graphql
from memair import Memair

user = Memair('0000000000000000000000000000000000000000000000000000000000000000')
query = "{Biometrics(first: 1 order: desc order_by: timestamp type: weight) {timestamp value biometric_type {name unit}}}"
response = user.query(query)
print(response)
{
  "data": {
    "Biometrics": [
      {
        "timestamp": "2018-01-01T00:00:00Z",
        "value": 80,
        "biometric_type": {
          "name": "Body Weight",
          "unit": "Kilogram"
        }
      }
    ]
  }
}
{
  "data": None,
  "errors": [
    {
      "message": "Please limit requests to 10000 records",
      "locations": [{"line": 3, "column": 3}],
      "path": ["Biometrics"]
    }
  ]
}

Digital Activities

Models defined digital activities

This model is used to store user data for defined digital activity types like blood pressure, weight, body temperature. A full list of digital activity types can be accessed using the DigitalActivityTypes endpoint or inspecting the data-types repo. Please create a pull request or contact us to add digital activity types.

Model

Grain: 1 row per digital activity type per timestamp. Duplicates will be deleted leaving the latest version.

Name Type Notes
id integer assigned by memair
digital_activity_type digital activity type required
duration integer in seconds & nullable
timestamp timestamp assigned by memair if null
ended_at timestamp assigned by memair based on duration
meta json nullable
source string nullable
notes string nullable
updated_at timestamp assigned by memair

Example interactions

See the Documentation Explorer for full list of mutations and query filters.

query {
  DigitalActivities(
    first: 50
    order: desc
    order_by: timestamp
    type: all
  ) {
    timestamp
    digital_activity_type {
      name
    }
  }
}
mutation {
  Create(
    digital_activities: [
      {
        type: opened_app
        meta: {
          app_name: "cat calendar"
        }
      }
    ]
  )
  {
    id
    records_total
  }
}
curl \
  -H 'access-token: 0000000000000000000000000000000000000000000000000000000000000000' \
  -d '{DigitalActivities(first: 50, order: desc, order_by: timestamp, type: all) {timestamp, digital_activity_type {name}}}' \
  -X POST https://memair.com/graphql
from memair import Memair

user = Memair('0000000000000000000000000000000000000000000000000000000000000000')
query = "{DigitalActivities(first: 50, order: desc, order_by: timestamp, type: all) {timestamp, digital_activity_type {name}}}"
response = user.query(query)
print(response)
{
  "data": {
    "DigitalActivities": [
      {
        "timestamp": "2018-05-19T03:55:10Z",
        "digital_activity_type": {
          "name": "Opened app"
        }
      }
      ...
      {
        "timestamp": "2018-05-123T03:24:55Z",
        "digital_activity_type": {
          "name": "Took photo"
        }
      }
    ]
  }
}
{
  "data": None,
  "errors": [
    {
      "message": "Please limit requests to 10000 records",
      "locations": [{"line": 3, "column": 3}],
      "path": ["DigitalActivities"]
    }
  ]
}

Emotions

This model is used to store user data for defined emotion types like blood pressure, happy, or body temperature. A full list of emotion types can be accessed using the EmotionTypes endpoint or inspecting the data-types repo. Please create a pull request or contact us to add emotion types.

Model

Grain: 1 row per emotion type per timestamp. Duplicates will be deleted leaving the latest version.

Name Type Notes
id integer assigned by memair
emotion_type emotion type required
intensity integer required
timestamp timestamp assigned by memair if null
source string nullable
notes string nullable
updated_at timestamp assigned by memair

Example interactions

See the Documentation Explorer for full list of mutations and query filters.

query {
  Emotions(
    first: 1
    order: desc
    order_by: timestamp
    type: happy
  ) {
    timestamp
    intensity
    emotion_type {
      name
    }
  }
}
mutation {
  Create(
    emotions: [
      {
        intensity: 8
        type: happy
      }
    ]
  )
  {
    id
    records_total
  }
}
curl \
  -H 'access-token: 0000000000000000000000000000000000000000000000000000000000000000' \
  -d '{Emotions(first: 1 order: desc order_by: timestamp type: happy) {timestamp intensity emotion_type {name}}}' \
  -X POST https://memair.com/graphql
from memair import Memair

user = Memair('0000000000000000000000000000000000000000000000000000000000000000')
query = "{Emotions(first: 1 order: desc order_by: timestamp type: happy) {timestamp intensity emotion_type {name}}}"
response = user.query(query)
print(response)
{
  "data": {
    "Emotions": [
      {
        "timestamp": "2018-01-01T00:00:00Z",
        "intensity": 80,
        "emotion_type": {
          "name": "Happy"
        }
      }
    ]
  }
}
{
  "data": None,
  "errors": [
    {
      "message": "Please limit requests to 10000 records",
      "locations": [{"line": 3, "column": 3}],
      "path": ["Emotions"]
    }
  ]
}

Journals

This model is used to store user data for defined journal types like concept, idea, or thought. A full list of journal types can be accessed using the JournalTypes endpoint or inspecting the data-types repo. Please create a pull request or contact us to add journal types.

Model

Grain: 1 row per journal type per timestamp. Duplicates will be deleted leaving the latest version.

Name Type Notes
id integer assigned by memair
journal_type journal type required
document integer required
timestamp timestamp assigned by memair if null
source string nullable
notes string nullable
updated_at timestamp assigned by memair

Example interactions

See the Documentation Explorer for full list of mutations and query filters.

query {
  Journals(
    first: 1
    order: desc
    order_by: timestamp
    type: idea
  ) {
    timestamp
    document
    journal_type {
      name
    }
  }
}
mutation {
  Create(
    journals: [
      {
        document: "Cat barbershop, not sure if it's for cats of just has cats running around"
        type: idea
      }
    ]
  )
  {
    id
    records_total
  }
}
curl \
  -H 'access-token: 0000000000000000000000000000000000000000000000000000000000000000' \
  -d '{Journals(first: 1 order: desc order_by: timestamp type: idea) {timestamp document journal_type {name}}}' \
  -X POST https://memair.com/graphql
from memair import Memair

user = Memair('0000000000000000000000000000000000000000000000000000000000000000')
query = "{Journals(first: 1 order: desc order_by: timestamp type: idea) {timestamp document journal_type {name}}}"
response = user.query(query)
print(response)
{
  "data": {
    "Journals": [
      {
        "timestamp": "2018-01-01T00:00:00Z",
        "document": 80,
        "journal_type": {
          "name": "Idea"
        }
      }
    ]
  }
}
{
  "data": None,
  "errors": [
    {
      "message": "Please limit requests to 10000 records",
      "locations": [{"line": 3, "column": 3}],
      "path": ["Journals"]
    }
  ]
}

Locations

Models user geospatially

Parameters
lat
Latitude
lon
Longitude
timestamp
Timestamp of location
altitude
Altitude (meters)
point_accuracy
Point Accuracy (meters)
altitude_accuracy
Altitude Accuracy (meters)
heading
Heading (degrees from north)
speed
Speed (meters per second)
source
Source of location

Grain: 1 row per location type per timestamp. Duplicates will be deleted leaving the latest version.

Example interactions

See the Documentation Explorer for full list of mutations and query filters.

query {
  Locations(
    first: 50
    order: desc
    order_by: timestamp
    within: "42,42,100"
  ) {
    lat
    lon
    timestamp
  }
}
mutation {
  Create(
    locations: [
      {
        lat: 42
        lon: 42
      }
    ]
  )
  {
    id
    records_total
  }
}
curl \
  -H 'access-token: 0000000000000000000000000000000000000000000000000000000000000000' \
  -d '{Locations(first: 50, order: desc, order_by: timestamp) {lat, lon, timestamp}}' \
  -X POST https://memair.com/graphql
from memair import Memair

user = Memair('0000000000000000000000000000000000000000000000000000000000000000')
query = "{Locations(first: 50, order: desc, order_by: timestamp) {lat, lon, timestamp}}"
response = user.query(query)
print(response)
{
  "data": {
    "Locations": [
      {
        "lat": 42,
        "lon": 42,
        "timestamp": "2018-05-26T11:52:23Z"
      },
      ...
      {
        "lat": 42,
        "lon": 42,
        "timestamp": "2018-05-26T11:52:21Z"
      }
    ]
  }
}
{
  "data": None,
  "errors": [
    {
      "message": "Please limit requests to 10000 records",
      "locations": [{"line": 3, "column": 3}],
      "path": ["Locations"]
    }
  ]
}

Medications

This model is used to store user medication usage data. A full list of medication forms can be accessed using the MedicationForms endpoint or inspecting the data-types repo. Please create a pull request or contact us to add new medication forms.

Model

Grain: 1 row per medication usage. Duplicates will be deleted leaving the latest version.

Name Type Notes
id integer assigned by memair
medication_form medication form required
dose float required
medication_name string required
timestamp timestamp assigned by memair if null
source string nullable
notes string nullable
updated_at timestamp assigned by memair

Example interactions

See the Documentation Explorer for full list of mutations and query filters.

query {
  Medications(
    first: 1
    order: desc
    order_by: timestamp
    form: oral_tablet
  ) {
    timestamp
    dose
    medication_name
  }
}
mutation {
  Create(
    medications: [
      {
        dose: 0.2
        form: oral_tablet
        medication_name: "ibuprofen"
      }
    ]
  )
  {
    id
    records_total
  }
}
curl \
  -H 'access-token: 0000000000000000000000000000000000000000000000000000000000000000' \
  -d '{Medications(first: 1 order: desc order_by: timestamp form: oral_tablet) {timestamp dose medication_name}}' \
  -X POST https://memair.com/graphql
from memair import Memair

user = Memair('0000000000000000000000000000000000000000000000000000000000000000')
query = "{Medications(first: 1 order: desc order_by: timestamp form: oral_tablet) {timestamp dose medication_name}}"
response = user.query(query)
print(response)
{
  "data": {
    "Medications": [
    ]
  }
}
{
  "data": None,
  "errors": [
    {
      "message": "Please limit requests to 10000 records",
      "locations": [{"line": 3, "column": 3}],
      "path": ["Medications"]
    }
  ]
}

Physical Activities

Models defined physical activities

This model is used to store user data for defined physical activity types like blood pressure, weight, body temperature. A full list of physical activity types can be accessed using the PhysicalActivityTypes endpoint or inspecting the data-types repo. Please create a pull request or contact us to add physical activity types.

Model

Grain: 1 row per physical activity type per timestamp. Duplicates will be deleted leaving the latest version.

Name Type Notes
id integer assigned by memair
physical_activity_type physical activity type required
duration integer in seconds & nullable
timestamp timestamp assigned by memair if null
ended_at timestamp assigned by memair based on duration
meta json nullable
source string nullable
notes string nullable
updated_at timestamp assigned by memair

Example interactions

See the Documentation Explorer for full list of mutations and query filters.

query {
  PhysicalActivities(
    first: 50
    order: desc
    order_by: timestamp
    type: all
  ) {
    timestamp
    physical_activity_type {
      name
    }
  }
}
mutation {
  Create(
    physical_activities: [
      {
        type: acroyoga
      }
    ]
  )
  {
    id
    records_total
  }
}
curl \
  -H 'access-token: 0000000000000000000000000000000000000000000000000000000000000000' \
  -d '{PhysicalActivities(first: 50, order: desc, order_by: timestamp, type: all) {timestamp, physical_activity_type {name}}}' \
  -X POST https://memair.com/graphql
from memair import Memair

user = Memair('0000000000000000000000000000000000000000000000000000000000000000')
query = "{PhysicalActivities(first: 50, order: desc, order_by: timestamp, type: all) {timestamp, physical_activity_type {name}}}"
response = user.query(query)
print(response)
{
  "data": {
    "PhysicalActivities": [
      {
        "timestamp": "2018-05-19T03:55:10Z",
        "physical_activity_type": {
          "name": "Skating"
        }
      }
      ...
      {
        "timestamp": "2018-05-123T03:24:55Z",
        "physical_activity_type": {
          "name": "Polo"
        }
      }
    ]
  }
}
{
  "data": None,
  "errors": [
    {
      "message": "Please limit requests to 10000 records",
      "locations": [{"line": 3, "column": 3}],
      "path": ["PhysicalActivities"]
    }
  ]
}

Proposed Models

A list of proposed models

Please contact us if you have suggestions for new models or would like us to focus on currently proposed models.

  • Bio functions
    • Passed gas
    • Menstruated
  • Ingestion
    • An apple
    • Meclizine 25mg
    • Ibuprofen 400mg
  • Symptoms
    • Throbbing in right foot
    • Sharp pain in front left brain