vikramvasudevan commited on
Commit
636f977
·
verified ·
1 Parent(s): 10882ae

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. plot_helper.py +1 -2
  2. ui.py +6 -3
plot_helper.py CHANGED
@@ -6,7 +6,6 @@ import datetime as dt
6
  import numpy as np
7
  import pandas as pd
8
  from common import get_db
9
- from ui import disable_component
10
  import plotly.express as px
11
 
12
  MAX_CHARTS_IN_PAGE = 40
@@ -168,7 +167,7 @@ async def reset_trends():
168
  page = 0
169
  page_info = "Page 0 / 0"
170
 
171
- return (*outputs, page, page_info, disable_component(), disable_component())
172
 
173
 
174
  def _to_jsonable_dt(x):
 
6
  import numpy as np
7
  import pandas as pd
8
  from common import get_db
 
9
  import plotly.express as px
10
 
11
  MAX_CHARTS_IN_PAGE = 40
 
167
  page = 0
168
  page_info = "Page 0 / 0"
169
 
170
+ return (*outputs, page, page_info, gr.update(interactive=False), gr.update(interactive=False))
171
 
172
 
173
  def _to_jsonable_dt(x):
ui.py CHANGED
@@ -13,6 +13,7 @@ from graph import create_graph
13
  from modules.models import HealthReport, SheamiMilestone, SheamiState, SheamiUser
14
  from pdf_reader import read_pdf
15
  from gradio_modal import Modal
 
16
  from report_formatter import render_patient_state
17
  from dotenv import load_dotenv
18
 
@@ -840,11 +841,13 @@ async def save_vitals_readings(
840
  # ]
841
  vitals_history = await get_db().get_vitals_by_patient(patient_id)
842
  latest_vitals = await render_latest_vitals_card_layout(patient_id)
 
843
  # print("ui: vitals = ", vitals)
844
  return (
845
  f"✅ Saved for {patient_id} on {reading_date}",
846
  flatten_vitals(vitals_history),
847
  *latest_vitals,
 
848
  )
849
 
850
 
@@ -892,12 +895,12 @@ async def render_latest_vitals_card_layout(patient_id: str):
892
 
893
  # Truncate readings if more than 20
894
  readings = readings[:20]
895
- for reading in sorted(readings, key=lambda x : x["name"]):
896
  cards.append(
897
  gr.Label(
898
  value=f"{reading['value']}{reading['unit']}",
899
  label=reading["name"],
900
- visible=True
901
  )
902
  )
903
 
@@ -905,4 +908,4 @@ async def render_latest_vitals_card_layout(patient_id: str):
905
  while len(cards) < 20:
906
  cards.append(gr.Label(value="-", label="", visible=True))
907
 
908
- return cards
 
13
  from modules.models import HealthReport, SheamiMilestone, SheamiState, SheamiUser
14
  from pdf_reader import read_pdf
15
  from gradio_modal import Modal
16
+ from plot_helper import render_vitals_plot_layout
17
  from report_formatter import render_patient_state
18
  from dotenv import load_dotenv
19
 
 
841
  # ]
842
  vitals_history = await get_db().get_vitals_by_patient(patient_id)
843
  latest_vitals = await render_latest_vitals_card_layout(patient_id)
844
+ vitals_plots = await render_vitals_plot_layout(patient_id)
845
  # print("ui: vitals = ", vitals)
846
  return (
847
  f"✅ Saved for {patient_id} on {reading_date}",
848
  flatten_vitals(vitals_history),
849
  *latest_vitals,
850
+ *vitals_plots,
851
  )
852
 
853
 
 
895
 
896
  # Truncate readings if more than 20
897
  readings = readings[:20]
898
+ for reading in sorted(readings, key=lambda x: x["name"]):
899
  cards.append(
900
  gr.Label(
901
  value=f"{reading['value']}{reading['unit']}",
902
  label=reading["name"],
903
+ visible=True,
904
  )
905
  )
906
 
 
908
  while len(cards) < 20:
909
  cards.append(gr.Label(value="-", label="", visible=True))
910
 
911
+ return cards