🔁 Remplacement de Streamlit.py par domo91.py

This commit is contained in:
2025-04-13 07:12:35 +02:00
parent bfde6420bf
commit 6f81f629d1
9 changed files with 330 additions and 30 deletions

View File

@@ -0,0 +1,19 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N812" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="paho.mqtt.client.MQTTException" />
</list>
</option>
</inspection_tool>
</profile>
</component>

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

View File

@@ -0,0 +1,30 @@
Index: deploy.sh
===================================================================
diff --git a/deploy.sh b/deploy.sh
--- a/deploy.sh (revision bfde6420bf1360fedfdcb6c2a4ae08d5176e1475)
+++ b/deploy.sh (date 1744356351134)
@@ -1,0 +1,23 @@
+#!/bin/bash
+
+# Script de déploiement - Michel - domo91
+
+echo "🔁 Passage de la branche develop vers product"
+
+# Sécurité : commite d'abord le travail en cours
+git add .
+git commit -m "💾 Sauvegarde auto avant passage en prod" || echo "Rien à commit"
+
+# Passage sur la branche product
+git checkout product
+
+# Fusion de develop vers product
+git merge develop --no-ff -m "🚀 Déploiement depuis develop vers product"
+
+# Push de la branche product
+git push
+
+# Retour sur develop
+git checkout develop
+
+echo "✅ Déploiement terminé !"
\ No newline at end of file

View File

@@ -0,0 +1,4 @@
<changelist name="Uncommitted_changes_before_Checkout_at_11_04_2025_13_04_[Changes]" date="1744369450146" recycled="false" toDelete="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_11_04_2025_13_04_[Changes]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Checkout at 11/04/2025 13:04 [Changes]" />
</changelist>

View File

@@ -0,0 +1,7 @@
<changelist name="Uncommitted_changes_before_rebase_[Changes]" date="1744295594252" recycled="false" toDelete="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_rebase_[Changes]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before rebase [Changes]" />
<binary>
<option name="BEFORE_PATH" value="Documentation_Systeme_Domo91.pdf" />
</binary>
</changelist>

260
.idea/workspace.xml generated Normal file
View File

