insulin 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +27 -1
  2. data/TODO.md +1 -1
  3. data/bin/insulin +6 -2
  4. data/lib/insulin/version.rb +1 -1
  5. metadata +2 -2
data/README.md CHANGED
@@ -15,6 +15,8 @@ Also requires MongoDB. Instructions for installing Mongo on Ubuntu are [here](ht
15
15
  Usage
16
16
  =====
17
17
 
18
+ To suck in some data
19
+
18
20
  insulin ingest </path/to/on_track_export_file.csv>
19
21
 
20
22
  This will take that file, parse it, and push the JSON into a number of collections in a MongoDB database called 'insulin'. You can view them with something like
@@ -26,11 +28,35 @@ This will take that file, parse it, and push the JSON into a number of collectio
26
28
  { "_id" : ObjectId("4ff07b371508cc259c8a8f0c"), "serial" : 266, "timestamp" : ISODate("2012-06-28T09:21:05Z"), "tzoffset" : "+0100", "timezone" : "BST", "unixtime" : 1340875265, "day" : "thursday", "date" : "2012-06-28", "time" : "10:21:05 BST", "type" : "medication", "subtype" : "humalog", "tag" : "breakfast", "value" : 4, "notes" : { "food" : [ "2 bacon", "2 toast" ], "note" : [ "test note" ] } }
27
29
  >
28
30
 
31
+ Currently the only supported output operation is
32
+
33
+ insulin day DATE
34
+
35
+ to show stats for date DATE (in YYYY-MM-DD format) - defaults to 'today' if no date supplied. Note that insulin considers events that occur up to 04:00 as part of the previous actual day (because sometimes we stay up late, right?). Output will look something like
36
+
37
+ 2012-07-06
38
+ 06:50:54 BST glucose 6.4 mmol/L
39
+ 07:05:38 BST weight 59.0 kg
40
+ 09:43:33 BST glucose 6.7 mmol/L
41
+ 09:50:23 BST medication humalog 4.0 x10^-5 L
42
+ 13:17:43 BST glucose 4.7 mmol/L
43
+ 13:31:44 BST medication humalog 4.0 x10^-5 L
44
+ 15:57:12 BST glucose 6.2 mmol/L
45
+ 20:01:41 BST glucose 6.2 mmol/L
46
+ 20:05:21 BST medication humalog 6.0 x10^-5 L
47
+ 21:42:38 BST glucose 9.0 mmol/L
48
+ 00:34:22 BST glucose 9.5 mmol/L
49
+ 00:49:27 BST medication lantus 12.0 x10^-5 L
50
+ Average glucose: 6.96 mmol/L
51
+
29
52
  You can also run the tests, if you're into that sort of thing:
30
53
 
31
54
  bundle exec rspec
32
55
 
33
- There's also some Postfix voodoo I've been using to extract the CSVs from incoming mail, which I'll document here soon.
56
+ Postfix setup
57
+ =============
58
+
59
+ OnTrack allows you to mail the exported CSV files to an email address. [This page](http://tech.jeffri.es/2010/09/automatic-ripping-and-saving-email-attachments-with-postfix/) explains how to configure Postfix to extract those files. I now have this set up so that I mail from OnTrack to particular_address@mydomain.com, the CSVs get dropped into a directory, and then 'insulin ingest' runs periodically on the newest file in that directory.
34
60
 
35
61
  Next steps
36
62
  ==========
data/TODO.md CHANGED
@@ -3,5 +3,5 @@
3
3
  * Map/reduce somewhere?
4
4
  * Jenkins?
5
5
  * Food - combine available carbs data with meds object? or other way around?
6
- * Unhappy with event display from Day. Maybe just make these things fixed-width and move this into Event (which should have a variety of to_s-ish methods, including as_csv which takes a list of fields)
7
6
  * Estimated hba1c?
7
+ * Oops, need to handle the case where there's no data for a given day
data/bin/insulin CHANGED
@@ -21,8 +21,12 @@ module Insulin
21
21
  require 'time'
22
22
  date = Time.new.strftime "%F"
23
23
  end
24
- d = Insulin::Day.new date, @@mongo
25
- puts d
24
+ begin
25
+ d = Insulin::Day.new date, @@mongo
26
+ puts d
27
+ rescue NoMethodError
28
+ puts "No data for %s" % date
29
+ end
26
30
  end
27
31
  end
28
32
  end
@@ -1,5 +1,5 @@
1
1
  module Insulin
2
2
 
3
3
  # Current version
4
- VERSION = "0.0.10"
4
+ VERSION = "0.0.11"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: insulin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-08 00:00:00.000000000 Z
12
+ date: 2012-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor