Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ import pandas as pd
|
|
3 |
import re
|
4 |
from datetime import datetime
|
5 |
import pdfplumber
|
6 |
-
import plotly.graph_objects as go
|
7 |
import plotly.express as px
|
8 |
import io
|
9 |
|
@@ -63,6 +62,11 @@ def analyze_sterilization(data):
|
|
63 |
for record in data:
|
64 |
temp_data = pd.DataFrame(record['temperature_data'])
|
65 |
|
|
|
|
|
|
|
|
|
|
|
66 |
# Determine product type and required temperature
|
67 |
is_nutabreizh = 'NutaBreizh' in record['produit']
|
68 |
required_temp = 108 if is_nutabreizh else 103
|
@@ -111,13 +115,16 @@ def main():
|
|
111 |
st.dataframe(results_df)
|
112 |
|
113 |
# Create visualization
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
121 |
|
122 |
# Export button
|
123 |
if st.button("Exporter en Excel"):
|
|
|
3 |
import re
|
4 |
from datetime import datetime
|
5 |
import pdfplumber
|
|
|
6 |
import plotly.express as px
|
7 |
import io
|
8 |
|
|
|
62 |
for record in data:
|
63 |
temp_data = pd.DataFrame(record['temperature_data'])
|
64 |
|
65 |
+
# Check if 'temp_coeur' exists in the DataFrame
|
66 |
+
if 'temp_coeur' not in temp_data.columns:
|
67 |
+
st.warning(f"Données manquantes pour 'temp_coeur' dans l'enregistrement du {record.get('date', 'date inconnue')}")
|
68 |
+
continue
|
69 |
+
|
70 |
# Determine product type and required temperature
|
71 |
is_nutabreizh = 'NutaBreizh' in record['produit']
|
72 |
required_temp = 108 if is_nutabreizh else 103
|
|
|
115 |
st.dataframe(results_df)
|
116 |
|
117 |
# Create visualization
|
118 |
+
if not results_df.empty:
|
119 |
+
fig = px.scatter(results_df,
|
120 |
+
x='Date',
|
121 |
+
y='Minutes_Temperature_Requise',
|
122 |
+
color='Criteres_Respectes',
|
123 |
+
hover_data=['Produit', 'Temperature_Requise'],
|
124 |
+
title="Minutes à température requise par production")
|
125 |
+
st.plotly_chart(fig)
|
126 |
+
else:
|
127 |
+
st.warning("Aucune donnée valide à afficher.")
|
128 |
|
129 |
# Export button
|
130 |
if st.button("Exporter en Excel"):
|