@@ -0,0 +1,260 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="a12d9762-568e-4ace-91c1-148c598387a7" name="Changes" comment="&quot;Injection données dans Tables Meudon et Roissy&quot;">
<change beforePath="$PROJECT_DIR$/.idea/.name" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="product" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProblemsViewState">
<option name="selectedTabId" value="CurrentFile" />
<option name="showPreview" value="true" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 5
}</component>
<component name="ProjectId" id="2nIN6lkmtfcgr9VNmeRIwomh3Vr" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="false" />
<option name="showLibraryContents" value="true" />
<option name="showScratchesAndConsoles" value="false" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"Python.AlerteMonitoring.executor": "Run",
"Python.Alerte_journalière.executor": "Run",
"Python.AlertesSondesSaclay.executor": "Run",
"Python.Alertes_Saclay.executor": "Run",
"Python.Alertes_Telegram.executor": "Run",
"Python.Alertes_saclay.executor": "Run",
"Python.Alertes_telegram.executor": "Run",
"Python.Base.executor": "Run",
"Python.Base2.executor": "Run",
"Python.Chat-Id.executor": "Run",
"Python.Chaufferie.executor": "Run",
"Python.Code_général.executor": "Run",
"Python.Connexion_mysql.executor": "Run",
"Python.Cuisine_meudon.executor": "Run",
"Python.Cuisine_saclay.executor": "Run",
"Python.Général.executor": "Run",
"Python.Insertion_tables_Msql.executor": "Run",
"Python.Lecture_tableau_frigos.executor": "Run",
"Python.Monitor.executor": "Run",
"Python.Saclay.executor": "Run",
"Python.Saclay_buffer.executor": "Run",
"Python.Sondes tracker.executor": "Run",
"Python.Streamlit.executor": "Run",
"Python.Streamlit_Saaclay.executor": "Run",
"Python.Streamlit_Saclay.executor": "Run",
"Python.Telegram_sondes.executor": "Run",
"Python.Test Tables MYSQL.executor": "Run",
"Python.Test Tables Sondes.executor": "Run",
"Python.Test table Meudon.executor": "Run",
"Python.Test table Saclay.executor": "Run",
"Python.Test.executor": "Run",
"Python.Test_mail.executor": "Run",
"Python.Tracker.executor": "Run",
"Python.Vérification Triggers.executor": "Run",
"Python.Vérification_temperatures_alertes_mail.executor": "Run",
"Python.domo91.executor": "Run",
"Python.logs_analyses.executor": "Run",
"Python.test.executor": "Run",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.git.unshallow": "true",
"git-widget-placeholder": "develop",
"ignore.virus.scanning.warn.message": "true",
"last_opened_file_path": "C:/Users/miche/PycharmProjects/Gestion sondes",
"settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable",
"settings.editor.splitter.proportion": "0.28861153"
}
}]]></component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\miche\PycharmProjects\Gestion sondes" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\miche\PycharmProjects\Gestion sondes\Scripts" />
<recent name="C:\Users\miche\PycharmProjects\Gestion sondes" />
</key>
</component>
<component name="RunManager">
<configuration name="domo91" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="Gestion sondes" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="C:\Users\miche\PycharmProjects\Gestion sondes\domo91.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.domo91" />
</list>
</recent_temporary>
</component>
<component name="SharedIndexes">
<attachedChunks>
<set>
<option value="bundled-python-sdk-4f4e415b4190-aa17d162503b-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-243.26053.29" />
</set>
</attachedChunks>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="SvnConfiguration">
<configuration>C:\Users\miche\AppData\Roaming\Subversion</configuration>
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="a12d9762-568e-4ace-91c1-148c598387a7" name="Changes" comment="" />
<created>1728656456324</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1728656456324</updated>
</task>
<task id="LOCAL-00001" summary="Ajout README Complet">
<option name="closed" value="true" />
<created>1744174026980</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1744174026980</updated>
</task>
<task id="LOCAL-00002" summary="Ajout README Complet">
<option name="closed" value="true" />
<created>1744174083792</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1744174083792</updated>
</task>
<task id="LOCAL-00003" summary="Ajout README Complet">
<option name="closed" value="true" />
<created>1744174834295</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1744174834295</updated>
</task>
<task id="LOCAL-00004" summary=".gitignore">
<option name="closed" value="true" />
<created>1744198339815</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1744198339815</updated>
</task>
<task id="LOCAL-00005" summary="Streamlit.py">
<option name="closed" value="true" />
<created>1744202721873</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1744202721873</updated>
</task>
<task id="LOCAL-00006" summary="Streamlit.py">
<option name="closed" value="true" />
<created>1744223219809</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1744223219809</updated>
</task>
<task id="LOCAL-00007" summary="Streamlit.py">
<option name="closed" value="true" />
<created>1744453875125</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1744453875125</updated>
</task>
<task id="LOCAL-00008" summary="Base de données SG">
<option name="closed" value="true" />
<created>1744454480848</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1744454480848</updated>
</task>
<task id="LOCAL-00009" summary="Base de données SG">
<option name="closed" value="true" />
<created>1744457082014</created>
<option name="number" value="00009" />
<option name="presentableId" value="LOCAL-00009" />
<option name="project" value="LOCAL" />
<updated>1744457082014</updated>
</task>
<task id="LOCAL-00010" summary="&quot;Injection données dans Tables Meudon et Roissy&quot;">
<option name="closed" value="true" />
<created>1744472289925</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1744472289925</updated>
</task>
<task id="LOCAL-00011" summary="&quot;Injection données dans Tables Meudon et Roissy&quot;">
<option name="closed" value="true" />
<created>1744515782743</created>
<option name="number" value="00011" />
<option name="presentableId" value="LOCAL-00011" />
<option name="project" value="LOCAL" />
<updated>1744515782743</updated>
</task>
<task id="LOCAL-00012" summary="&quot;Injection données dans Tables Meudon et Roissy&quot;">
<option name="closed" value="true" />
<created>1744519840546</created>
<option name="number" value="00012" />
<option name="presentableId" value="LOCAL-00012" />
<option name="project" value="LOCAL" />
<updated>1744519840546</updated>
</task>
<option name="localTasksCounter" value="13" />
<servers />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Ajout README Complet" />
<MESSAGE value=".gitignore" />
<MESSAGE value="Streamlit.py" />
<MESSAGE value="Base de données SG" />
<MESSAGE value="&quot;Injection données dans Tables Meudon et Roissy&quot;" />
<option name="LAST_COMMIT_MESSAGE" value="&quot;Injection données dans Tables Meudon et Roissy&quot;" />
</component>
</project>

