Initial commit
commit
98cd4d7029
@ -0,0 +1,28 @@
|
||||
input_path ?= $$HOME/notes/diary/running.csv
|
||||
chart_json ?= chart.json
|
||||
|
||||
.PHONY: format-data
|
||||
format-data: tempelhof.csv ## Format data
|
||||
|
||||
tempelhof.csv:
|
||||
csv-tools filter "$(input_path)" "track" "Tempelhof" | \
|
||||
csv-tools select - date distance time track rank | \
|
||||
csv-tools rank - "time" > "$@"
|
||||
|
||||
.PHONY: create-chart
|
||||
create-chart: ## Create new chart
|
||||
./create-chart "$(chart_json)"
|
||||
|
||||
.PHONY: update-chart
|
||||
update-chart: ## Update properties of an existing chart
|
||||
ifeq ($(chart_id),)
|
||||
@echo "You must set the chart_id variable"
|
||||
@echo "Example: make update chart_id=ABCdef"
|
||||
@exit 1
|
||||
else
|
||||
./update-chart "$(chart_id)" "$(chart_json)"
|
||||
endif
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-16s\033[0m %s\n", $$1, $$2}'
|
@ -0,0 +1,194 @@
|
||||
{
|
||||
"language": "en-US",
|
||||
"metadata": {
|
||||
"annotate": {
|
||||
"notes": ""
|
||||
},
|
||||
"axes": {
|
||||
"labels": "time_per_km_str",
|
||||
"x": "date_parsed",
|
||||
"y": "sec_per_km_float"
|
||||
},
|
||||
"data": {
|
||||
"changes": [
|
||||
{
|
||||
"column": 7,
|
||||
"ignored": false,
|
||||
"row": 0,
|
||||
"value": "date"
|
||||
},
|
||||
{
|
||||
"column": 9,
|
||||
"ignored": false,
|
||||
"row": 0,
|
||||
"value": "time per km (sec)"
|
||||
}
|
||||
],
|
||||
"column-format": {
|
||||
"average": {
|
||||
"ignore": true,
|
||||
"number-append": "",
|
||||
"number-divisor": 0,
|
||||
"number-format": "auto",
|
||||
"number-prepend": "",
|
||||
"type": "auto"
|
||||
},
|
||||
"date": {
|
||||
"ignore": false,
|
||||
"number-append": "",
|
||||
"number-divisor": 0,
|
||||
"number-format": "auto",
|
||||
"number-prepend": "",
|
||||
"type": "text"
|
||||
},
|
||||
"note": {
|
||||
"ignore": true,
|
||||
"number-append": "",
|
||||
"number-divisor": 0,
|
||||
"number-format": "auto",
|
||||
"number-prepend": "",
|
||||
"type": "auto"
|
||||
},
|
||||
"time": {
|
||||
"ignore": false,
|
||||
"number-append": "",
|
||||
"number-divisor": 0,
|
||||
"number-format": "auto",
|
||||
"number-prepend": "",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"horizontal-header": true,
|
||||
"transpose": false,
|
||||
"upload-method": "copy",
|
||||
"vertical-header": true
|
||||
},
|
||||
"describe": {
|
||||
"byline": "",
|
||||
"computed-columns": [
|
||||
{
|
||||
"formula": "DATE(NUMBER(SUBSTR(date, 0, 4)), NUMBER(SUBSTR(date, 5, 2)), NUMBER(SUBSTR(date, 8, 2)))",
|
||||
"name": "date_parsed"
|
||||
},
|
||||
{
|
||||
"formula": "NUMBER(SUBSTR(time, 0, 2)) * 60 + NUMBER(SUBSTR(time, 3, 5)) + NUMBER(SUBSTR(time, 6, 8)) * 0.01",
|
||||
"name": "time_sec"
|
||||
},
|
||||
{
|
||||
"formula": "time_sec / distance",
|
||||
"name": "sec_per_km_float"
|
||||
},
|
||||
{
|
||||
"formula": "TRUNC(ROUND(sec_per_km_float) / 60)",
|
||||
"name": "min_per_km"
|
||||
},
|
||||
{
|
||||
"formula": "ROUND(sec_per_km_float) % 60",
|
||||
"name": "sec_per_km"
|
||||
},
|
||||
{
|
||||
"formula": "CONCAT(IF(min_per_km < 10, 0), min_per_km, \":\", IF(sec_per_km < 10, 0), sec_per_km)",
|
||||
"name": "time_per_km_str"
|
||||
}
|
||||
],
|
||||
"intro": "",
|
||||
"number-append": "",
|
||||
"number-divisor": 0,
|
||||
"number-format": "-",
|
||||
"number-prepend": "",
|
||||
"source-name": "",
|
||||
"source-url": ""
|
||||
},
|
||||
"publish": {
|
||||
"chart-height": 460.5,
|
||||
"embed-height": 500,
|
||||
"embed-width": 1000
|
||||
},
|
||||
"visualize": {
|
||||
"area-fill-color-below": "#cccccc",
|
||||
"area-fill-color-between": "#cccccc",
|
||||
"auto-labels": true,
|
||||
"base-color": 0,
|
||||
"chart-type-set": true,
|
||||
"color-base": "#47b641",
|
||||
"color-key": {
|
||||
"base": {
|
||||
"color": "#47b641",
|
||||
"def_lbl": "base",
|
||||
"label": "base"
|
||||
}
|
||||
},
|
||||
"connector-lines": true,
|
||||
"custom-area-fills": [],
|
||||
"custom-colors": [],
|
||||
"custom-range-x": ["", ""],
|
||||
"custom-range-y": ["", ""],
|
||||
"custom-ticks-x": "",
|
||||
"custom-ticks-y": "",
|
||||
"fill-below": false,
|
||||
"fill-between": false,
|
||||
"highlight-labeled": false,
|
||||
"highlighted-series": [],
|
||||
"highlighted-values": [],
|
||||
"interpolation": "linear",
|
||||
"label-colors": false,
|
||||
"label-margin": 0,
|
||||
"labeling": "right",
|
||||
"line-dashes": [],
|
||||
"line-symbols": false,
|
||||
"line-symbols-on": "both",
|
||||
"line-symbols-opacity": 1,
|
||||
"line-symbols-shape": "circle",
|
||||
"line-symbols-shape-multiple": [],
|
||||
"line-symbols-size": 3.5,
|
||||
"line-value-labels": false,
|
||||
"line-widths": [],
|
||||
"outlines": false,
|
||||
"regression": false,
|
||||
"regression-method": "linear",
|
||||
"scale-y": "linear",
|
||||
"shape": "fixed",
|
||||
"show-tooltips": true,
|
||||
"sticky-tooltips": false,
|
||||
"text-annotations": [],
|
||||
"tooltip": {
|
||||
"body": "<b>date:</b> {{ date }}<br>\n<b>distance:</b> {{ distance }} km<br>\n<b>track:</b> {{ track }}<br>\n<b>time:</b> {{ time }}<br>\n<b>rank:</b> {{ rank }}",
|
||||
"fields": {
|
||||
"date": "date",
|
||||
"date_parsed": "date_parsed",
|
||||
"distance": "distance",
|
||||
"min_per_km": "min_per_km",
|
||||
"rank": "rank",
|
||||
"sec_per_km": "sec_per_km",
|
||||
"sec_per_km_float": "sec_per_km_float",
|
||||
"time": "time",
|
||||
"time_per_km_str": "time_per_km_str",
|
||||
"time_sec": "time_sec",
|
||||
"track": "track"
|
||||
},
|
||||
"title": "{{ time_per_km_str }} min/km"
|
||||
},
|
||||
"tooltip-number-format": "0,0.[00]",
|
||||
"x-axis": {
|
||||
"range": null
|
||||
},
|
||||
"x-format": "YYYY|MMM",
|
||||
"x-grid": "off",
|
||||
"x-grid-lines": "on",
|
||||
"x-tick-format": "YYYY",
|
||||
"y-axis": {
|
||||
"range": [0, 500]
|
||||
},
|
||||
"y-format": "0",
|
||||
"y-grid": "on",
|
||||
"y-grid-format": "0,0.[00]",
|
||||
"y-grid-label-align": "left",
|
||||
"y-grid-labels": "auto",
|
||||
"y-grid-lines": "on",
|
||||
"y-grid-subdivide": true,
|
||||
"y-pos": "left"
|
||||
}
|
||||
},
|
||||
"title": "Running",
|
||||
"type": "d3-scatter-plot"
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: ${0##} <chart json path>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$API_URL" ]]; then
|
||||
echo "Environment variable API_URL must be defined" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$AUTH_TOKEN" ]]; then
|
||||
echo "Environment variable AUTH_TOKEN must be defined" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chart_id=$1
|
||||
chart_json_path=$2
|
||||
|
||||
set -x
|
||||
curl -X POST "$API_URL/v3/charts" \
|
||||
-H "Authorization:Bearer $AUTH_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "@$chart_json_path" | jq
|
@ -0,0 +1,59 @@
|
||||
date,distance,time,track,rank
|
||||
2018-11-05 Mon,7.546,36:41.69,Tempelhof,29
|
||||
2018-11-09 Fri,7.546,35:49.62,Tempelhof,13
|
||||
2018-11-12 Mon,7.546,37:07.44,Tempelhof,37
|
||||
2018-11-14 Wed,7.546,36:02.69,Tempelhof,18
|
||||
2018-11-16 Wed,7.546,36:01.94,Tempelhof,16
|
||||
2018-11-19 Mon,7.546,35:18.07,Tempelhof,6
|
||||
2018-11-23 Fri,7.546,37:18.25,Tempelhof,40
|
||||
2018-11-25 Sun,7.546,37:07.50,Tempelhof,38
|
||||
2018-12-01 Sat,7.546,39:49.50,Tempelhof,57
|
||||
2018-12-07 Fri,7.546,38:32.50,Tempelhof,50
|
||||
2018-12-28 Fri,7.546,37:55.62,Tempelhof,44
|
||||
2019-01-03 Thu,7.546,37:10.12,Tempelhof,39
|
||||
2019-01-18 Fri,7.546,38:40.19,Tempelhof,53
|
||||
2019-01-22 Tue,7.546,37:02.31,Tempelhof,35
|
||||
2019-01-28 Mon,7.546,37:22.06,Tempelhof,42
|
||||
2019-01-29 Tue,7.546,36:49.12,Tempelhof,32
|
||||
2019-02-06 Wed,7.546,36:58.57,Tempelhof,34
|
||||
2019-02-21 Thu,7.546,35:26.13,Tempelhof,8
|
||||
2019-02-28 Thu,7.546,34:51.56,Tempelhof,2
|
||||
2019-03-07 Thu,7.546,35:26.50,Tempelhof,9
|
||||
2019-04-15 Mon,7.546,38:41.13,Tempelhof,55
|
||||
2019-04-22 Mon,7.546,36:56.50,Tempelhof,33
|
||||
2019-12-10 Tue,7.546,38:11.86,Tempelhof,47
|
||||
2020-05-13 Wed,7.546,40:37.43,Tempelhof,58
|
||||
2020-05-26 Tue,7.546,38:28.96,Tempelhof,48
|
||||
2020-05-28 Thu,7.546,38:52.86,Tempelhof,56
|
||||
2020-06-02 Tue,7.546,38:29.72,Tempelhof,49
|
||||
2020-06-04 Thu,7.546,38:34.35,Tempelhof,52
|
||||
2020-06-09 Tue,7.546,37:23.97,Tempelhof,43
|
||||
2020-06-11 Thu,7.546,36:32.25,Tempelhof,27
|
||||
2020-06-15 Mon,7.546,36:11.22,Tempelhof,21
|
||||
2020-06-18 Thu,7.546,36:20.99,Tempelhof,23
|
||||
2020-06-24 Wed,7.546,36:33.53,Tempelhof,28
|
||||
2020-06-26 Fri,7.546,38:11.44,Tempelhof,46
|
||||
2020-06-28 Sun,7.546,37:58.79,Tempelhof,45
|
||||
2020-07-08 Wed,7.546,35:53.82,Tempelhof,14
|
||||
2020-07-10 Fri,7.546,35:07.92,Tempelhof,4
|
||||
2020-07-14 Tue,7.546,38:33.50,Tempelhof,51
|
||||
2020-07-16 Thu,7.546,35:05.28,Tempelhof,3
|
||||
2020-07-21 Tue,7.546,36:27.61,Tempelhof,24
|
||||
2020-07-23 Thu,7.546,35:46.65,Tempelhof,11
|
||||
2020-07-28 Tue,7.546,36:48.23,Tempelhof,31
|
||||
2020-07-30 Thu,7.546,36:01.91,Tempelhof,15
|
||||
2020-08-07 Fri,7.546,38:41.11,Tempelhof,54
|
||||
2020-09-03 Thu,7.546,37:21.99,Tempelhof,41
|
||||
2020-09-08 Tue,7.546,36:06.89,Tempelhof,20
|
||||
2020-09-10 Thu,7.546,34:12.90,Tempelhof,1
|
||||
2020-09-17 Thu,7.546,36:02.63,Tempelhof,17
|
||||
2020-09-22 Tue,7.546,36:32.15,Tempelhof,26
|
||||
2020-09-24 Thu,7.546,36:04.56,Tempelhof,19
|
||||
2020-10-06 Tue,7.546,35:40.55,Tempelhof,10
|
||||
2020-10-09 Fri,7.546,35:07.97,Tempelhof,5
|
||||
2020-10-13 Tue,7.546,37:05.52,Tempelhof,36
|
||||
2020-10-15 Thu,7.546,36:47.64,Tempelhof,30
|
||||
2020-10-20 Tue,7.546,36:30.38,Tempelhof,25
|
||||
2020-10-24 Sat,7.546,35:25.75,Tempelhof,7
|
||||
2020-10-27 Tue,7.546,35:47.90,Tempelhof,12
|
||||
2020-10-29 Thu,7.546,36:18.61,Tempelhof,22
|
|
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $# -ne 2 ]]; then
|
||||
echo "Usage: ${0##} <chart id> <chart json path>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$API_URL" ]]; then
|
||||
echo "Environment variable API_URL must be defined" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$AUTH_TOKEN" ]]; then
|
||||
echo "Environment variable AUTH_TOKEN must be defined" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chart_id=$1
|
||||
chart_json_path=$2
|
||||
|
||||
set -x
|
||||
curl -X PATCH "$API_URL/v3/charts/$chart_id" \
|
||||
-H "Authorization:Bearer $AUTH_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "@$chart_json_path" | jq
|
Loading…
Reference in New Issue