Skip to content

Commit ee154b0

Browse files
authored
Merge pull request #1036 from openaps/dev
0.7.0 release from dev to master
2 parents 86f601e + 1e4ce3f commit ee154b0

File tree

154 files changed

+13500
-4031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+13500
-4031
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/tests
2+
/www

.eslintrc.js

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
module.exports = {
2+
"env": {
3+
"commonjs": true,
4+
"node": true,
5+
},
6+
"extends": "eslint:recommended",
7+
"globals": {
8+
},
9+
"parserOptions": {
10+
"ecmaVersion": 5
11+
},
12+
"rules": {
13+
"accessor-pairs": "error",
14+
"array-bracket-newline": "off",
15+
"array-bracket-spacing": "off",
16+
"array-callback-return": "off",
17+
"array-element-newline": "off",
18+
"arrow-body-style": "error",
19+
"arrow-parens": "error",
20+
"arrow-spacing": "error",
21+
"block-scoped-var": "off",
22+
"block-spacing": "off",
23+
"brace-style": "off",
24+
"callback-return": "error",
25+
"camelcase": "off",
26+
"capitalized-comments": "off",
27+
"class-methods-use-this": "error",
28+
"comma-dangle": "off",
29+
"comma-spacing": "off",
30+
"comma-style": "off",
31+
"complexity": "off",
32+
"computed-property-spacing": [
33+
"error",
34+
"never"
35+
],
36+
"consistent-return": "off",
37+
"consistent-this": "off",
38+
"curly": "off",
39+
"default-case": "off",
40+
"dot-location": [
41+
"error",
42+
"property"
43+
],
44+
"dot-notation": "off",
45+
"eol-last": "off",
46+
"eqeqeq": "error",
47+
"func-call-spacing": "off",
48+
"func-name-matching": "error",
49+
"func-names": "off",
50+
"func-style": "off",
51+
"function-paren-newline": "off",
52+
"generator-star-spacing": "error",
53+
"global-require": "off",
54+
"guard-for-in": "off",
55+
"handle-callback-err": "error",
56+
"id-blacklist": "error",
57+
"id-length": "off",
58+
"id-match": "error",
59+
"implicit-arrow-linebreak": "error",
60+
"indent": "off",
61+
"indent-legacy": "off",
62+
"init-declarations": "off",
63+
"jsx-quotes": "error",
64+
"key-spacing": "off",
65+
"keyword-spacing": "off",
66+
"line-comment-position": "off",
67+
"linebreak-style": [
68+
"error",
69+
"unix"
70+
],
71+
"lines-around-comment": "off",
72+
"lines-around-directive": "off",
73+
"lines-between-class-members": "error",
74+
"max-depth": "off",
75+
"max-len": "off",
76+
"max-lines": "off",
77+
"max-lines-per-function": "off",
78+
"max-nested-callbacks": "error",
79+
"max-params": "off",
80+
"max-statements": "off",
81+
"max-statements-per-line": "off",
82+
"multiline-comment-style": "off",
83+
"multiline-ternary": "off",
84+
"new-parens": "off",
85+
"newline-after-var": "off",
86+
"newline-before-return": "off",
87+
"newline-per-chained-call": "off",
88+
"no-alert": "error",
89+
"no-array-constructor": "error",
90+
"no-await-in-loop": "error",
91+
"no-bitwise": "off",
92+
"no-buffer-constructor": "error",
93+
"no-caller": "error",
94+
"no-catch-shadow": "off",
95+
"no-confusing-arrow": "error",
96+
"no-console":"off",
97+
"no-continue": "off",
98+
"no-div-regex": "error",
99+
"no-duplicate-imports": "error",
100+
"no-else-return": "off",
101+
"no-empty-function": "off",
102+
"no-eq-null": "off",
103+
"no-eval": "error",
104+
"no-extend-native": "error",
105+
"no-extra-bind": "error",
106+
"no-extra-label": "error",
107+
"no-extra-parens": "off",
108+
"no-floating-decimal": "off",
109+
"no-implicit-coercion": [
110+
"error",
111+
{
112+
"boolean": false,
113+
"number": false,
114+
"string": false
115+
}
116+
],
117+
"no-implicit-globals": "off",
118+
"no-implied-eval": "error",
119+
"no-inline-comments": "off",
120+
"no-invalid-this": "off",
121+
"no-iterator": "error",
122+
"no-label-var": "error",
123+
"no-labels": "error",
124+
"no-lone-blocks": "off",
125+
"no-lonely-if": "off",
126+
"no-loop-func": "off",
127+
"no-magic-numbers": "off",
128+
"no-mixed-operators": "off",
129+
"no-mixed-requires": "error",
130+
"no-multi-assign": "off",
131+
"no-multi-spaces": "off",
132+
"no-multi-str": "error",
133+
"no-multiple-empty-lines": "off",
134+
"no-native-reassign": "error",
135+
"no-negated-condition": "off",
136+
"no-negated-in-lhs": "error",
137+
"no-nested-ternary": "off",
138+
"no-new": "error",
139+
"no-new-func": "error",
140+
"no-new-object": "error",
141+
"no-new-require": "error",
142+
"no-new-wrappers": "error",
143+
"no-octal-escape": "error",
144+
"no-param-reassign": "off",
145+
"no-path-concat": "error",
146+
"no-plusplus": "off",
147+
"no-process-env": "error",
148+
"no-process-exit": "off",
149+
"no-proto": "off",
150+
"no-prototype-builtins": "off",
151+
"no-restricted-globals": "error",
152+
"no-restricted-imports": "error",
153+
"no-restricted-modules": "error",
154+
"no-restricted-properties": "error",
155+
"no-restricted-syntax": "error",
156+
"no-return-assign": "off",
157+
"no-return-await": "error",
158+
"no-script-url": "error",
159+
"no-self-assign": [
160+
"error",
161+
{
162+
"props": false
163+
}
164+
],
165+
"no-self-compare": "off",
166+
"no-sequences": "off",
167+
"no-shadow": "off",
168+
"no-shadow-restricted-names": "error",
169+
"no-spaced-func": "off",
170+
"no-sync": "off",
171+
"no-tabs": "off",
172+
"no-template-curly-in-string": "error",
173+
"no-ternary": "off",
174+
"no-throw-literal": "off",
175+
"no-trailing-spaces": "off",
176+
"no-undef-init": "error",
177+
"no-undefined": "off",
178+
"no-underscore-dangle": "off",
179+
"no-unmodified-loop-condition": "off",
180+
"no-unneeded-ternary": "off",
181+
"no-unused-expressions": "off",
182+
"no-use-before-define": "off",
183+
"no-useless-call": "off",
184+
"no-useless-computed-key": "error",
185+
"no-useless-concat": "off",
186+
"no-useless-constructor": "error",
187+
"no-useless-rename": "error",
188+
"no-useless-return": "off",
189+
"no-var": "off",
190+
"no-void": "off",
191+
"no-warning-comments": "off",
192+
"no-whitespace-before-property": "error",
193+
"no-with": "error",
194+
"nonblock-statement-body-position": [
195+
"error",
196+
"any"
197+
],
198+
"object-curly-newline": "off",
199+
"object-curly-spacing": "off",
200+
"object-property-newline": "off",
201+
"object-shorthand": "off",
202+
"one-var": "off",
203+
"one-var-declaration-per-line": "off",
204+
"operator-assignment": "off",
205+
"operator-linebreak": "off",
206+
"padded-blocks": "off",
207+
"padding-line-between-statements": "error",
208+
"prefer-arrow-callback": "off",
209+
"prefer-const": "error",
210+
"prefer-destructuring": "off",
211+
"prefer-numeric-literals": "error",
212+
"prefer-object-spread": "off",
213+
"prefer-promise-reject-errors": "error",
214+
"prefer-reflect": "off",
215+
"prefer-rest-params": "off",
216+
"prefer-spread": "off",
217+
"prefer-template": "off",
218+
"quote-props": "off",
219+
"quotes": "off",
220+
"radix": "off",
221+
"require-await": "error",
222+
"require-jsdoc": "off",
223+
"require-unicode-regexp": "off",
224+
"rest-spread-spacing": "error",
225+
"semi": "off",
226+
"semi-spacing": "off",
227+
"semi-style": "off",
228+
"sort-imports": "error",
229+
"sort-keys": "off",
230+
"sort-vars": "off",
231+
"space-before-blocks": "off",
232+
"space-before-function-paren": "off",
233+
"space-in-parens": "off",
234+
"space-infix-ops": "off",
235+
"space-unary-ops": "off",
236+
"spaced-comment": "off",
237+
"strict": "off",
238+
"switch-colon-spacing": "off",
239+
"symbol-description": "error",
240+
"template-curly-spacing": "error",
241+
"template-tag-spacing": "error",
242+
"unicode-bom": [
243+
"error",
244+
"never"
245+
],
246+
"valid-jsdoc": "off",
247+
"valid-typeof": [
248+
"error",
249+
{
250+
"requireStringLiterals": false
251+
}
252+
],
253+
"vars-on-top": "off",
254+
"wrap-iife": "off",
255+
"wrap-regex": "off",
256+
"yield-star-spacing": "error",
257+
"yoda": "off"
258+
}
259+
};