View File

@@ -1,5 +1,4 @@
# Application Streamlit avec coloration rouge des températures dépassant les seuils dans logs
# Application Gestion de sondes
import streamlit as st
import mysql.connector
import pandas as pd
@@ -8,7 +7,7 @@ import matplotlib.pyplot as plt
import matplotlib.dates as mdates
st.set_page_config(page_title="Domo91 - Surveillance", layout="wide")
st.title("📡 Supervision Températures Multisites")
st.title("📡 Supervision Températures")
# --- Configuration base de données ---
db_config = {
@@ -76,8 +75,6 @@ if st.session_state.get("page") == "analyse_logs":
with st.sidebar:
st.markdown("# 🌡️ **Domo91**")
st.markdown("Monitoring chambres froides industrielles")
st.header("🔐 Connexion")
if not st.session_state["authenticated"]:
login = st.text_input("Nom d'utilisateur")
@@ -112,7 +109,7 @@ if st.session_state["authenticated"]:
try:
conn = mysql.connector.connect(**db_config)
cursor = conn.cursor(dictionary=True)
sites_possibles = ["Saclay", "Meudon"]
sites_possibles = ["Saclay", "Meudon", "Roissy"]
if st.session_state["role"] == "superviseur":
site_selectionne = st.selectbox("📍 Choisissez un site :", sites_possibles)
else:
@@ -129,30 +126,7 @@ if st.session_state["authenticated"]:
df["Date"] = pd.to_datetime(df["Date"])
sondes = sorted(df["Sonde"].unique())
sonde_choisie = st.selectbox("🧪 Choisissez une sonde :", sondes)
df_sonde = df[df["Sonde"] == sonde_choisie].copy()
df_sonde["Heure"] = df_sonde["Date"].dt.hour
# 🕓 Filtres horaires
st.markdown("### 🕒 Filtrer par moment de la journée")
col1, col2, col3 = st.columns(3)
filtre_matin = col1.checkbox("Matin (06h-12h)", value=True)
filtre_apresmidi = col2.checkbox("Après-midi (12h-18h)", value=True)
filtre_nuit = col3.checkbox("Nuit (18h-06h)", value=True)
# Construction du filtre combiné
filtres = []
if filtre_matin:
filtres.append(df_sonde["Heure"].between(6, 11))
if filtre_apresmidi:
filtres.append(df_sonde["Heure"].between(12, 17))
if filtre_nuit:
filtres.append((df_sonde["Heure"] >= 18) | (df_sonde["Heure"] < 6))
if filtres:
filtre_combiné = filtres[0]
for f in filtres[1:]:
filtre_combiné |= f
df_sonde = df_sonde[filtre_combiné]
df_sonde = df[df["Sonde"] == sonde_choisie]
cursor.execute("SELECT Temp_Max FROM Chambres_froides WHERE Lieu = %s AND Sonde = %s", (site_selectionne, sonde_choisie))
seuil = cursor.fetchone()
seuil_temp = seuil["Temp_Max"] if seuil else 10