PDLF – Personal Data Logging Format Specification

I have been practising quantifiedself for years now. I have measurement data in various formats. Formats vary based on devices and services. I really wanted to bring all of this data into one database. That would make querying and combining data easy.

I run CouchDB as my personal database. This format started as a way to standardise data so it could be inserted and queried from CouchDB. Soon I realised format could be generalised enough to be used by any NoSQL1 database that allows direct JSON insertion.

This format is meant for individuals2 to log the data from their own devices. So authorship, license, authorisation info are not part of this format. Though it could be extended to have that kind of information. Its out of scope for this specification.

A single3 collection/database should be able to store values from different devices.

This document is still in alpha. Expect changes.

Format

What is PDLF?

PDLF is personal data logging format. It's name is an acronym for Personal Data Logger Format.

PDLF is data interchange and storage format based on JavaScript Object Notation (JSON).

It defines several types of JSON objects which can be used represent data about a measurement.

Example

{
  "_id": "*unique id, as such no specific way to generate it. Left to the system",
  "version": "*version" ,
  "time": "*date with seconds and timezone as per RFC3339",
  "geo": "geojson point as of now",
  "type": "*type of measurement",
  "device": "*Device on which it was measured",
  "tags": [
    "Array of",
    "tags"
  ],
  "data*": {
    "note": "can have notes",
  }
}

Fields

Some fields are compulsory and some are not.

Predefined Formats

We have some predefined formats. If you need for any other device. Please do let me know. I will create and publish.

Continuous Blood Glucose

{
  "_id": "dd5f84765c45698d8fa275f98e6d9ef1",
  "version": 0.1,
  "time": "2016-05-26T11:42:00.73+05:30",
  "geo": {
    "type": "Point",
    "coordinates": [
      77.57926940917969,
      12.981809528732812
    ]
  },
  "type": "cbg",
  "device": "Abott Freestyle",
  "tags": [
    "First",
    "CGM"
  ],
  "data": {
    "note": "MY first measurement using the CGM",
    "unit": "mg/dL",
    "glucose": 111
  }
}

Blood Pressure

{
  "_id": "474bc29b9077fd48c1bd68da0512998a",
  "version": 0.1,
  "time": "2016-05-26T11:42:00.73+05:30",
  "geo": {
    "type": "Point",
    "coordinates": [
      77.6792694091797,
      12.781809528732811
    ]
  },
  "type": "bp",
  "device": "Omron Wrist Blood Pressure Monitor",
  "tags": [
    "BP"
  ],
  "data": {
    "unit": "mmHG",
    "sys": 120,
    "dia": 80
  }
}

Body Temperature

{
  "_id": "5c4fca811dccfc795694113b534900a2",
  "_rev": "1-0f91482c028cdf4121b8c88f85996b26",
  "version": 0.1,
  "time": "2016-05-26T11:42:00.73+05:30",
  "geo": {
    "type": "Point",
    "coordinates": [
      77.57926940917969,
      12.981809528732812
    ]
  },
  "type": "bodytemp",
  "device": "Digital Themometer",
  "tags": [
    "First"
  ],
  "data": {
    "note": "MY first measurement of temp",
    "unit": "F",
    "bodytemp": 98.6
  }
}

Body Weight

{
  "_id": "74cb5a817956e2826a6b1ddc8e9771eb",
  "version": 0.1,
  "time": "2016-05-26T11:42:00.73+05:30",
  "geo": {
    "type": "Point",
    "coordinates": [
      77.58706940917969,
      12.981809528732812
    ]
  },
  "type": "bodyweight",
  "device": "Omron",
  "tags": [
    "First"
  ],
  "data": {
    "unit": "kg",
    "bodyweight": 52.3
  }
}

Heart Rate or Pulse

{
  "_id": "ca854b1d439512c94374590092b98d6b",
  "version": 0.1,
  "time": "2016-05-26T11:42:00.73+05:30",
  "geo": {
    "type": "Point",
    "coordinates": [
      77.58706940917969,
      12.981809528732812
    ]
  },
  "type": "heartrate",
  "device": "Omron Wrist Blood Pressure Monitor",
  "tags": [
    "First"
  ],
  "data": {
    "unit": "bpm",
    "heartrate": 70
  }
}

Steps

{
  "_id": "dd5f84765c45698d8fa275f98e6d9ef1",
  "version": 0.1,
  "time": "2016-05-26T11:42:00.73+05:30",
  "geo": {
    "type": "Point",
    "coordinates": [
      77.57926940917969,
      12.981809528732812
    ]
  },
  "type": "steps",
  "device": "Pedometer",
  "tags": [
    "First",
    "Pedometer"
  ],
  "data": {
    "note": "I Walked quite a bit today",
    "unit": "steps",
    "steps": 10000
  }
}

Erythrocyte Sedimentation Rate (ESR)

{
  "_id": "e52ebab17a3ae68be226f4d30f7696f0",
  "version": 0.1,
  "time": "2017-03-28T12:48:00.73+05:30",
  "geo": {
    "type": "Point",
    "coordinates": [
      77.61835187673569,
      13.003773719250814
    ]
  },
  "type": "esr",
  "device": "lab",
  "tags": [
    "infection",
    "fever"
  ],
  "data": {
    "note": "my first test",
    "esr": 25,
    "unit": "mm/hr",
    "method": "Westergren"
  }
}

Check In

{
  "_id": "17d232913e2198c2881cd29e8165309f",
  "version": 0.1,
  "time": "2017-05-22T14:05:00.73+05:30",
  "geo": {
    "type": "Point",
    "coordinates": [
      77.5844094,
      12.9788089
    ]
  },
  "type": "checkin",
  "device": "phone",
  "tags": [
    "checkin",
    "notes"
  ],
  "data": {
    "note": "I am at RadioActiv Community Radio."
  }
}

Diary Entry

{
  "_id": "17d232913e2198c2881cd29e8165309f",
  "version": 0.1,
  "time": "2017-05-20T21:05:00.73+05:30",
  "geo": {
    "type": "Point",
    "coordinates": [
      77.61835187673569,
      13.003773719250814
    ]
  },
  "type": "diary",
  "device": "phone",
  "tags": [
    "eod",
    "notes"
  ],
  "data": {
    "note": "Its been a good day. I wrote the notes for a format which I am going to call Personal Data Logging Format."
  }
}

Code

I am writing code to import data into CouchDB from various formats. I will publish on GitHub soon.

References

  1. JSON
  2. GeoJSON is a format for encoding a variety of geographic data structures.
  3. RSS 2.0 Specification
  4. CouchDB API Basics
  5. Tidepool's data models
  6. MongoDB JSON Import
  7. Crate.io DB JSON Import
  8. Markdown

Version

Version 0.1 last updated on May 22, 2017 @ 2:55 PM.

License and authorship

Personal Data Logger Format (PDLF) is under the terms of the Attribution/Share Alike Creative Commons license. The author of this document is Thejesh GN. Please contact me by email i @ thejeshgn.com if you have any comments or suggestions.

Footnotes

  1. Like CouchDB, MongoDB etc
  2. Like Indie web, this is unhosted or Indie Data?.
  3. Though user can store the data from different devices into different database.
Do you like this post? Please rate, its just a click :) 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...