Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -37,6 +37,8 @@ def extract_data_from_pdf(pdf_content):
|
|
37 |
try:
|
38 |
parts = line.strip().split()
|
39 |
time = parts[0] if 'Début' in line or 'Fin' in line else parts[1]
|
|
|
|
|
40 |
temp_sterilisateur = float(parts[-3].replace('°C', ''))
|
41 |
temp_coeur = float(parts[-2].replace('°C', ''))
|
42 |
valeur_f = float(parts[-1])
|
@@ -47,7 +49,8 @@ def extract_data_from_pdf(pdf_content):
|
|
47 |
'temp_coeur': temp_coeur,
|
48 |
'valeur_f': valeur_f
|
49 |
})
|
50 |
-
except:
|
|
|
51 |
continue
|
52 |
|
53 |
# Add last record
|
@@ -62,9 +65,9 @@ def analyze_sterilization(data):
|
|
62 |
for record in data:
|
63 |
temp_data = pd.DataFrame(record['temperature_data'])
|
64 |
|
65 |
-
#
|
66 |
-
if
|
67 |
-
st.warning(f"Données manquantes pour
|
68 |
continue
|
69 |
|
70 |
# Determine product type and required temperature
|
|
|
37 |
try:
|
38 |
parts = line.strip().split()
|
39 |
time = parts[0] if 'Début' in line or 'Fin' in line else parts[1]
|
40 |
+
|
41 |
+
# Extract temperature values
|
42 |
temp_sterilisateur = float(parts[-3].replace('°C', ''))
|
43 |
temp_coeur = float(parts[-2].replace('°C', ''))
|
44 |
valeur_f = float(parts[-1])
|
|
|
49 |
'temp_coeur': temp_coeur,
|
50 |
'valeur_f': valeur_f
|
51 |
})
|
52 |
+
except Exception as e:
|
53 |
+
# If extraction fails, skip the line
|
54 |
continue
|
55 |
|
56 |
# Add last record
|
|
|
65 |
for record in data:
|
66 |
temp_data = pd.DataFrame(record['temperature_data'])
|
67 |
|
68 |
+
# Skip if temperature data is empty
|
69 |
+
if temp_data.empty:
|
70 |
+
st.warning(f"Données de température manquantes pour l'enregistrement du {record['date']}")
|
71 |
continue
|
72 |
|
73 |
# Determine product type and required temperature
|