Weight / Pressure Log
·3 mins
Weight #
Weight | Date | Time |
---|---|---|
195.2 | 2024-09-12 | 15:40 |
199.4 | 2024-08-01 | 06:14 |
198.6 | 2024-07-31 | 06:29 |
198.8 | 2024-07-30 | 06:49 |
197.6 | 2024-07-29 | 07:01 |
176.8 | 2024-07-28 | 07:58 |
196.0 | 2024-07-27 | 12:08 |
198.6 | 2024-07-26 | 13:05 |
200.0 | 2024-07-18 | 08:15 |
198.0 | 2024-07-16 | 07:34 |
201.4 | 2024-07-16 | 07:32 |
197 | 2024-07-11 | 15:02 |
196 | 2024-07-09 | 04:35 |
196.0 | 2024-07-08 | 07:38 |
196.6 | 2024-07-07 | 07:38 |
197.6 | 2024-07-05 | 09:14 |
193 | 2024-06-28 | 07:06 |
194.6 | 2024-06-27 | 08:21 |
199.8 | 2024-01-07 | 06:33 |
200.0 | 2024-01-06 | 08:02 |
197.2 | 2024-01-05 | 05:38 |
201.2 | 2024-01-03 | 07:57 |
199.2 | 2024-01-01 | 06:42 |
198.2 | 2023-12-31 | 06:54 |
195.0 | 2023-12-30 | 08:03 |
196.0 | 2023-12-29 | 04:39 |
196.8 | 2023-12-28 | 08:52 |
197.6 | 2023-12-27 | 06:08 |
196.4 | 2023-12-26 | 07:42 |
193.6 | 2023-12-25 | 05:32 |
192.4 | 2023-12-24 | 05:08 |
194.0 | 2023-12-22 | 04:33 |
192.4 | 2023-12-21 | 03:58 |
194.2 | 2023-12-20 | 10:20 |
193.4 | 2023-12-19 | 04:07 |
191.0 | 2023-12-14 | 06:50 |
191.4 | 2023-12-14 | 04:44 |
BP #
Systolic | Diastolic | BP | Date | Time |
---|---|---|---|---|
118 | 67 | 85 | 2024-09-12 | 15:39 |
126 | 76 | 52 | 2024-08-01 | 06:11 |
107 | 67 | 73 | 2024-07-31 | 06:15 |
131 | 72 | 56 | 2024-07-30 | 06:49 |
116 | 73 | 60 | 2024-07-29 | 07:20 |
127 | 76 | 58 | 2024-07-28 | 07:58 |
128 | 75 | 69 | 2024-07-27 | 12:07 |
124 | 74 | 70 | 2024-07-26 | 13:05 |
125 | 73 | 63 | 2024-07-18 | 08:14 |
116 | 75 | 53 | 2024-07-16 | 07:33 |
142 | 78 | 55 | 2024-07-16 | 07:32 |
113 | 62 | 64 | 2024-07-11 | 15:02 |
109 | 67 | 58 | 2024-07-09 | 04:35 |
102 | 59 | 56 | 2024-07-08 | 07:37 |
109 | 66 | 66 | 2024-07-07 | 07:38 |
103 | 63 | 60 | 2024-07-05 | 09:14 |
110 | 66 | 58 | 2024-06-28 | 07:05 |
119 | 72 | 68 | 2024-06-27 | 08:23 |
125 | 74 | 53 | 2024-01-06 | 09:09 |
107 | 65 | 78 | 2024-01-05 | 07:58 |
119 | 73 | 55 | 2024-01-03 | 07:59 |
122 | 74 | 56 | 2024-01-01 | 06:42 |
129 | 79 | 53 | 2023-12-31 | 06:55 |
112 | 72 | 64 | 2023-12-30 | 08:08 |
110 | 62 | 60 | 2023-12-28 | 08:57 |
109 | 67 | 57 | 2023-12-27 | 07:27 |
107 | 70 | 56 | 2023-12-26 | 07:39 |
102 | 57 | 55 | 2023-12-25 | 07:57 |
110 | 67 | 59 | 2023-12-22 | 09:59 |
116 | 69 | 59 | 2023-12-21 | 05:26 |
106 | 63 | 55 | 2023-12-20 | 11:08 |
110 | 65 | 52 | 2023-12-18 | 07:02 |
108 | 74 | 61 | 2023-12-18 | 05:38 |
123 | 77 | 55 | 2023-12-14 | 05:32 |
The Code #
On this project I attemp to use the Unix Philosophy and also only the Python Standard Library. So at time of writing there are two separate modules for capturing weight (weight.py), and blood pressure / heart rate readings (bp.py). Those record the data in simple .csv files. A separate script (make_table.py) generates markdown tables for each of the .csv files. Last, a script to copy the markdown tables to the appropriate Hugo directory where they are included in creation of the final page. link here.
#!/usr/bin/python3
import sys
import subprocess
from datetime import datetime
"""
get weight as command line argument. Format as Weight, Date, Time and
store in csv file. Note no header in csv file.
"""
def get_weight(weight):
date = datetime.now().strftime("%Y-%m-%d")
time = datetime.now().strftime("%H:%M")
weight = f"{weight}, {date}, {time} \n"
print ("Weight: ",weight)
# write it out to csv file
with open('weight.txt', 'a') as outfile:
outfile.write(weight)
# put in reverse chronological order using linux tac
with open('revweight.txt', 'w') as outfile:
subprocess.run(['tac', 'weight.txt'], stdout=outfile)
if __name__ == "__main__":
if len(sys.argv) < 2:
print("no argument passed")
weight = input("Enter weight: ")
get_weight(weight)
else:
get_weight(sys.argv[1])