Skip to content

Commit aadaa4f

Browse files
committed
getting started on openaps hitchhiker's guide
1 parent 8121667 commit aadaa4f

File tree

9 files changed

+262
-0
lines changed

9 files changed

+262
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
# Alias - shortcut for any command
3+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
# Devices - aka **using** openaps
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
# Reports - the value of reproducibility
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
# Vendors - discovering uniformity
3+
4+

docs/docs/openaps-guide/index.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
Hitchhiker's Guide to openaps
3+
-----------------------------
4+
5+
Welcome to openaps
6+
7+
.. toctree::
8+
:maxdepth: 4
9+
10+
installing
11+
overview
12+
core/vendors
13+
core/devices
14+
core/reports
15+
core/alias
16+
tutorial
17+
18+
19+
20+
21+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
# Installing openaps
3+
4+
The recommended way to install openaps is to use python's package management system.
5+
The [openaps] project is distributed on [pypi][openaps on pypi].
6+
The following apt-get dependencies are required (they can be installed through
7+
variety of means, in debian/ubuntu and apt based systems the following packages
8+
are required:
9+
10+
sudo apt-get install python python-dev python-pip python-software-properties python-numpy
11+
sudo pip install setuptools
12+
13+
[openaps]: https://github.com/openaps/openaps
14+
[openaps on pypi]: https://pypi.python.org/pypi/openaps
15+
16+
#### From pypi
17+
18+
To [install from pypi](https://pypi.python.org/pypi/openaps):
19+
20+
sudo easy_install -Z openaps
21+
22+
This installs `openaps` system wide.
23+
24+
##### Updating
25+
To update `openaps`, append the `-U` option:
26+
27+
sudo easy_install -ZU openaps
28+
29+
30+
#### From source
31+
Sometimes, it's useful to use a development version to help test or debug
32+
features. Here's how to install the project from source.
33+
34+
git clone git://github.com/openaps/openaps.git
35+
cd openaps
36+
# checkout desired branch (dev)?
37+
git checkout dev
38+
sudo python setup.py develop
39+
40+
Do not use `openaps` commands in the the openaps repo. Only use the
41+
`openaps` directory for hacking on the core library, or for managing
42+
upgrades through git. Running `openaps` inside of the openaps
43+
source directory will error in the best case, and mess up your
44+
`openaps` install in the worst case.
45+
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
2+
# About openaps
3+
4+
`openaps` is a toolkit to make developing an artificial pancreas easy
5+
for humans. What is an artificial pancreas? What are the
6+
requirements of this toolkit and how does it work?
7+
8+
While most people learning about this project may be interested in
9+
assembling their own "AP" as soon as possible, it may be helpful to
10+
pause and get a high level overview of openaps.
11+
12+
13+
## What is an artificial pancreas?
14+
15+
The term artificial pancreas can be misleading, as it can include or
16+
exclude different ideas or projects. For our purposes, an artificial
17+
pancreas does the following things:
18+
19+
1. **Monitor** therapeutic data (especially from pumps and CGM) in real time to
20+
provide relevant decision making data points. In order to do this,
21+
we must be able to manage data from disparate systems in a
22+
**uniform** manner.
23+
24+
1. **Predict** what is likely to happen.
25+
For example, when administering insulin, we naturally expect
26+
glucose to fall along a given curve.
27+
High fidelity therapy means communicating expectations like this,
28+
learning when it is wrong, and responding accordingly.
29+
Since clinical therapy is an application of science, this process
30+
must be **reproducible**, so that we can properly assess what
31+
works, and what does not.
32+
33+
1. **Enact** shared plans like a good teammate.
34+
When humans get distracted, or sick, or are asleep, the tools can
35+
and should provide assistance to improve **safety** and increase
36+
**control** over dangerous conditions.
37+
38+
## Bring your own device
39+
40+
Circa 2016-03-27, we have access to a variety of insulin pumps and
41+
glucose monitors. openaps provides a modular framework to manipulate
42+
a variety of insulin pumps, and glucose monitors, as well as
43+
**devices** by different **vendors**. openaps exposes the **uses** of
44+
a **device** from a particular **vendor** for you to explore your own
45+
menagerie of devices in a **uniform** and interoperable manner.
46+
47+
When the community discovers how to communicate with a device, we can
48+
create an openaps **vendor** module for the new device.
49+
50+
## What is a toolkit?
51+
`openaps` is not an artificial pancreas by itself. So far in
52+
discussing some of the philosophy and overview of openaps, we've seen
53+
that it needs to interact with a lot of different devices in a lot of
54+
different circumstances. The solution to solving this problem was to
55+
provide a suite of tools that allows us to interact with the
56+
properties of the system, easily see what is going on inside and
57+
inspect the data. Because we often intend for the system to operate
58+
while we're asleep, the tools also provide several facilities for
59+
easily changing and saving configuration.
60+
61+
This means we'll be using the command line a lot, because it's very
62+
easy to teach, reproduce, and automate. Any series of commands you
63+
type in the command line can be put in a file and made into a script.
64+
65+
Because most people intend to use this as a medical device, we also
66+
wanted to track the data as it moves through the system. openaps
67+
checkpoints all the data so that it can be inspected and verified at
68+
anytime.
69+
70+
The toolkit provides many tools to realize the values enumerated by
71+
our design philosophy. Here are a few, but don't panic, we'll go
72+
through how to use each one methodically:
73+
74+
openaps
75+
openaps-device
76+
openaps-report
77+
openaps-vendor
78+
openaps-use
79+
openaps-alias
80+
81+
Now that `openaps` is installed, we can ask any of these tools for
82+
help to explain themselves:
83+
84+
`openaps --help`
85+
86+
Many of the tools depend on some configuration though, how do we
87+
provide the configuration it needs? If it needs configuration, the
88+
tool might refuse to run, like this:
89+
90+
bewest@bewest-MacBookPro:~/Documents$ openaps use -h
91+
Not an openaps environment, run: openaps init
92+
93+
Don't worry, it's time to create our first workspace!
94+
95+
## My first workspace
96+
97+
This guide aims to help users become comfortable navigating the
98+
openaps commands. Most of the commands read saved configuration.
99+
`openaps` needs a location to store all the data and configuration
100+
generated as we explore. We'll often refer to this location as your
101+
**openaps instance**. The toolkit helps you create an **instance** of
102+
openaps on your computer. We can think about this location as a
103+
workspace for openaps.
104+
105+
Get familiar with `ls`, `cat`, `echo`, `cd`, `pwd` commands.
106+
To create our first openaps instance, we use `openaps init` with the
107+
location we'd like to use:
108+
109+
cd ~/Documents
110+
openaps init tutorial-hello
111+
cd tutorial-hello
112+
pwd
113+
114+
This creates a new openaps **instance** in
115+
`~/Documents/tutorial-hello`. Take a look at what is in your
116+
workspace, using `ls` and `cat`. A valid instance must have an
117+
`openaps.ini` file. It can be empty, which simply means it doesn't
118+
(yet) know about your devices or vendors or anything.
119+
120+
``` eval_rst
121+
.. note::
122+
123+
For the rest of this tutorial, all of our work will be done in the
124+
`~/Documents/tutorial-hello` directory.
125+
```
126+
127+
## Inspecting the log
128+
We mentioned earlier that the requirements for `openaps` demand that
129+
we track data as it flows through the system. Is there a log of all
130+
the transactions that have occurred? If so, it should include the
131+
fact that we just created an instance of openaps. A valid instance of
132+
openaps has two requirements: it must be a `git` repository containing
133+
an `openaps.ini` file at it's root.
134+
135+
This means many operations are tracked using `git`, try `git log` or `git
136+
show`; there should an event in the log showing the time and date (and who!)
137+
created this instance.
138+
139+
```
140+
bewest@bewest-MacBookPro:~/Documents/tutorial-hello$ ls
141+
openaps.ini
142+
bewest@bewest-MacBookPro:~/Documents/tutorial-hello$ cat openaps.ini
143+
bewest@bewest-MacBookPro:~/Documents/tutorial-hello$ wc -l openaps.ini
144+
0 openaps.ini
145+
bewest@bewest-MacBookPro:~/Documents/tutorial-hello$ git show
146+
commit 04715a67099c19ae220220d474aa67e470d07e0e
147+
Author: Ben West <[email protected]>
148+
Date: Sun Mar 27 14:37:56 2016 -0700
149+
150+
initializing openaps 0.1.0-dev
151+
152+
diff --git a/openaps.ini b/openaps.ini
153+
new file mode 100644
154+
index 0000000..e69de29
155+
bewest@bewest-MacBookPro:~/Documents/tutorial-hello$
156+
```
157+
158+
Knowledge of `git` is not usually needed or expected in order to use
159+
`openaps`, however, `openaps` does use it to store and track all data.
160+
This has several side-effects including easy mesh/backup. Many events
161+
in the log will also include a comment on the commands used to create
162+
the transaction. This allows us to share, find and debug problems
163+
quickly and easily.
164+
165+
Many software programs attempt to hide the inner workings. However
166+
because `openaps` has to meet exacting requirements, the design
167+
enables openaps to easily examine and adjust how it works using
168+
standard tools.
169+
170+
## Summary
171+
172+
Congratulations, you're now the owner of a new openaps instance. It's
173+
time to start exploring `openaps` core in more detail.
174+
175+
* [Vendors](core/vendors.md)
176+
* [Devices](core/devices.md)
177+
* [Reports](core/reports.md)
178+
* [Alias](core/alias.md)
179+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
# Tutorial: putting it together
3+
4+
## Hello world device
5+

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Welcome to OpenAPS's documentation!
77

88
docs/introduction/index
99
docs/walkthrough/index
10+
docs/openaps-guide/index
1011

1112
Resources <docs/Resources/index>
1213
reference/index

0 commit comments

Comments
 (0)