Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
inventario
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jose Luis Gordillo Ruiz
inventario
Commits
552f49f9
Commit
552f49f9
authored
Mar 26, 2025
by
Itzel Camacho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ahora se ve la glucosa de todo el periodo, no solo de la visita 1
parent
97e51093
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
estadisticas_comidas.py
+13
-11
No files found.
estadisticas_comidas.py
View file @
552f49f9
...
@@ -268,7 +268,7 @@ comidas.rename(columns={"glucosa_basal_area":"pre-AUC", "glucosa_estimulo_area":
...
@@ -268,7 +268,7 @@ comidas.rename(columns={"glucosa_basal_area":"pre-AUC", "glucosa_estimulo_area":
comidas
[
"iAUC"
]
=
comidas
[
"post-AUC"
]
-
comidas
[
"pre-AUC"
]
*
2
comidas
[
"iAUC"
]
=
comidas
[
"post-AUC"
]
-
comidas
[
"pre-AUC"
]
*
2
df_total
=
pd
.
read_csv
(
"test.csv"
)
df_total
=
pd
.
read_csv
(
"test.csv"
)
df_total
=
df_total
[
df_total
[
"etapas"
]
==
"e1"
]
#
df_total = df_total[df_total["etapas"] == "e1"]
id_patients
=
set
(
range
(
30
,
217
))
id_patients
=
set
(
range
(
30
,
217
))
ids_presentes
=
set
(
df_total
[
'patient'
])
ids_presentes
=
set
(
df_total
[
'patient'
])
ids_faltantes
=
list
(
id_patients
-
ids_presentes
)
ids_faltantes
=
list
(
id_patients
-
ids_presentes
)
...
@@ -394,22 +394,24 @@ def update_graph(selected_pat, rango_str):
...
@@ -394,22 +394,24 @@ def update_graph(selected_pat, rango_str):
patient_foods
=
df_total
.
loc
[
df_total
[
'patient'
]
==
selected_pat
]
patient_foods
=
df_total
.
loc
[
df_total
[
'patient'
]
==
selected_pat
]
glucosa
=
readGlucosa
(
selected_pat
)
glucosa
=
readGlucosa
(
selected_pat
)
visita
=
readVisitas
(
1
)
#visita = readVisitas(1)
fecha_visita1
=
pd
.
to_datetime
(
visita
.
loc
[
visita
[
'id'
]
==
selected_pat
,
'visit_date'
]
.
iloc
[
0
])
#fecha_visita1 = pd.to_datetime(visita.loc[visita['id'] == selected_pat, 'visit_date'].iloc[0])
patient_fotos
=
df_fotos
.
loc
[(
df_fotos
[
'patient'
]
==
selected_pat
)
&
(
df_fotos
[
'fecha_hora'
]
<
fecha_visita1
+
pd
.
Timedelta
(
days
=
15
))]
#patient_fotos = df_fotos.loc[(df_fotos['patient'] == selected_pat) & (df_fotos['fecha_hora'] < fecha_visita1 + pd.Timedelta(days=15))]
patient_fotos
=
df_fotos
.
loc
[
df_fotos
[
'patient'
]
==
selected_pat
]
if
glucosa
.
empty
:
if
glucosa
.
empty
:
return
go
.
Figure
()
return
go
.
Figure
()
filtered_glucosa
=
glucosa
[(
glucosa
[
'date_time'
]
>=
fecha_visita1
)
&
#
filtered_glucosa = glucosa[(glucosa['date_time'] >= fecha_visita1) &
(
glucosa
[
'date_time'
]
<=
fecha_visita1
+
pd
.
Timedelta
(
days
=
15
))]
#
(glucosa['date_time'] <= fecha_visita1 + pd.Timedelta(days=15))]
# Si no hay datos de glucosa en el rango de tiempo, retornar un gráfico vacío
# Si no hay datos de glucosa en el rango de tiempo, retornar un gráfico vacío
if
filtered_glucosa
.
empty
:
#
if filtered_glucosa.empty:
return
go
.
Figure
()
#
return go.Figure()
fig
=
go
.
Figure
()
fig
=
go
.
Figure
()
fig
.
add_trace
(
go
.
Scatter
(
x
=
filtered_
glucosa
[
'date_time'
],
# gráfica de la glucosa del paciente seleccionado
fig
.
add_trace
(
go
.
Scatter
(
x
=
glucosa
[
'date_time'
],
# gráfica de la glucosa del paciente seleccionado
y
=
filtered_
glucosa
[
'value'
],
y
=
glucosa
[
'value'
],
mode
=
'lines'
,
mode
=
'lines'
,
name
=
'Glucosa
paciente visita 1
'
))
name
=
'Glucosa
del paciente
'
))
fig
.
update_layout
(
yaxis
=
dict
(
range
=
[
50
,
200
]))
fig
.
update_layout
(
yaxis
=
dict
(
range
=
[
50
,
200
]))
y_foods
=
np
.
interp
(
patient_foods
[
'FH_reportada'
],
(
glucosa
[
'date_time'
]),
glucosa
[
'value'
])
# interpolar fecha de las comidas con glucosa
y_foods
=
np
.
interp
(
patient_foods
[
'FH_reportada'
],
(
glucosa
[
'date_time'
]),
glucosa
[
'value'
])
# interpolar fecha de las comidas con glucosa
distancias
=
abs
((
patient_foods
[
'FH_salto'
]
-
patient_foods
[
'FH_reportada'
])
.
dt
.
total_seconds
())
/
60
distancias
=
abs
((
patient_foods
[
'FH_salto'
]
-
patient_foods
[
'FH_reportada'
])
.
dt
.
total_seconds
())
/
60
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment