| 
 | 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 | + | 
0 commit comments