.travis.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
1-
language: node_js
2-
sudo: false
3-
node_js:
4-
- "0.10"
5-
- "0.12"
6-
script: make travis
7-
after_script: make report
1+
node_js-steps: &node_js-steps
2+
language: node_js
3+
script: make travis
4+
after_script: make report
5+
6+
python-steps: &python-steps
7+
language: python
8+
install: pip install flake8
9+
script:
10+
# stop the build if there are Python syntax errors or undefined names
11+
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
12+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
13+
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
14+
15+
matrix:
16+
include:
17+
- node_js: "8"
18+
<<: *node_js-steps
19+
- node_js: "10"
20+
<<: *node_js-steps
21+
- node_js: "node" # current version of Node.js on Travis CI
22+
<<: *node_js-steps
23+
- python: "2.7"
24+
<<: *python-steps
25+
- python: "3.8"
26+
<<: *python-steps

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 OpenAPS Contributors
3+
Copyright (c) 2015-2019 OpenAPS Contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Valid commands:
3131
oref0 ifttt-notify
3232
oref0 get-profile
3333
oref0 calculate-iob
34-
oref0 determine-basal
3534
oref0 help - this message
3635
```
3736

bin/all-autosens-history.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/usr/bin/env bash
2+
3+
oref0_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
4+
interval=${1:-96}
5+
allowedload=${2:-5}
6+
7+
main() {
8+
ls | while read participant; do
9+
(
10+
echo "Processing participant $participant"
11+
cd $participant/direct-sharing-31/ || die "$participant/direct-sharing-31/ not found"
12+
gunzip *.gz 2>/dev/null
13+
mkdir -p parts || die "Couldn't mkdir parts"
14+
rm parts/treatments*.json 2>/dev/null
15+
echo Checking / waiting for system load to be below $allowedload before continuing
16+
while highload; do
17+
sleep 30
18+
done
19+
# this assumes that there are always fewer treatment records than entries, so the treatments will finish first
20+
# (or at least finish before the oref0-autosens-history.js job for that month starts)
21+
cat treatments*.json | jq -cn --stream 'fromstream(1|truncate_stream(inputs))' | while read line; do
22+
date=$(echo $line | jq .created_at)
23+
year=$(echo $date | cut -b 2,3,4,5)
24+
month=$(echo $date | cut -b 7,8)
25+
echo "Processing participant $participant treatments for $year $month"
26+
echo $line >> parts/treatments-$year-$month.json
27+
done | uniq &
28+
rm parts/entries*.json
29+
cat entries*.json | jq -cn --stream 'fromstream(1|truncate_stream(inputs))' | while read line; do
30+
date=$(echo $line | jq .dateString)
31+
year=$(echo $date | cut -b 2,3,4,5)
32+
month=$(echo $date | cut -b 7,8)
33+
if [[ $year =~ 201. ]]; then
34+
echo "Processing participant $participant entries for $year $month"
35+
echo $line >> parts/entries-$year-$month.json
36+
fi
37+
done | uniq
38+
for year in 2019 2018 2017 2016; do
39+
for month in 12 11 10 09 08 07 06 05 04 03 02 01; do
40+
if [ -f parts/entries-$year-$month.json ]; then
41+
cat parts/entries-$year-$month.json | jq -s . > $year-$month-entries.json
42+
if [ -f parts/treatments-$year-$month.json ]; then
43+
cat parts/treatments-$year-$month.json | jq -s . > $year-$month-treatments.json
44+
echo Checking / waiting for system load to be below $allowedload before continuing
45+
while highload; do
46+
sleep 30
47+
done
48+
echo "running $oref0_dir/bin/oref0-autosens-history.js $year-$month-entries.json $year-$month-treatments.json profile*.json 12 isf-$year-$month.json 2> $year-$month.out &"
49+
$oref0_dir/oref0-autosens-history.js $year-$month-entries.json $year-$month-treatments.json profile*.json 12 isf-$year-$month.json 2> $year-$month.out &
50+
sleep 5
51+
fi
52+
fi
53+
done # for month
54+
done # for year
55+
cd ../../
56+
) &
57+
echo Checking / waiting for system load to be below $allowedload before continuing
58+
while highload; do
59+
sleep 30
60+
done
61+
echo "Waiting 10 seconds before processing next participant"
62+
sleep 10
63+
done # while read participant
64+
65+
# tailing the .out to help see that the script is done
66+
sleep 30
67+
tail */direct-sharing-31/*.out
68+
echo "All participants have now been started. Above is the output generated so far. Review for any errors - if errors exist...there's an error. Remaining participants may still be running."
69+
70+
}
71+
72+
function highload {
73+
# check whether system load average is high
74+
uptime | tr -d ',' | awk "\$(NF-2) > $allowedload" | grep load
75+
}
76+
77+
die() {
78+
echo "$@"
79+
exit 1
80+
}
81+
82+
main "$@"

0 commit comments

Comments
 (0)