Spaces:
Sleeping
Sleeping
Upload 6 files
Browse files- .gitattributes +2 -0
- DATA.xlsx +3 -0
- Dashboard.py +512 -0
- Data.py +132 -0
- Visualisation.py +552 -0
- data2.xlsx +3 -0
- main.py +27 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
DATA.xlsx filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
data2.xlsx filter=lfs diff=lfs merge=lfs -text
|
DATA.xlsx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:88c4851deeb7b111070b9df7ed19e4b6dac93536c5ff5ba703a589bbc18b3c49
|
| 3 |
+
size 3162873
|
Dashboard.py
ADDED
|
@@ -0,0 +1,512 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
from streamlit_option_menu import option_menu
|
| 4 |
+
from streamlit_echarts import st_pyecharts
|
| 5 |
+
from pyecharts.charts import Bar
|
| 6 |
+
from pyecharts.charts import Pie
|
| 7 |
+
from pyecharts import options as opts
|
| 8 |
+
|
| 9 |
+
liste_vaccin = ['YELLOW FEVER', 'Penta', 'VPO', 'VPI', 'nOPV2', 'TD','Mosquirix', 'PCV13', 'MEASLES', 'BCG', 'Janssen', 'Rota', 'MENINGO', 'HPV', 'Mencevax']
|
| 10 |
+
|
| 11 |
+
region_district = {
|
| 12 |
+
"ADAMAOUA" : ["Bankim","Banyo","Belel","Dang","Djohong","Meiganga","Ngaoundal","Ngaoundere Rural","Ngaoundere Urbain","Tibati","Tignere"],
|
| 13 |
+
"CENTRE" : ["Akonolinga","Awae","Ayos","Bafia","Biyem Assi","Cite Verte","Djoungolo","Ebebda","Efoulan","Elig Mfomo","Eseka","Esse","Evodoula","Mbalmayo","Mbandjock","Mbankomo","Mfou","Monatele","Mvog-Ada","Nanga Eboko","Ndikinimeki","Ngog Mapubi","Ngoumou","Nkolbisson","Nkolndongo","Ntui","Obala","Odza","Okola","Sa'a","Soa","Yoko"],
|
| 14 |
+
"EST": ["Abong_Mbang","Batouri","Belabo","Bertoua","Betare_Oya","Doume","Garoua_Boulai","Kette","Lomie","Mbang","Messamena","Moloundou","Ndelele","Nguelemendouka","Yokadouma"],
|
| 15 |
+
"EXTREME NORD" : ["Bogo","Bourha","Fotokol","Gazawa","Goulfey","Guere","Guidiguis","Hina","Kaele","Kar Hay","Kolofata","Kousseri","Koza","Mada","Maga","Makary","Maroua 1","Maroua 2","Maroua 3","Meri","Mindif","Mogode","Mokolo","Mora","Moulvoudaye","Moutourwa","Mozogo","Pette","Roua","Tokombere","Vele","Waza","Yagoua"],
|
| 16 |
+
"LITTORAL": ["Abo","Bangue","Boko","Bonassama","Cite Des Palmiers","Deido","Dibombari","Edea","Japoma","Logbaba","Loum","Manjo","Manoka","Mbanga","Melong","Ndom","New Bell","Ngambe","Njombe Penja","Nkondjock","Nkongsamba","Nylon","Pouma","Yabassi"],
|
| 17 |
+
"NORD" : ["Bibemi","Figuil","Garoua I","Garoua II","Gaschiga","Golombe","Guider","Lagdo","Mayo Oulo","Ngong","Pitoa","Poli","Rey Bouba","Tchollire","Touboro"],
|
| 18 |
+
"NORD OUEST" : ["Ako","Bafut","Bali","Bamenda","Bamenda 3","Batibo","Benakuma","Fundong","Kumbo East","Kumbo West","Mbengwi","Misaje","Ndop","Ndu","Njikwa","Nkambe","Nwa","Oku","Santa","Tubah","Wum"],
|
| 19 |
+
"OUEST" : ["Bafang","Baham","Bamendjou","Bandja","Bandjoun","Bangangte","Bangourain","Batcham","Dschang","Foumban","Foumbot","Galim","Kekem","Kouoptamo","Malantouen","Massangam","Mbouda","Mifi","Penka Michel","Santchou"],
|
| 20 |
+
"SUD" : ["Ambam","Djoum","Ebolowa","Kribi","Kye-ossi","Lolodorf","Meyomessala","Mintom","Mvangan","Niete","Olamze","Sangmelima","Zoetele"],
|
| 21 |
+
"SUD OUEST": ["Akwaya","Bakassi","Bamusso","Bangem","Buea","Ekondo Titi","Eyumodjock","Fontem","Konye","Kumba-North","Kumba-South","Limbe","Mamfe","Mbonge","Mundemba","Muyuka","Nguti","Tiko","Toko","Tombel","Wabane"]
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
list_tranche_dage = ["[0-1[","[01-05[","[05-15[","[15-18[","[18-25[","[25-35[","[35-45[","[45-55[","[55-65[","65etPlus"]
|
| 25 |
+
|
| 26 |
+
nav_bar1 = option_menu(None,
|
| 27 |
+
["global", "Resume"],
|
| 28 |
+
icons=['file-earmark-bar-graph-fill'],
|
| 29 |
+
menu_icon="cast",
|
| 30 |
+
default_index=0,
|
| 31 |
+
orientation="horizontal")
|
| 32 |
+
|
| 33 |
+
# Initialization
|
| 34 |
+
if 'data' not in st.session_state:
|
| 35 |
+
st.session_state['data'] = None
|
| 36 |
+
|
| 37 |
+
if 'dataframe_mappi_region' not in st.session_state:
|
| 38 |
+
st.session_state['dataframe_mappi_region'] = None
|
| 39 |
+
|
| 40 |
+
if st.session_state['data'] is None:
|
| 41 |
+
st.warning("Veuillez entrer les données")
|
| 42 |
+
else:
|
| 43 |
+
|
| 44 |
+
data = st.session_state['data']
|
| 45 |
+
temp = liste_vaccin.copy()
|
| 46 |
+
temp.append("Global")
|
| 47 |
+
|
| 48 |
+
if nav_bar1 == "Resume":
|
| 49 |
+
## resume mappi grave
|
| 50 |
+
# filtre des donnees pour garder les mappi grave
|
| 51 |
+
filtered_df = data[data['type_Vaccin'].isin(liste_vaccin)]
|
| 52 |
+
filtered_df_2 = filtered_df[filtered_df['seriousness/serious'] == 1.0]
|
| 53 |
+
df = (filtered_df_2[["admininfo/states","admininfo/district",'patien',"admininfo/safetyreportid","Age","Tranche_Age","Sexe","type_Vaccin", "event/reactionstartdate", "event/primarysourcereaction","reporter/reportergivename", "reporter/reportertel", "reporter/reporteremail", "_index",
|
| 54 |
+
"Semaine_Epid","seriousness/seriousnessdeath", "healthproduct/drugadmin/intervention"]])
|
| 55 |
+
df['devenir'] = df["seriousness/seriousnessdeath"].apply(lambda x: 'décédé' if x == 1.0 else 'vivant')
|
| 56 |
+
df.loc[df["type_Vaccin"] == "nOPV2", "healthproduct/drugadmin/intervention"] = "masscampaign"
|
| 57 |
+
df["event/reactionstartdate"] = pd.to_datetime(df["event/reactionstartdate"], origin="1899-12-30", unit="D").dt.date
|
| 58 |
+
|
| 59 |
+
df = df.rename(columns={"admininfo/states": "REGIONS"})
|
| 60 |
+
df = df.rename(columns={"admininfo/district": "DISTRICT"})
|
| 61 |
+
df = df.rename(columns={"patien": "INITIAUX DU PATIENT"})
|
| 62 |
+
df = df.rename(columns={"admininfo/safetyreportid": "NUM EPID"})
|
| 63 |
+
df = df.rename(columns={"Age": "AGE"})
|
| 64 |
+
df = df.rename(columns={"Tranche_Age": "TRANCHE AGE"})
|
| 65 |
+
df = df.rename(columns={"Sexe": "SEXE"})
|
| 66 |
+
df = df.rename(columns={"type_Vaccin": "TYPE VACCIN"})
|
| 67 |
+
df = df.rename(columns={"event/reactionstartdate": "DATE DEBUT REACTION"})
|
| 68 |
+
df = df.rename(columns={"event/primarysourcereaction": "PREMIERS SIGNES"})
|
| 69 |
+
df = df.rename(columns={"reporter/reportergivename": "NOTIFICATEURS"})
|
| 70 |
+
df = df.rename(columns={"reporter/reportertel": "NUMERO NOTIFICATEURS"})
|
| 71 |
+
df = df.rename(columns={"reporter/reporteremail": "ADRESSE NOTIFICATEURS"})
|
| 72 |
+
df = df.rename(columns={"_index": "NUMERO INDEX"})
|
| 73 |
+
df = df.rename(columns={"Semaine_Epid": "SEMAINE EPI"})
|
| 74 |
+
df = df.rename(columns={"healthproduct/drugadmin/intervention": "CIRCONSTANCE DE VACCINATION"})
|
| 75 |
+
df = df.rename(columns={"devenir": "DEVENIR"})
|
| 76 |
+
|
| 77 |
+
st.write(df[["REGIONS","DISTRICT",'INITIAUX DU PATIENT',"NUM EPID","AGE","TRANCHE AGE","SEXE","TYPE VACCIN","DATE DEBUT REACTION", "PREMIERS SIGNES","NOTIFICATEURS", "NUMERO NOTIFICATEURS", "ADRESSE NOTIFICATEURS", "NUMERO INDEX",
|
| 78 |
+
"SEMAINE EPI", "CIRCONSTANCE DE VACCINATION", "DEVENIR"]])
|
| 79 |
+
st.write("___")
|
| 80 |
+
col1,col2, col3, col4, col5 = st.columns([1,1,1,2,2])
|
| 81 |
+
with col1:
|
| 82 |
+
nbr_region_contnair = st.container(border=True)
|
| 83 |
+
with nbr_region_contnair:
|
| 84 |
+
st.write("Nombre de regions")
|
| 85 |
+
st.subheader(len(list(df["REGIONS"].unique())))
|
| 86 |
+
|
| 87 |
+
with col2:
|
| 88 |
+
nbr_district_contnair = st.container(border=True)
|
| 89 |
+
with nbr_district_contnair:
|
| 90 |
+
st.write("Nombre de district")
|
| 91 |
+
st.subheader(len(list(df["DISTRICT"].unique())))
|
| 92 |
+
|
| 93 |
+
with col3:
|
| 94 |
+
nbr_cas_contnair = st.container(border=True)
|
| 95 |
+
with nbr_cas_contnair:
|
| 96 |
+
st.write("Nombre de cas")
|
| 97 |
+
st.subheader(df.shape[0])
|
| 98 |
+
|
| 99 |
+
with col4:
|
| 100 |
+
repartition_sex_contnair = st.container(border=True)
|
| 101 |
+
with repartition_sex_contnair:
|
| 102 |
+
st.write("Repartitions pas sexe")
|
| 103 |
+
st.subheader(f"{len(df[df.SEXE == 'Masculin'])} Hommes / {len(df[df.SEXE == 'Féminin'])} Femmes")
|
| 104 |
+
|
| 105 |
+
with col5:
|
| 106 |
+
nbr_mort_contnair = st.container(border=True)
|
| 107 |
+
with nbr_mort_contnair:
|
| 108 |
+
st.write("Rapport mort/survivant")
|
| 109 |
+
st.subheader(f"{df[df.DEVENIR == 'décédé'].shape[0]} mort / {df[df.DEVENIR != 'décédé'].shape[0]} survivants")
|
| 110 |
+
|
| 111 |
+
col1, col2 = st.columns([2.3,4])
|
| 112 |
+
with col1:
|
| 113 |
+
circonstance_vaccination_contnair = st.container(border=True)
|
| 114 |
+
with circonstance_vaccination_contnair:
|
| 115 |
+
st.write("Circonstances de vaccination")
|
| 116 |
+
st.subheader(f"{len(df[df['CIRCONSTANCE DE VACCINATION'] == 'masscampaign'])} masscampaign / {len(df[df['CIRCONSTANCE DE VACCINATION'] != 'masscampaign'])} routineimmunization")
|
| 117 |
+
|
| 118 |
+
with col2:
|
| 119 |
+
reppartition_type_vaccin = st.expander("Repartission des vaccins",expanded=True)
|
| 120 |
+
with reppartition_type_vaccin:
|
| 121 |
+
for i in sorted(list(df["TYPE VACCIN"].unique())):
|
| 122 |
+
st.write(f"{i} : {df[df['TYPE VACCIN'] == i].shape[0]}")
|
| 123 |
+
else:
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
vaccin_type = st.selectbox("Choissisez le type de vaccin", options= temp, index=len(temp)-1)
|
| 128 |
+
|
| 129 |
+
# filtre de donnees pour isolees les mappi
|
| 130 |
+
filtered_df = data[data['type_Vaccin'].isin(liste_vaccin)]
|
| 131 |
+
if vaccin_type == "Global":
|
| 132 |
+
filtered_df_2 = filtered_df
|
| 133 |
+
else:
|
| 134 |
+
# filtre les donnees par vaccin
|
| 135 |
+
filtered_df_2 = filtered_df[filtered_df["type_Vaccin"] == vaccin_type]
|
| 136 |
+
|
| 137 |
+
# affichage de la carte et des indicateur par type de vaccin
|
| 138 |
+
col1, col2 = st.columns([4,6])
|
| 139 |
+
with col1:
|
| 140 |
+
filtre_carte = st.pills("filtre de carte", options=["Mappi grave", "Mappi non grave"], label_visibility="collapsed")
|
| 141 |
+
if filtre_carte is None:
|
| 142 |
+
st.map(filtered_df_2, latitude= "_gps_beginning_latitude", longitude= "_gps_beginning_longitude", use_container_width=True, height=608)
|
| 143 |
+
elif filtre_carte == "Mappi grave":
|
| 144 |
+
filtered_df_5 = filtered_df_2[filtered_df_2["seriousness/serious"] == 1.0]
|
| 145 |
+
st.map(filtered_df_5, latitude= "_gps_beginning_latitude", longitude= "_gps_beginning_longitude", use_container_width=True, height=608)
|
| 146 |
+
elif filtre_carte == "Mappi non grave":
|
| 147 |
+
filtered_df_5 = filtered_df_2[filtered_df_2["seriousness/serious"] == 2.0]
|
| 148 |
+
st.map(filtered_df_5, latitude= "_gps_beginning_latitude", longitude= "_gps_beginning_longitude", use_container_width=True, height=608)
|
| 149 |
+
# affichage des card (nbr mappi , nbr mappi grave, nbr mappi non grave)
|
| 150 |
+
|
| 151 |
+
with col2:
|
| 152 |
+
col = st.columns(4)
|
| 153 |
+
nbr_mappi = filtered_df_2.shape[0]
|
| 154 |
+
nbr_mappi_grave = filtered_df_2[ (filtered_df_2['seriousness/serious'] == 1.0) ].shape[0]
|
| 155 |
+
nbr_mappi_non_grave = filtered_df_2[ (filtered_df_2['seriousness/serious'] == 2.0) ].shape[0]
|
| 156 |
+
nbr_desces = filtered_df_2[filtered_df_2["seriousness/seriousnessdeath"] == 1.0].shape[0]
|
| 157 |
+
# nbr mappi
|
| 158 |
+
with col[0]:
|
| 159 |
+
nbr_mappi_card = st.container(border=True)
|
| 160 |
+
with nbr_mappi_card :
|
| 161 |
+
st.markdown("Nombre de MAPPI")
|
| 162 |
+
st.header(f"{nbr_mappi}")
|
| 163 |
+
# nbr mappi grave
|
| 164 |
+
with col[1]:
|
| 165 |
+
nbr_mappi_grave_card = st.container(border=True)
|
| 166 |
+
with nbr_mappi_grave_card:
|
| 167 |
+
st.markdown("Nombre de MAPPI grave")
|
| 168 |
+
st.header(f"{nbr_mappi_grave}")
|
| 169 |
+
# nbr mappi non grave
|
| 170 |
+
with col[2]:
|
| 171 |
+
nbr_mappi_non_grave_card = st.container(border=True)
|
| 172 |
+
with nbr_mappi_non_grave_card:
|
| 173 |
+
st.markdown("Nombre de MAPPI non grave")
|
| 174 |
+
st.header(f"{nbr_mappi_non_grave}")
|
| 175 |
+
# nbr desces
|
| 176 |
+
with col[3]:
|
| 177 |
+
nbr_desces_card = st.container(border=True)
|
| 178 |
+
with nbr_desces_card:
|
| 179 |
+
st.markdown("Nombre de desces")
|
| 180 |
+
st.header(f"{nbr_desces}")
|
| 181 |
+
|
| 182 |
+
# graphe repartition des mappi
|
| 183 |
+
graph_mappi = st.container(border=True)
|
| 184 |
+
with graph_mappi:
|
| 185 |
+
col1, col2, col3, col4 = st.columns([1,1,1,1])
|
| 186 |
+
with col1:
|
| 187 |
+
filtre_1 = st.pills(" ", options=["Distribution"], label_visibility="collapsed")
|
| 188 |
+
with col2:
|
| 189 |
+
filtre_2 = st.toggle("Sexe")
|
| 190 |
+
with col3:
|
| 191 |
+
filtre_3 = st.toggle("Tranche d'age")
|
| 192 |
+
with col4:
|
| 193 |
+
if filtre_1 is None:
|
| 194 |
+
filtre = st.pills("", options=["Par region", "Par semaine vaccinal"], label_visibility= "collapsed")
|
| 195 |
+
else:
|
| 196 |
+
filtre = st.pills("", options=["Par region", "Par semaine vaccinal"], label_visibility= "collapsed", disabled=True)
|
| 197 |
+
|
| 198 |
+
if filtre is None and filtre_1 is None:
|
| 199 |
+
if filtre_2 == True and filtre_3 == False:
|
| 200 |
+
# filtrer par sexe
|
| 201 |
+
# mappi grave
|
| 202 |
+
filtered_df_3 = filtered_df_2[filtered_df_2["seriousness/serious"] == 1.0]
|
| 203 |
+
mappi_grave_homme = filtered_df_3[filtered_df_3["Sexe"] == "Masculin"].shape[0]
|
| 204 |
+
mappi_grave_femme = filtered_df_3[filtered_df_3["Sexe"] != "Masculin"].shape[0]
|
| 205 |
+
# mappi non grave
|
| 206 |
+
filtered_df_3 = filtered_df_2[filtered_df_2["seriousness/serious"] == 2.0]
|
| 207 |
+
mappi_grave_non_homme = filtered_df_3[filtered_df_3["Sexe"] == "Masculin"].shape[0]
|
| 208 |
+
mappi_grave_non_femme = filtered_df_3[filtered_df_3["Sexe"] != "Masculin"].shape[0]
|
| 209 |
+
# desces
|
| 210 |
+
filtered_df_3 = filtered_df_2[filtered_df_2["seriousness/seriousnessdeath"] == 1.0]
|
| 211 |
+
desces_homme = filtered_df_3[filtered_df_3["Sexe"] == "Masculin"].shape[0]
|
| 212 |
+
desces_femme = filtered_df_3[filtered_df_3["Sexe"] != "Masculin"].shape[0]
|
| 213 |
+
|
| 214 |
+
## afficher les graphes
|
| 215 |
+
col = st.columns(2)
|
| 216 |
+
with col[0]:
|
| 217 |
+
st.subheader("Homme")
|
| 218 |
+
Nbr_mappi_type_vaccin = (
|
| 219 |
+
Bar()
|
| 220 |
+
.add_xaxis(["Mappi grave", "Mappi non grave", "Desces"]) # Assurez-vous que c'est une liste
|
| 221 |
+
.add_yaxis("Nombre de MAPPI grave", [mappi_grave_homme, mappi_grave_non_homme, desces_homme])
|
| 222 |
+
)
|
| 223 |
+
# Affichage du graphique
|
| 224 |
+
st_pyecharts(Nbr_mappi_type_vaccin, height="330px")
|
| 225 |
+
|
| 226 |
+
with col[1]:
|
| 227 |
+
st.subheader("Femme")
|
| 228 |
+
Nbr_mappi_type_vaccin = (
|
| 229 |
+
Bar()
|
| 230 |
+
.add_xaxis(["Mappi grave", "Mappi non grave", "Desces"]) # Assurez-vous que c'est une liste
|
| 231 |
+
.add_yaxis("Nombre de MAPPI grave", [mappi_grave_femme, mappi_grave_non_femme, desces_femme])
|
| 232 |
+
)
|
| 233 |
+
# Affichage du graphique
|
| 234 |
+
st_pyecharts(Nbr_mappi_type_vaccin, height="303px")
|
| 235 |
+
|
| 236 |
+
elif filtre_3 == True and filtre_2 == False:
|
| 237 |
+
_0_1_grave = None
|
| 238 |
+
_1_5_grave = None
|
| 239 |
+
_5_15_grave = None
|
| 240 |
+
_15_18_grave = None
|
| 241 |
+
_18_25_grave = None
|
| 242 |
+
_25_35_grave = None
|
| 243 |
+
_35_45_grave = None
|
| 244 |
+
_45_55_grave = None
|
| 245 |
+
_55_65_grave = None
|
| 246 |
+
_65etPlus_grave = None
|
| 247 |
+
|
| 248 |
+
_0_1_non_grave = None
|
| 249 |
+
_1_5_non_grave = None
|
| 250 |
+
_5_15_non_grave = None
|
| 251 |
+
_15_18_non_grave = None
|
| 252 |
+
_18_25_non_grave = None
|
| 253 |
+
_25_35_non_grave = None
|
| 254 |
+
_35_45_non_grave = None
|
| 255 |
+
_45_55_non_grave = None
|
| 256 |
+
_55_65_non_grave = None
|
| 257 |
+
_65etPlus_non_grave = None
|
| 258 |
+
|
| 259 |
+
filtered_df_3 = filtered_df_2[filtered_df_2["seriousness/serious"] == 1.0]
|
| 260 |
+
filtered_df_4 = filtered_df_2[filtered_df_2["seriousness/serious"] == 2.0]
|
| 261 |
+
|
| 262 |
+
for i in list_tranche_dage:
|
| 263 |
+
_ = filtered_df_3[filtered_df_3.Tranche_Age == f"{i}"].shape[0]
|
| 264 |
+
if i == '[0-1[':
|
| 265 |
+
_0_1_grave = _
|
| 266 |
+
elif i == '[01-05[':
|
| 267 |
+
_1_5_grave = _
|
| 268 |
+
elif i == '[05-15[':
|
| 269 |
+
_5_15_grave = _
|
| 270 |
+
elif i == '[15-18[':
|
| 271 |
+
_15_18_grave = _
|
| 272 |
+
elif i == '[18-25[':
|
| 273 |
+
_18_25_grave = _
|
| 274 |
+
elif i == '[25-35[':
|
| 275 |
+
_25_35_grave = _
|
| 276 |
+
elif i == '[35-45[':
|
| 277 |
+
_35_45_grave = _
|
| 278 |
+
elif i == '[45-55[':
|
| 279 |
+
_45_55_grave = _
|
| 280 |
+
elif i == '[55-65[':
|
| 281 |
+
_55_65_grave = _
|
| 282 |
+
elif i == '65etPlus':
|
| 283 |
+
_65etPlus_grave = _
|
| 284 |
+
|
| 285 |
+
for i in list_tranche_dage:
|
| 286 |
+
_ = filtered_df_4[filtered_df_4.Tranche_Age == f"{i}"].shape[0]
|
| 287 |
+
if i == '[0-1[':
|
| 288 |
+
_0_1_non_grave = _
|
| 289 |
+
elif i == '[01-05[':
|
| 290 |
+
_1_5_non_grave = _
|
| 291 |
+
elif i == '[05-15[':
|
| 292 |
+
_5_15_non_grave = _
|
| 293 |
+
elif i == '[15-18[':
|
| 294 |
+
_15_18_non_grave = _
|
| 295 |
+
elif i == '[18-25[':
|
| 296 |
+
_18_25_non_grave = _
|
| 297 |
+
elif i == '[25-35[':
|
| 298 |
+
_25_35_non_grave = _
|
| 299 |
+
elif i == '[35-45[':
|
| 300 |
+
_35_45_non_grave = _
|
| 301 |
+
elif i == '[45-55[':
|
| 302 |
+
_45_55_non_grave = _
|
| 303 |
+
elif i == '[55-65[':
|
| 304 |
+
_55_65_non_grave = _
|
| 305 |
+
elif i == '65etPlus':
|
| 306 |
+
_65etPlus_non_grave = _
|
| 307 |
+
|
| 308 |
+
col = st.columns(2)
|
| 309 |
+
with col[0]:
|
| 310 |
+
# Création du graphique
|
| 311 |
+
Nbr_mappi_tranche_age_grave = (
|
| 312 |
+
Bar()
|
| 313 |
+
.add_xaxis(list_tranche_dage)
|
| 314 |
+
.add_yaxis(
|
| 315 |
+
"Mappi grave",
|
| 316 |
+
[_0_1_grave, _1_5_grave, _5_15_grave, _15_18_grave, _18_25_grave,
|
| 317 |
+
_25_35_grave, _35_45_grave, _45_55_grave, _55_65_grave, _65etPlus_grave]
|
| 318 |
+
)
|
| 319 |
+
)
|
| 320 |
+
|
| 321 |
+
# Affichage avec Streamlit
|
| 322 |
+
st_pyecharts(Nbr_mappi_tranche_age_grave, height="370px")
|
| 323 |
+
with col[1]:
|
| 324 |
+
Nbr_mappi_tranche_age_grave = (
|
| 325 |
+
Bar()
|
| 326 |
+
.add_xaxis(list_tranche_dage)
|
| 327 |
+
.add_yaxis(
|
| 328 |
+
"Mappi non grave",
|
| 329 |
+
[_0_1_non_grave, _1_5_non_grave, _5_15_non_grave, _15_18_non_grave, _18_25_non_grave,
|
| 330 |
+
_25_35_non_grave, _35_45_non_grave, _45_55_non_grave, _55_65_non_grave, _65etPlus_non_grave]
|
| 331 |
+
)
|
| 332 |
+
)
|
| 333 |
+
# Affichage avec Streamlit
|
| 334 |
+
st_pyecharts(Nbr_mappi_tranche_age_grave, height="370px")
|
| 335 |
+
else:
|
| 336 |
+
Nbr_mappi_type_vaccin = (
|
| 337 |
+
Bar()
|
| 338 |
+
.add_xaxis([vaccin_type]) # Assurez-vous que c'est une liste
|
| 339 |
+
.add_yaxis("Nombre de MAPPI grave", [filtered_df_2[filtered_df_2['seriousness/serious'] == 1.0].shape[0]])
|
| 340 |
+
.add_yaxis("Nombre de MAPPI non grave", [filtered_df_2[filtered_df_2['seriousness/serious'] == 2.0].shape[0]], itemstyle_opts=opts.ItemStyleOpts(color="#F1F54F"))
|
| 341 |
+
.add_yaxis("Nombre decses", [filtered_df_2[filtered_df_2["seriousness/seriousnessdeath"] == 1.0].shape[0]], itemstyle_opts=opts.ItemStyleOpts(color="#FF4B4B"))
|
| 342 |
+
)
|
| 343 |
+
# Affichage du graphique
|
| 344 |
+
st_pyecharts(Nbr_mappi_type_vaccin, height="370px")
|
| 345 |
+
|
| 346 |
+
elif filtre == "Par region" and filtre_1 is None:
|
| 347 |
+
## recalcule des elements par region
|
| 348 |
+
# donnees selon le vaccin "filtered_df_2"
|
| 349 |
+
# liste des mappi grave par region
|
| 350 |
+
mappi_grave = []
|
| 351 |
+
mappi_non_grave = []
|
| 352 |
+
desces = []
|
| 353 |
+
for i in list(region_district.keys()):
|
| 354 |
+
mappi_grave.append(filtered_df_2[(filtered_df_2['seriousness/serious'] == 1.0) & (filtered_df_2["admininfo/states"] == f"{i}")].shape[0])
|
| 355 |
+
mappi_non_grave.append(filtered_df_2[(filtered_df_2['seriousness/serious'] == 2.0) & (filtered_df_2["admininfo/states"] == f"{i}")].shape[0])
|
| 356 |
+
desces.append(filtered_df_2[(filtered_df_2['seriousness/seriousnessdeath'] == 1.0) & (filtered_df_2["admininfo/states"] == f"{i}")].shape[0])
|
| 357 |
+
# afficher le graphe
|
| 358 |
+
district_silencieux_bar = (
|
| 359 |
+
Bar()
|
| 360 |
+
.add_xaxis(list(region_district.keys()))
|
| 361 |
+
.add_yaxis("MAPPI NON GRAVE", mappi_non_grave, itemstyle_opts=opts.ItemStyleOpts(color="#F1F54F"))
|
| 362 |
+
.add_yaxis("MAPPI GRAVE",mappi_grave, itemstyle_opts=opts.ItemStyleOpts(color="#ECA412"))
|
| 363 |
+
.add_yaxis("Desces", desces, itemstyle_opts=opts.ItemStyleOpts(color="#FF4B4B"))
|
| 364 |
+
.set_global_opts(title_opts=opts.TitleOpts(title="Distribution des Régions"))
|
| 365 |
+
)
|
| 366 |
+
# Affichage avec Streamlit
|
| 367 |
+
st_pyecharts(district_silencieux_bar, height="370px")
|
| 368 |
+
|
| 369 |
+
elif filtre == "Par semaine vaccinal" and filtre_1 is None:
|
| 370 |
+
# repartition des MAAPI par semaines vaccinal
|
| 371 |
+
semaine_epidemiologique = list(filtered_df["Semaine_Epid"].unique())
|
| 372 |
+
semaine_epidemiologique.sort()
|
| 373 |
+
_ = []
|
| 374 |
+
for i in semaine_epidemiologique:
|
| 375 |
+
if vaccin_type == "Global":
|
| 376 |
+
temp = filtered_df_2[(filtered_df_2["Semaine_Epid"] == f"{i}")]
|
| 377 |
+
else:
|
| 378 |
+
temp = filtered_df_2[(filtered_df_2["Semaine_Epid"] == f"{i}") & (filtered_df_2["type_Vaccin"] == vaccin_type)]
|
| 379 |
+
_.append(temp.shape[0])
|
| 380 |
+
# evolution des mappi par semaine vaccinal
|
| 381 |
+
MAPPI_semaine_vaccinal_bar = (
|
| 382 |
+
Bar()
|
| 383 |
+
.add_xaxis(semaine_epidemiologique)
|
| 384 |
+
.add_yaxis("Nombre d'apparitions", _)
|
| 385 |
+
.set_global_opts(title_opts=opts.TitleOpts(title="Nombre de MAPPI par semaines vaccinal"))
|
| 386 |
+
)
|
| 387 |
+
st_pyecharts(MAPPI_semaine_vaccinal_bar, width="100%", height="370px")
|
| 388 |
+
|
| 389 |
+
elif filtre_1 is not None:
|
| 390 |
+
# Définition des catégories et valeurs
|
| 391 |
+
labels = ["MAPPI grave", "MAPPI non grave", "Décès"]
|
| 392 |
+
values = [
|
| 393 |
+
filtered_df_2[filtered_df_2['seriousness/serious'] == 1.0].shape[0],
|
| 394 |
+
filtered_df_2[filtered_df_2['seriousness/serious'] == 2.0].shape[0],
|
| 395 |
+
filtered_df_2[filtered_df_2["seriousness/seriousnessdeath"] == 1.0].shape[0]
|
| 396 |
+
]
|
| 397 |
+
|
| 398 |
+
# Création du Pie Chart
|
| 399 |
+
pie_chart = (
|
| 400 |
+
Pie()
|
| 401 |
+
.add("", [list(z) for z in zip(labels, values)])
|
| 402 |
+
.set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {d}%")) # Affichage des pourcentages
|
| 403 |
+
)
|
| 404 |
+
|
| 405 |
+
# Affichage du graphique dans Streamlit
|
| 406 |
+
st_pyecharts(pie_chart, height="370px")
|
| 407 |
+
st.write("___")
|
| 408 |
+
# gestion des district silentieux
|
| 409 |
+
col1,col2= st.columns([3.5,2])
|
| 410 |
+
with col1:
|
| 411 |
+
compte_district_silencieux = st.container(border=True)
|
| 412 |
+
with compte_district_silencieux:
|
| 413 |
+
#distribution = st.pills("filtre distribution", options=["Distribution"], label_visibility="collapsed", key= 1)
|
| 414 |
+
if vaccin_type == "Global":
|
| 415 |
+
region = []
|
| 416 |
+
district = []
|
| 417 |
+
for i in list(region_district.keys()):
|
| 418 |
+
for k in region_district[f"{i}"] :
|
| 419 |
+
if data[data["admininfo/district"] == f"{k}".upper()].shape[0] == 0 :
|
| 420 |
+
region.append(i)
|
| 421 |
+
district.append(k)
|
| 422 |
+
district_silencieux = {
|
| 423 |
+
"Region" : region,
|
| 424 |
+
"District": district
|
| 425 |
+
}
|
| 426 |
+
district_silencieux = pd.DataFrame(district_silencieux)
|
| 427 |
+
region_counts = district_silencieux.Region.value_counts().to_dict()
|
| 428 |
+
regions = list(region_counts.keys())
|
| 429 |
+
counts = list(region_counts.values())
|
| 430 |
+
# Création du graphique
|
| 431 |
+
# bar chart
|
| 432 |
+
district_silencieux_bar = (
|
| 433 |
+
Bar()
|
| 434 |
+
.add_xaxis(regions)
|
| 435 |
+
.add_yaxis("Nombre d'apparitions", counts)
|
| 436 |
+
.set_global_opts(title_opts=opts.TitleOpts(title="Repartition district silencieux"))
|
| 437 |
+
)
|
| 438 |
+
# Affichage avec Streamlit
|
| 439 |
+
st_pyecharts(district_silencieux_bar, height="534px")
|
| 440 |
+
else:
|
| 441 |
+
region = []
|
| 442 |
+
district = []
|
| 443 |
+
for i in list(region_district.keys()):
|
| 444 |
+
for k in region_district[f"{i}"] :
|
| 445 |
+
if filtered_df_2[filtered_df_2["admininfo/district"] == f"{k}".upper()].shape[0] == 0 :
|
| 446 |
+
region.append(i)
|
| 447 |
+
district.append(k)
|
| 448 |
+
district_silencieux = {
|
| 449 |
+
"Region" : region,
|
| 450 |
+
"District": district
|
| 451 |
+
}
|
| 452 |
+
district_silencieux = pd.DataFrame(district_silencieux)
|
| 453 |
+
region_counts = district_silencieux.Region.value_counts().to_dict()
|
| 454 |
+
regions = list(region_counts.keys())
|
| 455 |
+
counts = list(region_counts.values())
|
| 456 |
+
# Création du graphique
|
| 457 |
+
# bar chart
|
| 458 |
+
district_silencieux_bar = (
|
| 459 |
+
Bar()
|
| 460 |
+
.add_xaxis(regions)
|
| 461 |
+
.add_yaxis("Nombre d'apparitions", counts)
|
| 462 |
+
)
|
| 463 |
+
# Affichage avec Streamlit
|
| 464 |
+
st_pyecharts(district_silencieux_bar, height="534px")
|
| 465 |
+
|
| 466 |
+
with col2:
|
| 467 |
+
# carte du nombre de district silencieux
|
| 468 |
+
col = st.columns(2)
|
| 469 |
+
with col[0]:
|
| 470 |
+
nbr_district_silencieux_card = st.container(border=True)
|
| 471 |
+
with nbr_district_silencieux_card:
|
| 472 |
+
st.write("Nombre de district manquant")
|
| 473 |
+
st.subheader(f"{district_silencieux.shape[0]}")
|
| 474 |
+
|
| 475 |
+
with col[1]:
|
| 476 |
+
taux_dabstention_card = st.container(border=True)
|
| 477 |
+
with taux_dabstention_card:
|
| 478 |
+
st.write("Taux de district manquant")
|
| 479 |
+
st.subheader(f"{round((district_silencieux.shape[0]/205)*100,2)} %")
|
| 480 |
+
|
| 481 |
+
st.write("___")
|
| 482 |
+
taux_abstention_region = st.container(border=True)
|
| 483 |
+
with taux_abstention_region:
|
| 484 |
+
_ = []
|
| 485 |
+
for i in list(region_district.keys()): # liste des regions
|
| 486 |
+
# nombre de district de la region
|
| 487 |
+
nbr_region_district = len(region_district[f"{i}"])
|
| 488 |
+
# nombre de district silencieux de la region
|
| 489 |
+
nbr_silenc_region_district = (district_silencieux[district_silencieux.Region == f"{i}"].shape[0])
|
| 490 |
+
_.append((nbr_silenc_region_district/nbr_region_district)*100)
|
| 491 |
+
|
| 492 |
+
taux_de_district_silencieux = {
|
| 493 |
+
"region" : list(region_district.keys()),
|
| 494 |
+
"taux de district silencieux" : [round(k,2) for k in _]
|
| 495 |
+
}
|
| 496 |
+
taux_de_district_silencieux = pd.DataFrame(taux_de_district_silencieux)
|
| 497 |
+
st.dataframe(taux_de_district_silencieux, use_container_width=True)
|
| 498 |
+
# liste des district manquants
|
| 499 |
+
expander_1 = st.expander("Liste des district manquant", expanded=True)
|
| 500 |
+
with expander_1:
|
| 501 |
+
col1, col2 = st.columns([4,1])
|
| 502 |
+
with col1:
|
| 503 |
+
region = st.selectbox("Choisir la region",options=list(region_district.keys()))
|
| 504 |
+
with col2:
|
| 505 |
+
st.write("")
|
| 506 |
+
st.write("")
|
| 507 |
+
btn_1 = st.button("Appliquer", use_container_width=True)
|
| 508 |
+
if btn_1:
|
| 509 |
+
district_silencieux = district_silencieux[district_silencieux["Region"] == f"{region}"]
|
| 510 |
+
st.dataframe(district_silencieux, use_container_width=True)
|
| 511 |
+
else:
|
| 512 |
+
st.dataframe(district_silencieux, use_container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
data_ = None
|
| 7 |
+
|
| 8 |
+
# Initialization
|
| 9 |
+
if 'data' not in st.session_state:
|
| 10 |
+
st.session_state['data'] = None
|
| 11 |
+
|
| 12 |
+
if 'data_file' not in st.session_state:
|
| 13 |
+
st.session_state['data_file'] = None
|
| 14 |
+
|
| 15 |
+
if 'auto_clean_state' not in st.session_state:
|
| 16 |
+
st.session_state['auto_clean_state'] = None
|
| 17 |
+
|
| 18 |
+
if 'dataframe_mappi_region' not in st.session_state:
|
| 19 |
+
st.session_state['dataframe_mappi_region'] = None
|
| 20 |
+
|
| 21 |
+
# chargement des donnees
|
| 22 |
+
@st.cache_data
|
| 23 |
+
def load_data(data_file):
|
| 24 |
+
data = pd.read_excel(data_file)
|
| 25 |
+
return data
|
| 26 |
+
|
| 27 |
+
# fontion de retraits des colonnes vide
|
| 28 |
+
def empty_columns_cleaner(data):
|
| 29 |
+
temp = dict(data.isna().sum())
|
| 30 |
+
_ = []
|
| 31 |
+
for i in list(data.columns):
|
| 32 |
+
if temp[f"{i}"] == data.shape[0] :
|
| 33 |
+
_.append(i)
|
| 34 |
+
data.drop(columns=f"{i}", inplace=True)
|
| 35 |
+
return _
|
| 36 |
+
|
| 37 |
+
# fonction de retrait des colonnes avec une valeur unique
|
| 38 |
+
def remove_one_columns_values(data):
|
| 39 |
+
_ = []
|
| 40 |
+
for i in list(data.columns):
|
| 41 |
+
if len(list(data[f"{i}"].unique())) == 1:
|
| 42 |
+
data.drop(columns=f"{i}", inplace=True)
|
| 43 |
+
_.append(i)
|
| 44 |
+
return _
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
## gestion de l'importation et de la manipulation des donnees
|
| 48 |
+
|
| 49 |
+
# importation et previsualisation des donnees
|
| 50 |
+
if st.session_state['data_file'] is None:
|
| 51 |
+
data_file = "DATA.xlsx"
|
| 52 |
+
st.session_state['data_file'] = data_file
|
| 53 |
+
else:
|
| 54 |
+
data_file = st.session_state['data_file']
|
| 55 |
+
|
| 56 |
+
if data_file :
|
| 57 |
+
data = load_data(data_file)
|
| 58 |
+
# remplacement
|
| 59 |
+
st.session_state["data"] = data
|
| 60 |
+
|
| 61 |
+
# afficher le jeu de donnees initiale
|
| 62 |
+
st.header("Previsualisation des donnees pre-nettoyage")
|
| 63 |
+
# creation des filtres et des fonctions d'explorations
|
| 64 |
+
form_1 = st.form("filtre")
|
| 65 |
+
with form_1:
|
| 66 |
+
list_colonne = st.multiselect("Choisir les colonnes a appliquer", options=list(data.columns), )
|
| 67 |
+
list_ligne = st.select_slider("Choisir les lignes a afficher", options=[i for i in range(0,data.shape[0])], value=(0,int(data.shape[0]-1)))
|
| 68 |
+
col3, col4 = st.columns([4,1])
|
| 69 |
+
with col3:
|
| 70 |
+
btn_3 = st.form_submit_button("Appliquer", use_container_width=True)
|
| 71 |
+
if btn_3:
|
| 72 |
+
if list_colonne :
|
| 73 |
+
data_ = data.loc[:,list(list_colonne)]
|
| 74 |
+
if list_ligne:
|
| 75 |
+
data_ = data_.iloc[[i for i in range(list_ligne[0], list_ligne[1]+1)]]
|
| 76 |
+
else:
|
| 77 |
+
if list_ligne:
|
| 78 |
+
data_ = data
|
| 79 |
+
data_ = data_.iloc[[i for i in range(list_ligne[0], list_ligne[1]+1)]]
|
| 80 |
+
with col4:
|
| 81 |
+
btn_4 = st.form_submit_button("Reinitialiser",use_container_width=True)
|
| 82 |
+
if btn_4:
|
| 83 |
+
list_colonne.clear()
|
| 84 |
+
list_ligne = ()
|
| 85 |
+
|
| 86 |
+
# choix des colonnees a afficher
|
| 87 |
+
|
| 88 |
+
expander_1 = st.expander("Previsualisation des donnees pre-nettoyage", expanded=True)
|
| 89 |
+
with expander_1:
|
| 90 |
+
if data_ is None:
|
| 91 |
+
st.dataframe(data)
|
| 92 |
+
else:
|
| 93 |
+
st.dataframe(data_)
|
| 94 |
+
st.write("___")
|
| 95 |
+
|
| 96 |
+
if st.session_state['auto_clean_state'] == None :
|
| 97 |
+
form_2 = st.form(key="form_1")
|
| 98 |
+
with form_2:
|
| 99 |
+
form_2.subheader("Souhaiter vous nettoyer automatiquement les donnees ?")
|
| 100 |
+
col1,col2 = st.columns([1,1])
|
| 101 |
+
with col1:
|
| 102 |
+
btn_1 = st.form_submit_button("Accepter", use_container_width=True)
|
| 103 |
+
if btn_1:
|
| 104 |
+
st.session_state['auto_clean_state'] = True
|
| 105 |
+
st.rerun()
|
| 106 |
+
with col2:
|
| 107 |
+
btn_2 = st.form_submit_button("Refuser", use_container_width=True)
|
| 108 |
+
if btn_2:
|
| 109 |
+
st.session_state['auto_clean_state'] = False
|
| 110 |
+
st.rerun()
|
| 111 |
+
st.write("___")
|
| 112 |
+
|
| 113 |
+
if st.session_state['auto_clean_state'] == True :
|
| 114 |
+
# netoyage des donnees
|
| 115 |
+
st.header("Nettoyage des donnees")
|
| 116 |
+
expander_2 = st.expander("Liste des operations")
|
| 117 |
+
with expander_2:
|
| 118 |
+
st.subheader("Retrait des colonnes vides")
|
| 119 |
+
st.write("Liste des colonnes vides supprimer")
|
| 120 |
+
_ = empty_columns_cleaner(data)
|
| 121 |
+
st.write(_)
|
| 122 |
+
st.subheader("Retrait des colonnes mono-value")
|
| 123 |
+
st.write("Liste des colonnes mono-value")
|
| 124 |
+
_ = remove_one_columns_values(data)
|
| 125 |
+
st.write(_)
|
| 126 |
+
st.session_state["data"] = data
|
| 127 |
+
st.write("___")
|
| 128 |
+
# afficher le je de donnees nettoyer
|
| 129 |
+
|
| 130 |
+
else :
|
| 131 |
+
st.warning("Veuillez selectionner le fichier a traiter")
|
| 132 |
+
|
Visualisation.py
ADDED
|
@@ -0,0 +1,552 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
from streamlit_option_menu import option_menu
|
| 4 |
+
import random
|
| 5 |
+
from streamlit_echarts import st_pyecharts
|
| 6 |
+
from streamlit_echarts import st_echarts
|
| 7 |
+
from pyecharts.charts import Bar
|
| 8 |
+
from pyecharts.charts import Pie
|
| 9 |
+
from pyecharts import options as opts
|
| 10 |
+
|
| 11 |
+
region_district = {
|
| 12 |
+
"ADAMAOUA" : ["Bankim","Banyo","Belel","Dang","Djohong","Meiganga","Ngaoundal","Ngaoundere Rural","Ngaoundere Urbain","Tibati","Tignere"],
|
| 13 |
+
"CENTRE" : ["Akonolinga","Awae","Ayos","Bafia","Biyem Assi","Cite Verte","Djoungolo","Ebebda","Efoulan","Elig Mfomo","Eseka","Esse","Evodoula","Mbalmayo","Mbandjock","Mbankomo","Mfou","Monatele","Mvog-Ada","Nanga Eboko","Ndikinimeki","Ngog Mapubi","Ngoumou","Nkolbisson","Nkolndongo","Ntui","Obala","Odza","Okola","Sa'a","Soa","Yoko"],
|
| 14 |
+
"EST": ["Abong Mbang","Batouri","Belabo","Bertoua","Betare Oya","Doume","Garoua Boulai","Kette","Lomie","Mbang","Messamena","Moloundou","Ndelele","Nguelemendouka","Yokadouma"],
|
| 15 |
+
"EXTREME NORD" : ["Bogo","Bourha","Fotokol","Gazawa","Goulfey","Guere","Guidiguis","Hina","Kaele","Kar Hay","Kolofata","Kousseri","Koza","Mada","Maga","Makary","Maroua 1","Maroua 2","Maroua 3","Meri","Mindif","Mogode","Mokolo","Mora","Moulvoudaye","Moutourwa","Mozogo","Pette","Roua","Tokombere","Vele","Waza","Yagoua"],
|
| 16 |
+
"LITTORAL": ["Abo","Bangue","Boko","Bonassama","Cite Des Palmiers","Deido","Dibombari","Edea","Japoma","Logbaba","Loum","Manjo","Manoka","Mbanga","Melong","Ndom","New Bell","Ngambe","Njombe Penja","Nkondjock","Nkongsamba","Nylon","Pouma","Yabassi"],
|
| 17 |
+
"NORD" : ["Bibemi","Figuil","Garoua I","Garoua II","Gaschiga","Golombe","Guider","Lagdo","Mayo Oulo","Ngong","Pitoa","Poli","Rey Bouba","Tchollire","Touboro"],
|
| 18 |
+
"NORD OUEST" : ["Ako","Bafut","Bali","Bamenda","Bamenda 3","Batibo","Benakuma","Fundong","Kumbo East","Kumbo West","Mbengwi","Misaje","Ndop","Ndu","Njikwa","Nkambe","Nwa","Oku","Santa","Tubah","Wum"],
|
| 19 |
+
"OUEST" : ["Bafang","Baham","Bamendjou","Bandja","Bandjoun","Bangangte","Bangourain","Batcham","Dschang","Foumban","Foumbot","Galim","Kekem","Kouoptamo","Malantouen","Massangam","Mbouda","Mifi","Penka Michel","Santchou"],
|
| 20 |
+
"SUD" : ["Ambam","Djoum","Ebolowa","Kribi","Kye ossi","Lolodorf","Meyomessala","Mintom","Mvangan","Niete","Olamze","Sangmelima","Zoetele"],
|
| 21 |
+
"SUD OUEST": ["Akwaya","Bakassi","Bamusso","Bangem","Buea","Ekondo Titi","Eyumodjock","Fontem","Konye","Kumba North","Kumba South","Limbe","Mamfe","Mbonge","Mundemba","Muyuka","Nguti","Tiko","Toko","Tombel","Wabane"]
|
| 22 |
+
}
|
| 23 |
+
liste_vaccin = ['YELLOW FEVER', 'Penta', 'VPO', 'VPI', 'nOPV2', 'TD','Mosquirix', 'PCV13', 'MEASLES', 'BCG', 'Janssen', 'Rota', 'MENINGO', 'HPV', 'Mencevax']
|
| 24 |
+
liste_signe_symptome = {
|
| 25 |
+
|
| 26 |
+
"code" : [ 10022044,10001497,10002198,10002034,10002424,10061093,10002847,10002855,10003553,10049535,10069633,10060800,10006482,10005169,10005177,10019211,10002199,10011042,10010741,
|
| 27 |
+
10012373,10039906,10039083,10011703,10047555,10012174,10040844,10038687,10012735,10033371,10022086,10008479,10000081,10003239,10028411,10000084,10013968,10014625,10000087,
|
| 28 |
+
10015150,10041232,10042772,10028372,10016256,10037660,10033775,10008531,10025197,10018762,10019465,10018910,10039424,10020642,10020772,10071552,10021097,10023126,10022075,
|
| 29 |
+
10061218,10022437,10024264,10020937,10068319,10021089,10028813,10029864,10030095,10070774,10052139,10016029,10030302,10076569,10016062,10033799,10034037,10061428,10024855,
|
| 30 |
+
10017577,10061461,10005191,10042128,10011469,10037087,10052140,10052904,10037844,10020751,10058605,10080283,10030071,10039101,10022061,10030041,10055798,10040047,10015727,
|
| 31 |
+
10041349,10042241,10011878,10043071,10043089,10069381,10011224,10027327,10053425,10046735,10069555,10047340,10047513,100475132,10047700],
|
| 32 |
+
|
| 33 |
+
"symptome" : ["Abcès au point d'injection", "Agitation", "Anaphylaxie", "Anémie", "Angioedème (généralisé ou localisé)", "Anomalies des nerfs crâniens", "Anurie",
|
| 34 |
+
"Anxiété", "Asthme", "Autres", "Baisse ou absence du contact visuel", "Bouffées de chaleur", "Bronchospame", "Cécité", "Cécité corticale",
|
| 35 |
+
"Céphalées", "Choc anaphylactique", "Clignement", "Conjonctivite", "Conscience altérée", "Convulsions", "Coryza", "Cyanose", "Déficit du champ visuel",
|
| 36 |
+
"Déshydratation", "Desquamation", "Détresse respiratoire", "Diarrhée", "Douleur", "Douleur au point d'injection", "Douleur thoracique", "Douleurs abdominales",
|
| 37 |
+
"Douleurs articulaires", "Douleurs musculaires", "Douleurs pelviennes", "Dyspnée", "Encéphalopathie", "Epigastralgie", "Erythème","Eternuement","Evanouissement/Syncope",
|
| 38 |
+
"Faiblesse motrice", "Fatigue / Prostration", "Fièvre", "Fourmillements", "Frissons", "Ganglion", "Geignement", "Hémiparésie", "Hémolyse", "Hypersalivation / hypersialorrhée",
|
| 39 |
+
"Hypersudation / Hyperhidrose", "Hypertension", "Hyporéactivité", "Hypotension", "Ictère", "Induration au point d'injection", "Inflammation", "Insomnie",
|
| 40 |
+
"Léthargie", "Lourdeur des membres", "Maux de gorge", "Modification des réflexes tendineux (hypo / hyper asymetrie)", "Nausée", "Nystagmus cérébelleux",
|
| 41 |
+
"Œdème", "Œdème des voies respiratoires hautes (lèvres, gorge, palais ou larynx)", "Œdème des yeux", "Œdème facial", "Oligurie", "Ophtalmoparésie", "Paralysie faciale",
|
| 42 |
+
"Paralysie flasque aiguë", "Parotidite", "Perte d'appétit (anorexie)", "Perte de connaissance", "Perte de l'équilibre", "Perturbations de la fonction érectile",
|
| 43 |
+
"Phlyctènes", "Plaies buccales", "Pleurs persistentes (> 3 heures)", "Prurit", "Prurit occulaire", "Raideur nucale", "Rash", "Réaction allergique", "Réflexe de moue succion",
|
| 44 |
+
"Refus de téter","Révulsion oculaire","Rhume", "Rougeur au point d'injection", "Rougeur des yeux", "Saignement (hémorrhagie)", "Sepsis", "Signes de Babinski", "Somnolence", "Stridor", "Surdité",
|
| 45 |
+
"Tachycardie, palpitations", "Tachypnée", "Temps de remplissage capillaire > 3s", "Toux", "Troubles du cycle menstruel", "Tuméfaction au point d'injection",
|
| 46 |
+
"Urticaire", "Utilisation excessive des muscles respiratoires accessoires", "Vertige", "Vision floue", "Voix rauque", "Vomissements"]
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
# Initialization
|
| 50 |
+
if 'data' not in st.session_state:
|
| 51 |
+
st.session_state['data'] = None
|
| 52 |
+
|
| 53 |
+
if 'data_file_2' not in st.session_state:
|
| 54 |
+
st.session_state['data_file_2'] = None
|
| 55 |
+
|
| 56 |
+
if 'data_2' not in st.session_state:
|
| 57 |
+
st.session_state['data_2'] = None
|
| 58 |
+
|
| 59 |
+
if 'dataframe_mappi_region' not in st.session_state:
|
| 60 |
+
st.session_state['dataframe_mappi_region'] = None
|
| 61 |
+
|
| 62 |
+
if st.session_state['data'] is None:
|
| 63 |
+
st.warning("Veuillez entrer les données")
|
| 64 |
+
else :
|
| 65 |
+
data = st.session_state['data']
|
| 66 |
+
nav_bar1 = option_menu(None,
|
| 67 |
+
["District silencieux", "Repartition des MAPPI"],
|
| 68 |
+
icons=['file-earmark-bar-graph-fill'],
|
| 69 |
+
menu_icon="cast",
|
| 70 |
+
default_index=0,
|
| 71 |
+
orientation="horizontal")
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
## gestion des districts silencieux
|
| 75 |
+
if nav_bar1 == "District silencieux":
|
| 76 |
+
region = []
|
| 77 |
+
district = []
|
| 78 |
+
col1, col2, col3 = st.columns([2,5,1])
|
| 79 |
+
# creation du csv des district silencieux
|
| 80 |
+
with col1 :
|
| 81 |
+
for i in list(region_district.keys()):
|
| 82 |
+
for k in region_district[f"{i}"] :
|
| 83 |
+
if data[data["admininfo/district"] == f"{k}".upper()].shape[0] == 0 :
|
| 84 |
+
region.append(i)
|
| 85 |
+
district.append(k)
|
| 86 |
+
district_silencieux = {
|
| 87 |
+
"Region" : region,
|
| 88 |
+
"District": district
|
| 89 |
+
}
|
| 90 |
+
district_silencieux = pd.DataFrame(district_silencieux)
|
| 91 |
+
st.write(district_silencieux)
|
| 92 |
+
st.write("Nombre de district silencieux : ", district_silencieux.shape[0])
|
| 93 |
+
st.write("Nombre de district present : ", len(list(data["admininfo/district"].unique())))
|
| 94 |
+
|
| 95 |
+
# graphe de visualisation des district silencieux
|
| 96 |
+
with col2:
|
| 97 |
+
region_counts = district_silencieux.Region.value_counts().to_dict()
|
| 98 |
+
regions = list(region_counts.keys())
|
| 99 |
+
counts = list(region_counts.values())
|
| 100 |
+
# Création du graphique
|
| 101 |
+
# bar chart
|
| 102 |
+
district_silencieux_bar = (
|
| 103 |
+
Bar()
|
| 104 |
+
.add_xaxis(regions)
|
| 105 |
+
.add_yaxis("Nombre d'apparitions", counts)
|
| 106 |
+
.set_global_opts(title_opts=opts.TitleOpts(title="Distribution des Régions"))
|
| 107 |
+
)
|
| 108 |
+
# Affichage avec Streamlit
|
| 109 |
+
st_pyecharts(district_silencieux_bar, height="470px")
|
| 110 |
+
|
| 111 |
+
with col3:
|
| 112 |
+
# liste des district par region
|
| 113 |
+
seleteur_1 = st.selectbox("Liste des district silencieux par region", options = list(district_silencieux["Region"].unique()))
|
| 114 |
+
_ = []
|
| 115 |
+
for i in list(district_silencieux.District[district_silencieux.Region == f"{seleteur_1}"]):
|
| 116 |
+
_.append(i)
|
| 117 |
+
st.write(_)
|
| 118 |
+
|
| 119 |
+
st.write("___")
|
| 120 |
+
|
| 121 |
+
col1, col2 = st.columns([1,4])
|
| 122 |
+
with col2:
|
| 123 |
+
# Création du pie chart complet (sans donut)
|
| 124 |
+
district_silencieux_pie = (
|
| 125 |
+
Pie()
|
| 126 |
+
.add("", [list(z) for z in zip(regions, counts)])
|
| 127 |
+
.set_global_opts(title_opts=opts.TitleOpts(title=""))
|
| 128 |
+
.set_series_opts(
|
| 129 |
+
label_opts=opts.LabelOpts(formatter = "{b}: ({d}%)",
|
| 130 |
+
position = "inside", # Met le texte à l'intérieur du camembert
|
| 131 |
+
font_size = 12,
|
| 132 |
+
rotate = "radial") # Affichage des pourcentages
|
| 133 |
+
)
|
| 134 |
+
)
|
| 135 |
+
st_pyecharts(district_silencieux_pie, height="590px")
|
| 136 |
+
with col1:
|
| 137 |
+
# Taux de district silencieux par region
|
| 138 |
+
st.subheader("Taux d'abstention par region")
|
| 139 |
+
_ = []
|
| 140 |
+
for i in list(region_district.keys()): # liste des regions
|
| 141 |
+
# nombre de district de la region
|
| 142 |
+
nbr_region_district = len(region_district[f"{i}"])
|
| 143 |
+
# nombre de district silencieux de la region
|
| 144 |
+
nbr_silenc_region_district = (district_silencieux[district_silencieux.Region == f"{i}"].shape[0])
|
| 145 |
+
_.append((nbr_silenc_region_district/nbr_region_district)*100)
|
| 146 |
+
|
| 147 |
+
taux_de_district_silencieux = {
|
| 148 |
+
"region" : list(region_district.keys()),
|
| 149 |
+
"taux de district silencieux" : [f"{round(k,2)}%" for k in _]
|
| 150 |
+
}
|
| 151 |
+
taux_de_district_silencieux = pd.DataFrame(taux_de_district_silencieux)
|
| 152 |
+
st.dataframe(taux_de_district_silencieux, use_container_width = False)
|
| 153 |
+
expander_2 = st.expander("District silentieux ", expanded=True)
|
| 154 |
+
with expander_2:
|
| 155 |
+
if st.session_state['data_file_2'] is None:
|
| 156 |
+
data_file_2 = "data2.xlsx"
|
| 157 |
+
st.session_state['data_file_2'] = data_file_2
|
| 158 |
+
else:
|
| 159 |
+
data_file_2 = st.session_state['data_file_2']
|
| 160 |
+
|
| 161 |
+
if data_file_2:
|
| 162 |
+
data_2 = pd.read_excel(data_file_2, engine="openpyxl")
|
| 163 |
+
data_2['q6_district'] = data_2['q6_district'].str.replace('_', ' ')
|
| 164 |
+
data_2['q6_district'] = data_2['q6_district'].str.replace('-', ' ')
|
| 165 |
+
# determiner les district silencieux
|
| 166 |
+
region_2 = []
|
| 167 |
+
district_2 = []
|
| 168 |
+
col1, col2, col3 = st.columns([2,5,1])
|
| 169 |
+
# creation du csv des district silencieux
|
| 170 |
+
with col1 :
|
| 171 |
+
for i in list(region_district.keys()):
|
| 172 |
+
for k in region_district[f"{i}"] :
|
| 173 |
+
if data_2[data_2["q6_district"] == f"{k}"].shape[0] == 0 :
|
| 174 |
+
region_2.append(i)
|
| 175 |
+
district_2.append(k)
|
| 176 |
+
district_silencieux_2 = {
|
| 177 |
+
"Region" : region_2,
|
| 178 |
+
"District": district_2
|
| 179 |
+
}
|
| 180 |
+
col1, col2 = st.columns([5,9])
|
| 181 |
+
with col1:
|
| 182 |
+
district_silencieux_2 = pd.DataFrame(district_silencieux_2)
|
| 183 |
+
st.write(district_silencieux_2)
|
| 184 |
+
st.write("Nombre de district silencieux : ", district_silencieux_2.shape[0])
|
| 185 |
+
st.write()
|
| 186 |
+
with col2:
|
| 187 |
+
region_2_counts = district_silencieux_2.Region.value_counts().to_dict()
|
| 188 |
+
regions_2 = list(region_2_counts.keys())
|
| 189 |
+
counts_2 = list(region_2_counts.values())
|
| 190 |
+
district_silencieux_2_bar = (
|
| 191 |
+
Bar()
|
| 192 |
+
.add_xaxis(regions_2)
|
| 193 |
+
.add_yaxis("Nombre d'apparitions", counts_2)
|
| 194 |
+
)
|
| 195 |
+
# Affichage avec Streamlit
|
| 196 |
+
st_pyecharts(district_silencieux_2_bar, height="370px")
|
| 197 |
+
|
| 198 |
+
st.write("___")
|
| 199 |
+
if data_file_2:
|
| 200 |
+
expander_3 = st.expander("District silencieux absolue",expanded=True)
|
| 201 |
+
with expander_3:
|
| 202 |
+
st.header("Synthese")
|
| 203 |
+
col1, col2 = st.columns([5,9])
|
| 204 |
+
with col1:
|
| 205 |
+
df_common = district_silencieux.merge(district_silencieux_2, how='inner')
|
| 206 |
+
st.write(df_common)
|
| 207 |
+
st.write("Nombre de district silencieux : ", df_common.shape[0])
|
| 208 |
+
st.write()
|
| 209 |
+
with col2:
|
| 210 |
+
region_2_counts = df_common .Region.value_counts().to_dict()
|
| 211 |
+
regions_2 = list(region_2_counts.keys())
|
| 212 |
+
counts_2 = list(region_2_counts.values())
|
| 213 |
+
district_silencieux_2_bar = (
|
| 214 |
+
Bar()
|
| 215 |
+
.add_xaxis(regions_2)
|
| 216 |
+
.add_yaxis("Nombre d'apparitions", counts_2)
|
| 217 |
+
)
|
| 218 |
+
# Affichage avec Streamlit
|
| 219 |
+
st_pyecharts(district_silencieux_2_bar, height="370px")
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
if nav_bar1 == "Repartition des MAPPI":
|
| 223 |
+
nav_bar2 = option_menu(None,
|
| 224 |
+
["Carte" ,"Par region", "Par semaine vaccinal", "Par vaccin"],
|
| 225 |
+
icons=['file-earmark-bar-graph-fill','file-earmark-bar-graph-fill', 'file-earmark-bar-graph-fill', 'file-earmark-bar-graph-fill'],
|
| 226 |
+
menu_icon="cast",
|
| 227 |
+
default_index=1,
|
| 228 |
+
orientation="horizontal")
|
| 229 |
+
|
| 230 |
+
if nav_bar2 == "Par region" :
|
| 231 |
+
expander_1 = st.expander("database Mapp par region", expanded=False)
|
| 232 |
+
with expander_1:
|
| 233 |
+
|
| 234 |
+
nbr_mappi_region = []
|
| 235 |
+
|
| 236 |
+
for i in list(region_district.keys()):
|
| 237 |
+
x = data[data["admininfo/states"] == f"{i}"]
|
| 238 |
+
filtered_df = x[x['type_Vaccin'].isin(liste_vaccin)]
|
| 239 |
+
nbr_mappi_region.append(filtered_df.shape[0])
|
| 240 |
+
|
| 241 |
+
# filtrage MAPPI grave
|
| 242 |
+
filtered_df = data[data['type_Vaccin'].isin(liste_vaccin)] # filtrage du jeu de donnees
|
| 243 |
+
# compter le nombre de mappi grave par region
|
| 244 |
+
mappi_grave = []
|
| 245 |
+
for i in list(region_district.keys()):
|
| 246 |
+
temp = filtered_df[filtered_df["admininfo/states"] == f"{i}"]
|
| 247 |
+
mappi_grave.append(temp[temp["seriousness/serious"] == 1.0].shape[0])
|
| 248 |
+
# deduire le nombre de MAPPI non grave
|
| 249 |
+
mappi_non_grave = []
|
| 250 |
+
for i in range(0,10):
|
| 251 |
+
mappi_non_grave.append(nbr_mappi_region[i] - mappi_grave[i])
|
| 252 |
+
|
| 253 |
+
# nombre de deces
|
| 254 |
+
nbr_deces = []
|
| 255 |
+
for i in list(region_district.keys()):
|
| 256 |
+
temp = filtered_df[filtered_df["admininfo/states"] == f"{i}"]
|
| 257 |
+
nbr_deces.append(temp[temp["seriousness/seriousnessdeath"] == 1.0].shape[0])
|
| 258 |
+
|
| 259 |
+
dataframe_mappi_region = {
|
| 260 |
+
"region": list(region_district.keys()),
|
| 261 |
+
"Nombre de MAPPI" : nbr_mappi_region,
|
| 262 |
+
"Nombre de MAPPI non grave": mappi_non_grave,
|
| 263 |
+
"Nombre de MAPPI grave": mappi_grave,
|
| 264 |
+
"Nombre de deces" : nbr_deces
|
| 265 |
+
}
|
| 266 |
+
dataframe_mappi_region = pd.DataFrame(dataframe_mappi_region)
|
| 267 |
+
st.session_state['dataframe_mappi_region'] = dataframe_mappi_region
|
| 268 |
+
|
| 269 |
+
st.dataframe(dataframe_mappi_region, use_container_width = True)
|
| 270 |
+
col = st.columns(4)
|
| 271 |
+
with col[0]:
|
| 272 |
+
st.write("Nombre totale de MAPPI : ", sum(nbr_mappi_region))
|
| 273 |
+
with col[1]:
|
| 274 |
+
st.write("Nombre totale de MAPPI grave: ", sum(mappi_grave))
|
| 275 |
+
with col[2]:
|
| 276 |
+
st.write("Nombre totale de MAPPI non grave: ", sum(mappi_non_grave))
|
| 277 |
+
with col[3]:
|
| 278 |
+
st.write("Nombre de deces", sum(nbr_deces))
|
| 279 |
+
st.write("___")
|
| 280 |
+
|
| 281 |
+
col1, col2 = st.columns([4,1])
|
| 282 |
+
with col2:
|
| 283 |
+
# filtre
|
| 284 |
+
form_1 = st.form("Filtre")
|
| 285 |
+
with form_1:
|
| 286 |
+
seleteur_2 = st.multiselect("choisisez la/les regions", options=list(region_district.keys()))
|
| 287 |
+
btn_1 = st.form_submit_button("Appliquer", use_container_width=True)
|
| 288 |
+
btn_2 = st.form_submit_button("Reinitialiser", use_container_width=True)
|
| 289 |
+
|
| 290 |
+
if btn_2:
|
| 291 |
+
btn_1 = False
|
| 292 |
+
|
| 293 |
+
with col1:
|
| 294 |
+
if btn_1 and len(seleteur_2) > 0:
|
| 295 |
+
_1_ = []
|
| 296 |
+
_2_ = []
|
| 297 |
+
_3_ = []
|
| 298 |
+
|
| 299 |
+
for i in seleteur_2:
|
| 300 |
+
_1_.append(mappi_non_grave[list(region_district.keys()).index(i)])
|
| 301 |
+
_2_.append(mappi_grave[list(region_district.keys()).index(i)])
|
| 302 |
+
_3_.append(nbr_deces[list(region_district.keys()).index(i)])
|
| 303 |
+
|
| 304 |
+
district_silencieux_bar = (
|
| 305 |
+
Bar()
|
| 306 |
+
.add_xaxis(seleteur_2)
|
| 307 |
+
.add_yaxis("MAPPI NON GRAVE", _1_, itemstyle_opts=opts.ItemStyleOpts(color="#F1F54F"))
|
| 308 |
+
.add_yaxis("MAPPI GRAVE", _2_, itemstyle_opts=opts.ItemStyleOpts(color="#FF4B4B"))
|
| 309 |
+
.add_yaxis("Desces", _3_, itemstyle_opts=opts.ItemStyleOpts(color="#FF4B4B"))
|
| 310 |
+
.set_global_opts(title_opts=opts.TitleOpts(title="Distribution des Régions"))
|
| 311 |
+
)
|
| 312 |
+
# Affichage avec Streamlit
|
| 313 |
+
st_pyecharts(district_silencieux_bar, height="470px")
|
| 314 |
+
|
| 315 |
+
else:
|
| 316 |
+
district_silencieux_bar = (
|
| 317 |
+
Bar()
|
| 318 |
+
.add_xaxis(list(region_district.keys()))
|
| 319 |
+
.add_yaxis("MAPPI NON GRAVE", mappi_non_grave, itemstyle_opts=opts.ItemStyleOpts(color="#F1F54F"))
|
| 320 |
+
.add_yaxis("MAPPI GRAVE", mappi_grave, itemstyle_opts=opts.ItemStyleOpts(color="#FF4B4B"))
|
| 321 |
+
.add_yaxis("Desces", nbr_deces, itemstyle_opts=opts.ItemStyleOpts(color="#FF4B4B"))
|
| 322 |
+
.set_global_opts(title_opts=opts.TitleOpts(title="Distribution des Régions"))
|
| 323 |
+
)
|
| 324 |
+
# Affichage avec Streamlit
|
| 325 |
+
st_pyecharts(district_silencieux_bar, height="470px")
|
| 326 |
+
|
| 327 |
+
elif nav_bar2 == "Par semaine vaccinal" :
|
| 328 |
+
|
| 329 |
+
# filtrage MAPPI grave
|
| 330 |
+
filtered_df = data[data['type_Vaccin'].isin(liste_vaccin)] # filtrage du jeu de donnees
|
| 331 |
+
# liste des semaines vaccinales
|
| 332 |
+
semaine_epidemiologique = list(filtered_df["Semaine_Epid"].unique())
|
| 333 |
+
semaine_epidemiologique.sort()
|
| 334 |
+
|
| 335 |
+
selecteur_3 = st.selectbox("Choisissez le type de vacin", options = liste_vaccin)
|
| 336 |
+
# repartition des MAAPI par semaines vaccinal
|
| 337 |
+
_ = []
|
| 338 |
+
for i in semaine_epidemiologique:
|
| 339 |
+
temp = filtered_df[(filtered_df["Semaine_Epid"] == f"{i}") & (filtered_df["type_Vaccin"] == selecteur_3)]
|
| 340 |
+
_.append(temp.shape[0])
|
| 341 |
+
# evolution des mappi par semaine vaccinal
|
| 342 |
+
MAPPI_semaine_vaccinal_bar = (
|
| 343 |
+
Bar()
|
| 344 |
+
.add_xaxis(semaine_epidemiologique)
|
| 345 |
+
.add_yaxis("Nombre d'apparitions", _)
|
| 346 |
+
.set_global_opts(title_opts=opts.TitleOpts(title="Nombre de MAPPI par semaines vaccinal"))
|
| 347 |
+
)
|
| 348 |
+
st_pyecharts(MAPPI_semaine_vaccinal_bar, width="100%", height="600px")
|
| 349 |
+
|
| 350 |
+
elif nav_bar2 == "Par vaccin":
|
| 351 |
+
selecteur_5 = st.selectbox("Choisir le Vaccin", options=liste_vaccin, index=0)
|
| 352 |
+
col = st.columns(2)
|
| 353 |
+
with col[0]:
|
| 354 |
+
# filtre par sex:
|
| 355 |
+
filtre_sex = st.toggle("Sexe")
|
| 356 |
+
with col[1]:
|
| 357 |
+
# filtre par tranche d'age
|
| 358 |
+
list_tranche_dage = list(dict(data.Tranche_Age.value_counts()).keys())
|
| 359 |
+
filtre_tranche_age = st.toggle("Tranche d'Age")
|
| 360 |
+
|
| 361 |
+
|
| 362 |
+
# filtre des donnees selon les vaccin
|
| 363 |
+
filtered_df = data[data['type_Vaccin'].isin(liste_vaccin)]
|
| 364 |
+
# filtre selon le vaccin choisis
|
| 365 |
+
filtered_df_2 = filtered_df[filtered_df["type_Vaccin"] == selecteur_5]
|
| 366 |
+
# compte du nombre de MAPPI
|
| 367 |
+
nbr_mappi = filtered_df_2.shape[0]
|
| 368 |
+
# determination du nombre de mappi grave
|
| 369 |
+
nbr_mappi_grave = filtered_df_2[filtered_df_2["seriousness/serious"] == 1.0].shape[0]
|
| 370 |
+
# determination du nombre de mappi non grave
|
| 371 |
+
nbr_mappi_non_grave = nbr_mappi - nbr_mappi_grave
|
| 372 |
+
col = st.columns(3)
|
| 373 |
+
with col[0]:
|
| 374 |
+
st.write(f"Nombre de MAPPI : {nbr_mappi}")
|
| 375 |
+
with col[1]:
|
| 376 |
+
st.write(f"Nombre de mappi grave : {nbr_mappi_grave}")
|
| 377 |
+
with col[2]:
|
| 378 |
+
st.write(f"Nombre de mappi non grave : {nbr_mappi_non_grave}")
|
| 379 |
+
st.write("___")
|
| 380 |
+
|
| 381 |
+
if filtre_sex == True and filtre_tranche_age == False:
|
| 382 |
+
## filtre du nombre de mappi grave par sexe
|
| 383 |
+
filtered_df_3 = filtered_df_2[filtered_df_2["seriousness/serious"] == 1.0]
|
| 384 |
+
mappi_grave_homme = filtered_df_3[filtered_df_3["Sexe"] == "Masculin"].shape[0]
|
| 385 |
+
mappi_grave_femme = filtered_df_3[filtered_df_3["Sexe"] != "Masculin"].shape[0]
|
| 386 |
+
## filtre mappi non grave par sexe
|
| 387 |
+
filtered_df_3 = filtered_df_2[filtered_df_2["seriousness/serious"] == 2.0]
|
| 388 |
+
mappi_non_grave_homme = filtered_df_3[filtered_df_3["Sexe"] == "Masculin"].shape[0]
|
| 389 |
+
mappi_non_grave_femme = filtered_df_3[filtered_df_3["Sexe"] != "Masculin"].shape[0]
|
| 390 |
+
col = st.columns(2)
|
| 391 |
+
with col[0]:
|
| 392 |
+
st.subheader("HOMME")
|
| 393 |
+
## graphe
|
| 394 |
+
Nbr_mappi_type_vaccin_homme = (
|
| 395 |
+
Bar()
|
| 396 |
+
.add_xaxis([selecteur_5]) # X-axis avec le vaccin sélectionné
|
| 397 |
+
.add_yaxis("Nombre de MAPPI non grave (HOMME)", [mappi_non_grave_homme])
|
| 398 |
+
.add_yaxis("Nombre de MAPPI grave (HOMME)", [mappi_grave_homme], itemstyle_opts=opts.ItemStyleOpts(color="#FF4B4B"))
|
| 399 |
+
)
|
| 400 |
+
|
| 401 |
+
# Affichage avec Streamlit
|
| 402 |
+
st_pyecharts(Nbr_mappi_type_vaccin_homme, height="470px")
|
| 403 |
+
|
| 404 |
+
with col[1]:
|
| 405 |
+
st.subheader("FEMME")
|
| 406 |
+
Nbr_mappi_type_vaccin_femme = (
|
| 407 |
+
Bar()
|
| 408 |
+
.add_xaxis([selecteur_5]) # X-axis avec le vaccin sélectionné
|
| 409 |
+
.add_yaxis("Nombre de MAPPI non grave (FEMME)", [mappi_non_grave_femme])
|
| 410 |
+
.add_yaxis("Nombre de MAPPI grave (FEMME)", [mappi_grave_femme], itemstyle_opts=opts.ItemStyleOpts(color="#FF4B4B"))
|
| 411 |
+
)
|
| 412 |
+
|
| 413 |
+
# Affichage avec Streamlit
|
| 414 |
+
st_pyecharts(Nbr_mappi_type_vaccin_femme, height="470px")
|
| 415 |
+
|
| 416 |
+
elif filtre_sex == False and filtre_tranche_age == True:
|
| 417 |
+
_0_1_grave = []
|
| 418 |
+
_1_5_grave = []
|
| 419 |
+
_5_15_grave = []
|
| 420 |
+
_15_18_grave = []
|
| 421 |
+
_18_25_grave = []
|
| 422 |
+
_25_35_grave = []
|
| 423 |
+
_35_45_grave = []
|
| 424 |
+
_45_55_grave = []
|
| 425 |
+
_55_65_grave = []
|
| 426 |
+
_65etPlus_grave = []
|
| 427 |
+
|
| 428 |
+
_0_1_non_grave = []
|
| 429 |
+
_1_5_non_grave = []
|
| 430 |
+
_5_15_non_grave = []
|
| 431 |
+
_15_18_non_grave = []
|
| 432 |
+
_18_25_non_grave = []
|
| 433 |
+
_25_35_non_grave = []
|
| 434 |
+
_35_45_non_grave = []
|
| 435 |
+
_45_55_non_grave = []
|
| 436 |
+
_55_65_non_grave = []
|
| 437 |
+
_65etPlus_non_grave = []
|
| 438 |
+
|
| 439 |
+
filtered_df_3 = filtered_df_2[filtered_df_2["seriousness/serious"] == 1.0]
|
| 440 |
+
filtered_df_4 = filtered_df_2[filtered_df_2["seriousness/serious"] == 2.0]
|
| 441 |
+
for i in list_tranche_dage:
|
| 442 |
+
_ = filtered_df_3[filtered_df_3.Tranche_Age == f"{i}"].shape[0]
|
| 443 |
+
|
| 444 |
+
if i == '[0-1[':
|
| 445 |
+
_0_1_grave.append(_)
|
| 446 |
+
elif i == '[01-05[':
|
| 447 |
+
_1_5_grave.append(_)
|
| 448 |
+
elif i == '[05-15[':
|
| 449 |
+
_5_15_grave.append(_)
|
| 450 |
+
elif i == '[15-18[':
|
| 451 |
+
_15_18_grave.append(_)
|
| 452 |
+
elif i == '[18-25[':
|
| 453 |
+
_18_25_grave.append(_)
|
| 454 |
+
elif i == '[25-35[':
|
| 455 |
+
_25_35_grave.append(_)
|
| 456 |
+
elif i == '[35-45[':
|
| 457 |
+
_35_45_grave.append(_)
|
| 458 |
+
elif i == '[45-55[':
|
| 459 |
+
_45_55_grave.append(_)
|
| 460 |
+
elif i == '[55-65[':
|
| 461 |
+
_55_65_grave.append(_)
|
| 462 |
+
elif i == '65etPlus':
|
| 463 |
+
_65etPlus_grave.append(_)
|
| 464 |
+
|
| 465 |
+
for i in list_tranche_dage:
|
| 466 |
+
_ = filtered_df_4[filtered_df_4.Tranche_Age == f"{i}"].shape[0]
|
| 467 |
+
|
| 468 |
+
if i == '[0-1[':
|
| 469 |
+
_0_1_non_grave.append(_)
|
| 470 |
+
elif i == '[01-05[':
|
| 471 |
+
_1_5_non_grave.append(_)
|
| 472 |
+
elif i == '[05-15[':
|
| 473 |
+
_5_15_non_grave.append(_)
|
| 474 |
+
elif i == '[15-18[':
|
| 475 |
+
_15_18_non_grave.append(_)
|
| 476 |
+
elif i == '[18-25[':
|
| 477 |
+
_18_25_non_grave.append(_)
|
| 478 |
+
elif i == '[25-35[':
|
| 479 |
+
_25_35_non_grave.append(_)
|
| 480 |
+
elif i == '[35-45[':
|
| 481 |
+
_35_45_non_grave.append(_)
|
| 482 |
+
elif i == '[45-55[':
|
| 483 |
+
_45_55_non_grave.append(_)
|
| 484 |
+
elif i == '[55-65[':
|
| 485 |
+
_55_65_non_grave.append(_)
|
| 486 |
+
elif i == '65etPlus':
|
| 487 |
+
_65etPlus_non_grave.append(_)
|
| 488 |
+
|
| 489 |
+
# afficher la figure
|
| 490 |
+
col = st.columns(2)
|
| 491 |
+
with col[1]:
|
| 492 |
+
st.subheader("Mappi Grave")
|
| 493 |
+
Nbr_mappi_tranche_age_grave = (
|
| 494 |
+
Bar()
|
| 495 |
+
.add_xaxis([selecteur_5])
|
| 496 |
+
.add_yaxis("[0-1[", _0_1_grave)
|
| 497 |
+
.add_yaxis("[1-5[", _1_5_grave)
|
| 498 |
+
.add_yaxis("[5-15[", _5_15_grave)
|
| 499 |
+
.add_yaxis("[12-18[", _15_18_grave)
|
| 500 |
+
.add_yaxis("[18-25[", _18_25_grave)
|
| 501 |
+
.add_yaxis("[25-35[", _25_35_grave)
|
| 502 |
+
.add_yaxis("[35-45[", _35_45_grave)
|
| 503 |
+
.add_yaxis("[45-55[", _45_55_grave)
|
| 504 |
+
.add_yaxis("[55-65[", _55_65_grave)
|
| 505 |
+
.add_yaxis("65etPlus", _65etPlus_grave)
|
| 506 |
+
)
|
| 507 |
+
# Affichage avec Streamlit
|
| 508 |
+
st_pyecharts(Nbr_mappi_tranche_age_grave, height="470px")
|
| 509 |
+
with col[0]:
|
| 510 |
+
st.subheader("Mappi non Grave")
|
| 511 |
+
Nbr_mappi_tranche_age_non_grave = (
|
| 512 |
+
Bar()
|
| 513 |
+
.add_xaxis([selecteur_5]) # Doit être une liste
|
| 514 |
+
.add_yaxis("[0-1[", _0_1_non_grave)
|
| 515 |
+
.add_yaxis("[1-5[", _1_5_non_grave)
|
| 516 |
+
.add_yaxis("[5-15[", _5_15_non_grave)
|
| 517 |
+
.add_yaxis("[12-18[", _15_18_non_grave)
|
| 518 |
+
.add_yaxis("[18-25[", _18_25_non_grave)
|
| 519 |
+
.add_yaxis("[25-35[", _25_35_non_grave)
|
| 520 |
+
.add_yaxis("[35-45[", _35_45_non_grave)
|
| 521 |
+
.add_yaxis("[45-55[", _45_55_non_grave)
|
| 522 |
+
.add_yaxis("[55-65[", _55_65_non_grave)
|
| 523 |
+
.add_yaxis("65etPlus", _65etPlus_non_grave)
|
| 524 |
+
)
|
| 525 |
+
# Affichage avec Streamlit
|
| 526 |
+
st_pyecharts(Nbr_mappi_tranche_age_non_grave, height="470px")
|
| 527 |
+
|
| 528 |
+
elif filtre_sex == True and filtre_tranche_age == True:
|
| 529 |
+
filtre_sex = False
|
| 530 |
+
else:
|
| 531 |
+
# Création du graphique
|
| 532 |
+
Nbr_mappi_type_vaccin = (
|
| 533 |
+
Bar()
|
| 534 |
+
.add_xaxis([selecteur_5]) # Doit être une liste
|
| 535 |
+
.add_yaxis("Nombre de MAPPI non grave", [nbr_mappi_non_grave])
|
| 536 |
+
.add_yaxis("Nombre de MAPPI grave", [nbr_mappi_grave], itemstyle_opts=opts.ItemStyleOpts(color="#FF4B4B"))
|
| 537 |
+
.set_global_opts(title_opts=opts.TitleOpts(title="Distribution des MAPPI par Vaccin"))
|
| 538 |
+
)
|
| 539 |
+
|
| 540 |
+
# Affichage avec Streamlit
|
| 541 |
+
st_pyecharts(Nbr_mappi_type_vaccin, height="470px")
|
| 542 |
+
|
| 543 |
+
elif nav_bar2 == "Carte":
|
| 544 |
+
latitude = []
|
| 545 |
+
longitude = []
|
| 546 |
+
selecteur_6 = st.selectbox("Choisir le Vaccin", options=liste_vaccin)
|
| 547 |
+
# filtre par vaccin
|
| 548 |
+
filtered_df = data[data['type_Vaccin'].isin(liste_vaccin)]
|
| 549 |
+
# filtre sur le vaccin specifique
|
| 550 |
+
filtered_df_2 = filtered_df[filtered_df['type_Vaccin'] == selecteur_6]
|
| 551 |
+
|
| 552 |
+
st.map(filtered_df_2, latitude= "_gps_beginning_latitude", longitude= "_gps_beginning_longitude")
|
data2.xlsx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0b0214e55222b5558569ef6f128906364948e82af8789d381c6852fcf6555156
|
| 3 |
+
size 375811
|
main.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from streamlit_option_menu import option_menu
|
| 3 |
+
|
| 4 |
+
st.set_page_config(page_title="My Streamlit App", layout="wide")
|
| 5 |
+
|
| 6 |
+
# initialisation des autres pages
|
| 7 |
+
Visualisation_page = st.Page("Visualisation.py", title= "Data Visualisation")
|
| 8 |
+
Dashboard_page = st.Page("Dashboard.py", title= "Dashboard page")
|
| 9 |
+
Data_page = st.Page("Data.py", title= "Data page")
|
| 10 |
+
# barre de navigation
|
| 11 |
+
nav_bar1 = option_menu(None,
|
| 12 |
+
["Donnees", "Visualisation des donnees", 'Dashboard'],
|
| 13 |
+
icons=['file-earmark-bar-graph-fill', 'pie-chart-fill', "activity"],
|
| 14 |
+
menu_icon="cast",
|
| 15 |
+
default_index=0,
|
| 16 |
+
orientation="horizontal")
|
| 17 |
+
|
| 18 |
+
if nav_bar1 == "Visualisation des donnees":
|
| 19 |
+
pg = st.navigation([Visualisation_page])
|
| 20 |
+
pg.run()
|
| 21 |
+
elif nav_bar1 == "Dashboard":
|
| 22 |
+
pg = st.navigation([Dashboard_page])
|
| 23 |
+
pg.run()
|
| 24 |
+
elif nav_bar1 == "Donnees":
|
| 25 |
+
pg = st.navigation([Data_page])
|
| 26 |
+
pg.run()
|
| 27 |
+
|