radboy 0.0.453__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.

@@ -23,6 +23,7 @@ from datetime import *
23
23
  from colored import Style,Fore
24
24
  import json,sys,math,re,calendar
25
25
  import plotext as plt
26
+ import pint_pandas
26
27
 
27
28
  class HealthLogUi:
28
29
  def new_health_log(self):
@@ -257,18 +258,116 @@ class HealthLogUi:
257
258
  HealthLog.metadata.create_all(ENGINE)
258
259
 
259
260
 
260
- def GraphIt(self,query,session,fields=['BloodSugar','HeartRate'],errors=False):
261
+ def GraphIt(self,query,session,fields=['BloodSugar','HeartRate'],errors=True):
261
262
  while True:
262
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}")
263
264
  df_from_records = pd.read_sql_query(query.statement,session.bind)
264
265
 
265
266
  for num,field in enumerate(fields):
266
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)
267
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
+
268
337
  df_from_records['DTOES']=df_from_records['DTOE'].dt.strftime("%d/%m/%Y")
269
- plt.bar(df_from_records['DTOES'],df_from_records[field],label=f'Original Data From {field}')
338
+ plt.scatter(df_from_records['DTOES'],df_from_records[field],label=f'Maxes {field}')
270
339
  plt.show()
271
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)
272
371
  except Exception as ee:
273
372
  if errors:
274
373
  print(ee,repr(ee))
@@ -284,6 +383,7 @@ class HealthLogUi:
284
383
 
285
384
  def showAllField(self,fields=[],not_none=[]):
286
385
  try:
386
+ gf=fields
287
387
  fields.extend(["DTOE","HLID","Comments"])
288
388
  fields=[i for i in HealthLog.__table__.columns if str(i.name) in fields]
289
389
  not_none=[i for i in HealthLog.__table__.columns if str(i.name) in not_none]
@@ -300,8 +400,8 @@ class HealthLogUi:
300
400
 
301
401
  if graph_it:
302
402
  includes=["int","integer","float","decimal"]
303
- excludes=["HLID"]
304
- fields_for_total=[str(i.name) for i in HealthLog.__table__.columns if str(i.type).lower() in includes and str(i.name) not in excludes]
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]
305
405
  print(fields_for_total)
306
406
  x=self.GraphIt(results,session,fields_for_total)
307
407
  if x is None:
radboy/__init__.py CHANGED
@@ -1 +1 @@
1
- VERSION='0.0.453'
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.453
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=YIIE0dx91_OPurQKy1Q-WxOwYPDTia3yRy0tAE-yx8E,17
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=KnSICUMVXSCiCjm_6CbLRuMbq1s9jgdRuz8TRz6P3u8,21699
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=dczFzFfVQ7C3z5R7_Kb1Nl9TV6zECpyzYWQN4vAhQLE,35350
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=5AaQd_fHz3oVYXyq4XpB4QSlF6WKQYjNBUhy32RBDYw,165
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.453.dist-info/METADATA,sha256=x43yjYeZlZDvFigqWiQLyM8t2N4gOtgrIZNiU8WUT8w,1574
423
- radboy-0.0.453.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
424
- radboy-0.0.453.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
425
- radboy-0.0.453.dist-info/RECORD,,
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,,