Package: openaps
# openaps utility beltThese are the [core utilities][proposal] needed to develop an open sourceartificial pancreas.This is part of a series of tools to support a self-driven DIYimplementation based on the OpenAPS reference design. The tools may becategorized as *monitor* (collecting data about environment, andoperational status of devices and/or aggregating as much data as isrelevant into one place), *predict* (make predictions about what shouldhappen next), or *control* (enacting changes, and feeding more data backinto the *monitor*).By proceeding using these tools or any piece within, you agree to thecopyright (see LICENSE.txt for more information) and release anycontributors from liability.Check out [the openaps docs][the openaps docs] to help get you started.*Note:* This is intended to be a set of tools to support a self-driven DIYimplementation and any person choosing to use these tools is solelyresponsible for testing and implement these tools independently ortogether as a system.  The [DIY part of OpenAPS is important](http://bit.ly/1NBbZtO). While formal training or experience as anengineer or a developer is not required, what *is* required is a growthmindset to learn what are essentially "building blocks" to implement anOpenAPS instance. This is not a "set and forget" system; it requiresdiligent and consistent testing and monitoring to ensure each piece ofthe system is monitoring, predicting, and performing as desired.  Theperformance and quality of your system lies solely with you.Additionally, this community of contributors believes in "paying itforward", and individuals who are implementing these tools are asked tocontribute by asking questions, helping improve documentation, andcontribute in other ways.[GettingStarted]: https://github.com/openaps/openaps/wiki/GettingStarted[wiki]: https://github.com/openaps/openaps/wiki[proposal]: https://gist.github.com/bewest/a690eaf35c69be898711[the openaps docs]: https://github.com/openaps/docs![openaps loop hardware](https://cloud.githubusercontent.com/assets/394179/9372378/c2023bc2-4692-11e5-8254-fe940f847536.png)This is not an artificial pancreas, but rather tools which independently allow:* monitor - Collect data about environment, and operational status of devices.Aggregate as much data relevant to therapy as possible into one place.We propose a tool, `openaps-use` as a proof of concept.* predict - Can make predictions about what should happen next.* control - Can enact changes in the world: emails, placing phone calls, SMS,issuing commands to pumps.## InstallThere are two ways to install openaps, from source, and as a python package viasetuptools.The following apt-get dependencies are required (they can be installed throughvariety of means, in debian/ubuntu and apt based systems the following packagesare recommended/required:sudo apt-get install python python-dev python-setuptools python-software-properties python-numpy#### From sourceSee [GettingStarted][GettingStarted] for more important informationabout versions of software dependencies, but to install from sourceclone this repo, and issue:sudo python setup.py develop#### From pypiTo [install from pypi](https://pypi.python.org/pypi/openaps):sudo pip install -U openapsThis installs `openaps` system wide.Do not use `openaps` commands in the the openaps repo.  Only use the`openaps` directory for hacking on the core library, or for managingupgrades through git.  Running `openaps` inside of the openapssource directory will error in the best case, and mess up your`openaps` install in the worst case.##### Updatingsudo easy_install -ZU openaps### Usageusage: openaps [-h] [-c C C] [-C CONFIG] [--version] [command] ...#### openaps - openaps: a toolkit for DIY artificial pancreas system##### positional arguments:* command* argsoptional arguments:-h, --help            show this help message and exit-c C C-C CONFIG, --config CONFIG--version             show program's version number and exitUtilities for developing an artificial pancreas system.openaps helps you manage and structure reports for various devices.All of the `device` and `report` `add` and `show` commands modify`openaps.ini` in the current working directory, which is assumed to bea git repo explicitily dedicated to helping develop and configure a`DIY` artificial pancreas system.  This means `openaps` is an SDK foran artificial pancreas system, not an artificial pancreas system.See `openaps init` for setting up a brand new instance of your own`openaps`, or see the notes below for details on how to convert anexisting git repo into an instance of `openaps`.## Common workflows:openaps initopenaps device <cmd>Device commands allow you to match a device driver, with a nameand a configuration.add     - add device config to `openaps.ini`remove  - remove device from `openaps.ini`show    - print device uri, list all by defaultopenaps use [--format <json,stdout,text>][--output <filename>]<device><use>[use-args...]For each device registered, the vendor implementation provides anumber of uses.  This allows users to experiment with reports.openaps report <cmd>Reports match a device use to a format and filename.add     - add report config to `openaps.ini`remove  - remove report from `openaps.ini`show    - print report uri, list all by defaultinvoke  - run and save report in file### Init new openaps environmentDo not use `openaps` commands in the the openaps repo.  Only use the`openaps` directory for hacking on the core library, or for managingupgrades through git.  Instead change to a new directory, not managedby git: `cd ~/Documents`.Setup of new instance:openaps init myopenaps    - this creates an instance of openaps in a newdirectory, called myopenapscd myopenaps - change directory to root of new repoA valid instance of openaps is a git repo with a file called`openaps.ini` present.`openaps` will track configuration and some status information inside of`openaps.ini`.### Init existing git repo as openaps-environmentIf you already have a git repo which you would like tobecome a valid openaps environent, in the root of your repo, run:touch openaps.inigit add openaps.inigit commit -avm 'init openaps'Now, wth a valid `openaps` environment, you can register **device**s foruse.  A **device** is implemented by a **vendor**.  `openaps` provides amodular, language and process independent environment for creatingvendors and devices.### Managing devicesTo register devices for use, see `openaps device` commands:openaps device -hopenaps device add <name> <vendor> [opts...]eg:# register a medtronic device named pumpopenaps device add pump medtronic 665455# register a dexcom device named cgmopenaps device add cgm dexcom### Using devicesNow that devices are known, and we have a variety of commandsavailable.  We can explore how to produce reports by using deviceswith the `openaps use` command:openaps use <device-name> <use-name> [opts]`openaps use` commands can only be used after devices have been added tothe `openaps.ini` config using `openaps device add`.Eg:openaps use pump -h        - show available commands for thedevice known as "pump"openaps use pump iter_pump 100 - get last 100 pump history recordsfrom the device called pumpopenaps use cgm -h         - show available commands for thedevice known as "cgm"openaps use cgm glucose### Save reportsAfter experimenting with `openaps use` commands, users can save reportsusing the `openaps report` commands.`openaps report` commands map `openaps use` commands to filenames:#### `openaps report add`Adding a report means configuring a `use` command with a format and aoutput, most commonly, a filename is used as the output.openaps report add <report-name> <report-formatter> <device> <use> [opts]# add a report, saved in a file called pump-history.json, which is# JSON format, from device pump using use iter_pump.openaps report add pump-history.json JSON pump iter_pump 100# add a report, saved in a file called glucose.json, which is# JSON format, from device cgm using use glucose.openaps report add glucose.json JSON cgm glucose### `invoke` reports to run and save the results of the `use`#### `openaps report invoke`Invoking a report means running a `use` command according to it'sconfiguration.# invoke the report to create glucose.jsonopenaps report invoke glucose.json# invoke the report to create pump-history.jsonopenaps report invoke pump-history.jsonAll commands support tab completion, and -h help options to helpexplore the live help system.### Sample `use` commands#### `medtronic`Assuming device is named `pump`:usage: openaps-use pump [-h]{Session, bolus, iter_glucose, iter_pump,model, mytest, read_basal_profile_A,read_basal_profile_B,read_basal_profile_std, read_carb_ratios,read_clock, read_current_glucose_pages,read_current_history_pages,read_glucose_data, read_history_data,read_selected_basal_profile,read_settings, read_status,read_temp_basal, reservoir, resume_pump,scan, set_temp_basal, settings, status,suspend_pump}...positional arguments:{Session, bolus, iter_glucose, iter_pump, model, mytest,read_basal_profile_A, read_basal_profile_B,read_basal_profile_std, read_carb_ratios, read_clock,read_current_glucose_pages, read_current_history_pages,read_glucose_data, read_history_data,read_selected_basal_profile, read_settings, read_status,read_temp_basal, reservoir, resume_pump, scan, set_temp_basal,settings, status, suspend_pump}OperationSession             session for pumpbolus               Send bolus.iter_glucose        Read latest 100 glucose recordsiter_pump           Read latest 100 pump recordsmodel               Get model numbermytest              Testing read_settingsread_basal_profile_ARead basal profile A.read_basal_profile_BRead basal profile B.read_basal_profile_stdRead default basal profile.read_carb_ratios    Read carb_ratios.read_clock          Read date/time of pumpread_current_glucose_pagesRead current glucose pages.read_current_history_pagesRead current history pages.read_glucose_data   Read pump glucose pageread_history_data   Read pump history pageread_selected_basal_profileFetch the currently selected basal profile.read_settings       Read settings.read_status         Get pump statusread_temp_basal     Read temporary basal rates.reservoir           Get pump remaining insulinresume_pump         resume pumping.scan                scan for usb stickset_temp_basal      Set temporary basal rates.settings            Get pump settingsstatus              Get pump status (alias for read_status)suspend_pump        Suspend pumping.optional arguments:-h, --help            show this help message and exitSome commands like `read_glucose_data`, `read_history_data` take a`page` parameter, describing which page to fetch.Some commands like `bolus`, `set_temp_basal`, take an `input`parameter which may be `-` for `stdin` or a filename containing a jsondata structure which represents the request.All commands support `-h` and `--help` output.#### `dexcom`usage: openaps-use cgm [-h] {glucose,iter_glucose,scan} ...positional arguments:{glucose,iter_glucose,scan}Operationglucose             glucose (will pull all records)iter_glucose <n>       glucose ('n' for the number of records you want)scan                scan for usb stickoptional arguments:-h, --help            show this help message and exit## LicenseMIT LicenseCopyright (c) 2016 Ben WestCopyright (c) 2015 Ben WestPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.