radboy 0.0.452__py3-none-any.whl → 0.0.454__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of radboy might be problematic. Click here for more details.
- radboy/HealthLog/HealthLog.py +144 -0
- radboy/HealthLog/__pycache__/HealthLog.cpython-313.pyc +0 -0
- radboy/__init__.py +1 -1
- radboy/__pycache__/__init__.cpython-313.pyc +0 -0
- {radboy-0.0.452.dist-info → radboy-0.0.454.dist-info}/METADATA +2 -1
- {radboy-0.0.452.dist-info → radboy-0.0.454.dist-info}/RECORD +8 -8
- {radboy-0.0.452.dist-info → radboy-0.0.454.dist-info}/WHEEL +0 -0
- {radboy-0.0.452.dist-info → radboy-0.0.454.dist-info}/top_level.txt +0 -0
radboy/HealthLog/HealthLog.py
CHANGED
|
@@ -22,6 +22,8 @@ import numpy as np
|
|
|
22
22
|
from datetime import *
|
|
23
23
|
from colored import Style,Fore
|
|
24
24
|
import json,sys,math,re,calendar
|
|
25
|
+
import plotext as plt
|
|
26
|
+
import pint_pandas
|
|
25
27
|
|
|
26
28
|
class HealthLogUi:
|
|
27
29
|
def new_health_log(self):
|
|
@@ -255,14 +257,156 @@ class HealthLogUi:
|
|
|
255
257
|
HealthLog.__table__.drop(ENGINE)
|
|
256
258
|
HealthLog.metadata.create_all(ENGINE)
|
|
257
259
|
|
|
260
|
+
|
|
261
|
+
def GraphIt(self,query,session,fields=['BloodSugar','HeartRate'],errors=True):
|
|
262
|
+
while True:
|
|
263
|
+
print(f"{Fore.light_magenta}Dates on the Graph(s) are in the format of {Fore.orange_red_1}Day/Month/Year{Fore.light_magenta}, whereas Date Input will remain {Fore.light_steel_blue}Month/Day/Year{Style.reset}")
|
|
264
|
+
df_from_records = pd.read_sql_query(query.statement,session.bind)
|
|
265
|
+
|
|
266
|
+
for num,field in enumerate(fields):
|
|
267
|
+
try:
|
|
268
|
+
if 'DrugQtyConsumed' == field:
|
|
269
|
+
names=df_from_records['DrugConsumed'].unique()
|
|
270
|
+
for name in names:
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
q=session.query(HealthLog).filter(and_(HealthLog.DrugConsumed==name,HealthLog.DrugQtyConsumed!=None))
|
|
274
|
+
dfTmp=pd.read_sql_query(q.statement,session.bind)
|
|
275
|
+
|
|
276
|
+
dfTmp['DTOES']=dfTmp['DTOE'].dt.strftime("%d/%m/%Y")
|
|
277
|
+
z=[[v,u] for v,u in zip(dfTmp[field],dfTmp['DrugQtyConsumedUnitName'])]
|
|
278
|
+
units=[i for i in dfTmp['DrugQtyConsumedUnitName'].unique()]
|
|
279
|
+
for i in z:
|
|
280
|
+
print(pint.Quantity(i[0],i[1]).magnitude,i[-1])
|
|
281
|
+
unit=''
|
|
282
|
+
|
|
283
|
+
while True:
|
|
284
|
+
try:
|
|
285
|
+
unit=Prompt.__init2__(self,func=FormBuilderMkText,ptext=f"unit of measure to convert all to?[{units}]",helpText=f"{units}",data="string")
|
|
286
|
+
if unit is None:
|
|
287
|
+
return
|
|
288
|
+
elif unit in ['d',]:
|
|
289
|
+
unit="milligram"
|
|
290
|
+
if unit not in units:
|
|
291
|
+
continue
|
|
292
|
+
|
|
293
|
+
dfTmp['qty']=[pint.Quantity(v,u).to(unit).magnitude for v,u in zip(dfTmp[field],dfTmp['DrugQtyConsumedUnitName']) ]
|
|
294
|
+
break
|
|
295
|
+
except Exception as e:
|
|
296
|
+
print(e)
|
|
297
|
+
barLabel=f'Maxes {field}:{name} {unit}'
|
|
298
|
+
plt.bar(dfTmp['DTOES'],dfTmp['qty'],label=barLabel)
|
|
299
|
+
plt.show()
|
|
300
|
+
plt.clf()
|
|
301
|
+
print(f"{Fore.orange_red_1}{barLabel}{Style.reset}")
|
|
302
|
+
|
|
303
|
+
plt.scatter(dfTmp['DTOES'],dfTmp['qty'],label=barLabel)
|
|
304
|
+
plt.show()
|
|
305
|
+
plt.clf()
|
|
306
|
+
print(f"{Fore.orange_red_1}{barLabel}{Style.reset}")
|
|
307
|
+
try:
|
|
308
|
+
mx=int(dfTmp['qty'].max())
|
|
309
|
+
multiplier=1
|
|
310
|
+
while mx < 1:
|
|
311
|
+
multiplier*=10
|
|
312
|
+
mx=int(dfTmp['qty'].max()*multiplier)
|
|
313
|
+
histoLabel=f"{multiplier}X -> Histogram {field}:{name}"
|
|
314
|
+
bins=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Histogram Bins[5]",helpText="5",data="integer")
|
|
315
|
+
if bins is None:
|
|
316
|
+
return
|
|
317
|
+
elif bins in ['d',]:
|
|
318
|
+
bins=5
|
|
319
|
+
plt.hist(dfTmp['qty'],bins=bins,label=histoLabel)
|
|
320
|
+
plt.show()
|
|
321
|
+
plt.clf()
|
|
322
|
+
print(f"{Fore.magenta}{histoLabel}total Entry Data Points = {len(dfTmp[field])}{Style.reset}")
|
|
323
|
+
except Exception as e:
|
|
324
|
+
if errors:
|
|
325
|
+
print(e)
|
|
326
|
+
|
|
327
|
+
barLabel=f'Maxes {field} TotalView:Bar'
|
|
328
|
+
|
|
329
|
+
df_from_records['DTOES']=df_from_records['DTOE'].dt.strftime("%d/%m/%Y")
|
|
330
|
+
plt.bar(df_from_records['DTOES'],df_from_records[field],label=f'Maxes {field}')
|
|
331
|
+
plt.show()
|
|
332
|
+
plt.clf()
|
|
333
|
+
print(f"{Fore.light_green}{barLabel}{Style.reset}")
|
|
334
|
+
|
|
335
|
+
barLabel=f'Maxes {field} TotalView:Scatter'
|
|
336
|
+
|
|
337
|
+
df_from_records['DTOES']=df_from_records['DTOE'].dt.strftime("%d/%m/%Y")
|
|
338
|
+
plt.scatter(df_from_records['DTOES'],df_from_records[field],label=f'Maxes {field}')
|
|
339
|
+
plt.show()
|
|
340
|
+
plt.clf()
|
|
341
|
+
print(f"{Fore.light_green}{barLabel}{Style.reset}")
|
|
342
|
+
'''print(f"{Fore.light_steel_blue}{histoLabel}{Style.reset}")
|
|
343
|
+
plt.hist(df_from_records[field],df_from_records[field].max(),label=f"Histogram {field}")
|
|
344
|
+
plt.show()
|
|
345
|
+
plt.clf()'''
|
|
346
|
+
mx=-1
|
|
347
|
+
mx=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Histogram Bins[5]",helpText="5",data="integer")
|
|
348
|
+
if mx is None:
|
|
349
|
+
return
|
|
350
|
+
elif mx in ['d',]:
|
|
351
|
+
mx=5
|
|
352
|
+
|
|
353
|
+
try:
|
|
354
|
+
if mx == -1:
|
|
355
|
+
mx=int(df_from_records[field].max())
|
|
356
|
+
multiplier=1
|
|
357
|
+
while mx < 1:
|
|
358
|
+
multiplier*=10
|
|
359
|
+
mx=int(df_from_records[field].max()*multiplier)
|
|
360
|
+
histoLabel=f"{multiplier}X -> Histogram {field}"
|
|
361
|
+
else:
|
|
362
|
+
histoLabel=f"Histogram {field}"
|
|
363
|
+
|
|
364
|
+
plt.hist(df_from_records[field],mx,label=histoLabel)
|
|
365
|
+
plt.show()
|
|
366
|
+
plt.clf()
|
|
367
|
+
print(f"{Fore.magenta}{histoLabel} total Entry Data Points = {len(df_from_records[field])} {Style.reset}")
|
|
368
|
+
except Exception as e:
|
|
369
|
+
if errors:
|
|
370
|
+
print(e)
|
|
371
|
+
except Exception as ee:
|
|
372
|
+
if errors:
|
|
373
|
+
print(ee,repr(ee))
|
|
374
|
+
else:
|
|
375
|
+
pass
|
|
376
|
+
print(f"{Fore.light_magenta}Dates on the Graph(s) are in the format of {Fore.orange_red_1}Day/Month/Year{Fore.light_magenta}, whereas Date Input will remain {Fore.light_steel_blue}Month/Day/Year{Style.reset}")
|
|
377
|
+
n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="next y/n",data="boolean")
|
|
378
|
+
if n in ['None',]:
|
|
379
|
+
return None
|
|
380
|
+
elif n in [True,]:
|
|
381
|
+
return True
|
|
382
|
+
|
|
383
|
+
|
|
258
384
|
def showAllField(self,fields=[],not_none=[]):
|
|
259
385
|
try:
|
|
386
|
+
gf=fields
|
|
260
387
|
fields.extend(["DTOE","HLID","Comments"])
|
|
261
388
|
fields=[i for i in HealthLog.__table__.columns if str(i.name) in fields]
|
|
262
389
|
not_none=[i for i in HealthLog.__table__.columns if str(i.name) in not_none]
|
|
263
390
|
with Session(ENGINE) as session:
|
|
264
391
|
results=session.query(HealthLog).filter(or_(*[i!=None for i in not_none]))
|
|
265
392
|
results=orderQuery(results,HealthLog.DTOE)
|
|
393
|
+
|
|
394
|
+
graph_it=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Graph Results (if possible)[y/N]:",helpText="yes or no; default is No.",data="boolean")
|
|
395
|
+
|
|
396
|
+
if graph_it in [None,]:
|
|
397
|
+
return
|
|
398
|
+
elif graph_it in ['d',]:
|
|
399
|
+
graph_it=False
|
|
400
|
+
|
|
401
|
+
if graph_it:
|
|
402
|
+
includes=["int","integer","float","decimal"]
|
|
403
|
+
excludes=["HLID","EntryId"]
|
|
404
|
+
fields_for_total=[i.name for i in HealthLog.__table__.columns if i.name in gf and str(i.type).lower() in includes and i.name not in excludes]
|
|
405
|
+
print(fields_for_total)
|
|
406
|
+
x=self.GraphIt(results,session,fields_for_total)
|
|
407
|
+
if x is None:
|
|
408
|
+
return
|
|
409
|
+
|
|
266
410
|
results=results.all()
|
|
267
411
|
ct=len(results)
|
|
268
412
|
for num,i in enumerate(results):
|
|
Binary file
|
radboy/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION='0.0.
|
|
1
|
+
VERSION='0.0.454'
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: radboy
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.454
|
|
4
4
|
Summary: A small example package
|
|
5
5
|
Author: Carl Joseph Hirner III
|
|
6
6
|
Author-email: Carl Hirner III <k.j.hirner.wisdom@gmail.com>
|
|
@@ -43,6 +43,7 @@ Requires-Dist: beautifulsoup4
|
|
|
43
43
|
Requires-Dist: pycryptodome
|
|
44
44
|
Requires-Dist: forecast_weather
|
|
45
45
|
Requires-Dist: boozelib
|
|
46
|
+
Requires-Dist: pint_pandas
|
|
46
47
|
Dynamic: author
|
|
47
48
|
Dynamic: requires-python
|
|
48
49
|
|
|
@@ -5,7 +5,7 @@ radboy/Holidays.txt,sha256=y-JZPihh5iaWKxMIHNXD39yVuVmf1vMs4FdNDcg0f1Y,3114
|
|
|
5
5
|
radboy/InventoryGlossary.txt,sha256=018-Yqca6DFb10jPdkUY-5qhkRlQN1k3rxoTaERQ-LA,91008
|
|
6
6
|
radboy/RecordMyCodes.py,sha256=dOm24buf-rWC4FGLQLDjL5obdxOKF3D01t6Qkkit-R0,41421
|
|
7
7
|
radboy/Run.py,sha256=JUoCTHnzQBv7n8PB2_i93ANdAC_iW__RkAge8esCnk4,76
|
|
8
|
-
radboy/__init__.py,sha256=
|
|
8
|
+
radboy/__init__.py,sha256=fzYy5PwPeh0IUCbyPE89DZkSsP2tm2WS_a7mag9kL6k,17
|
|
9
9
|
radboy/api_key,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
radboy/case-export-2024-05-14-13-10-00.672971.xlsx,sha256=Wd592d_VLFmfUI9KKKSVjNwjV91euc1T7ATyvwvUhlg,5431
|
|
11
11
|
radboy/case-export-2024-05-14-13-13-22.540614.xlsx,sha256=OnGrhmScHfGp_mVaWW-LNMsqrQgyZDpiU3wV-2s3U5Q,5556
|
|
@@ -210,10 +210,10 @@ radboy/GeoTools/__pycache__/GeoClass.cpython-313.pyc,sha256=eZ6hpLKoic1XCb7BKKg-
|
|
|
210
210
|
radboy/GeoTools/__pycache__/OSMClass.cpython-312.pyc,sha256=5RoT8_wiI8R7yb_B9FWIC7mALdGNoqyWtkzsjM2pbh0,40387
|
|
211
211
|
radboy/GeoTools/__pycache__/__init__.cpython-312.pyc,sha256=Y7Xtrzwm44-xuY_4NK8aDjYfVmXIzUFWOyexJu9le8A,1238
|
|
212
212
|
radboy/GeoTools/__pycache__/__init__.cpython-313.pyc,sha256=-bk9eEIxWZgHYZHtNJbrpubDRWkbdYNkGr5J7sVhyIE,1238
|
|
213
|
-
radboy/HealthLog/HealthLog.py,sha256=
|
|
213
|
+
radboy/HealthLog/HealthLog.py,sha256=kJq3AVcHdHXZ0U1FzRMK24VtxrOX1ttHGyG68XaN1_U,25276
|
|
214
214
|
radboy/HealthLog/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
215
215
|
radboy/HealthLog/__pycache__/HealthLog.cpython-312.pyc,sha256=hTo4o7jo9L2yqPZgzuKUw_kon_PVcCuTRguELTuLrIo,27946
|
|
216
|
-
radboy/HealthLog/__pycache__/HealthLog.cpython-313.pyc,sha256=
|
|
216
|
+
radboy/HealthLog/__pycache__/HealthLog.cpython-313.pyc,sha256=09nBhRvpu-ePOL-z-1i_zEzG56DYVmLWacx37-I_IIs,40792
|
|
217
217
|
radboy/HealthLog/__pycache__/__init__.cpython-312.pyc,sha256=yZrYKBk31pGSjCRqmqzpX409iw-muC1zsNO2ObqkGlY,272
|
|
218
218
|
radboy/HealthLog/__pycache__/__init__.cpython-313.pyc,sha256=cqdZbEJKq9XVoVqDAwsW0pwwBBGSerJNWGlST3YVR3g,151
|
|
219
219
|
radboy/InListRestore/ILR.py,sha256=s8fbbHLKQSVJX1VaeyGE-vdIUGBEbOPX29kRIG2j2WY,16847
|
|
@@ -394,7 +394,7 @@ radboy/__pycache__/Run.cpython-311.pyc,sha256=G_UEfMtkLRjR6ZpGA_BJzGenuaCcP469Y9
|
|
|
394
394
|
radboy/__pycache__/Run.cpython-312.pyc,sha256=v4xolc3mHyla991XhpYBUbBHYT0bnJ1gE-lkFoQ4GFA,241
|
|
395
395
|
radboy/__pycache__/__init__.cpython-311.pyc,sha256=R-DVbUioMOW-Fnaq7FpT5F1a5p0q3b_RW-HpLRArCAY,242
|
|
396
396
|
radboy/__pycache__/__init__.cpython-312.pyc,sha256=FsFzLXOlTK8_7ixoPZzakkR8Wibt-DvXLFh-oG2QlPw,164
|
|
397
|
-
radboy/__pycache__/__init__.cpython-313.pyc,sha256=
|
|
397
|
+
radboy/__pycache__/__init__.cpython-313.pyc,sha256=mZcf2EOpcmXvU0oyOWeRYaF37nr9qFcuIyHHiaruZ7E,165
|
|
398
398
|
radboy/__pycache__/__init__.cpython-39.pyc,sha256=D48T6x6FUeKPfubo0sdS_ZUut3FmBvPMP7qT6rYBZzU,275
|
|
399
399
|
radboy/__pycache__/possibleCode.cpython-311.pyc,sha256=zFiHyzqD8gUnIWu4vtyMYIBposiRQqaRXfcT_fOl4rU,20882
|
|
400
400
|
radboy/__pycache__/possibleCode.cpython-312.pyc,sha256=tk_CO-AcsO3YZj5j6vEsw3g37UmEzWc5YgeWEoJEUg4,27922
|
|
@@ -419,7 +419,7 @@ radboy/tkGui/Images/__pycache__/__init__.cpython-311.pyc,sha256=tXBYpqbOlZ24B1BI
|
|
|
419
419
|
radboy/tkGui/__pycache__/BeginnersLuck.cpython-311.pyc,sha256=xLQOnV1wuqHGaub16mPX0dDMGU9ryCeLtNz5e517_GE,3004
|
|
420
420
|
radboy/tkGui/__pycache__/Review.cpython-311.pyc,sha256=wKq24iM6Xe2OampgZ7-8U6Nvmgs2y-qWOrGwtWhc75k,4047
|
|
421
421
|
radboy/tkGui/__pycache__/__init__.cpython-311.pyc,sha256=BX7DBn5qbvKTvlrKOP5gzTBPBTeTgSMjBW6EMl7N8e0,230
|
|
422
|
-
radboy-0.0.
|
|
423
|
-
radboy-0.0.
|
|
424
|
-
radboy-0.0.
|
|
425
|
-
radboy-0.0.
|
|
422
|
+
radboy-0.0.454.dist-info/METADATA,sha256=gt0a9gRPA7RqIRwnFP538xpoR9gRKU7h1oY0b0tRgF8,1601
|
|
423
|
+
radboy-0.0.454.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
424
|
+
radboy-0.0.454.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
|
|
425
|
+
radboy-0.0.454.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|