edb-noumea 0.2.15__py3-none-any.whl → 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
edb_noumea/details.py CHANGED
@@ -96,23 +96,33 @@ def get_detailed_results():
96
96
  print("\nColonnes:", list(df.columns))
97
97
  print("Shape:", df.shape)
98
98
 
99
- # Sélection dynamique des colonnes bactéries par nom
100
- # Recherche des colonnes contenant les mots-clés
101
- e_coli_col = next((col for col in df.columns if "Escherichia" in str(col) or "coli" in str(col)), None)
102
- entero_col = next((col for col in df.columns if "Entérocoques" in str(col)), None)
103
-
104
- # Dynamically find all required columns
105
- site_col = next((col for col in df.columns if "Nom du site" in str(col)), None)
106
- point_prelevement_col = next((col for col in df.columns if "Point de prélèvement" in str(col)), None)
107
- date_col = next((col for col in df.columns if "Date du prélèvement" in str(col)), None)
108
- heure_col = next((col for col in df.columns if "Heure du prélèvement" in str(col)), None)
109
-
110
- # Check if all required columns are found
99
+ # Nettoyer les noms de colonnes pour faciliter la recherche
100
+ def clean_col(col):
101
+ return str(col).replace("Unnamed:", "").replace("_", " ").replace("\xa0", " ").replace("\n", " ").replace("duprélèvement", "du prélèvement").strip().lower()
102
+
103
+ cleaned_columns = {clean_col(col): col for col in df.columns if not str(col).startswith("Unnamed")}
104
+
105
+ def find_col(possibles):
106
+ for key, col in cleaned_columns.items():
107
+ for possible in possibles:
108
+ if possible in key:
109
+ return col
110
+ return None
111
+
112
+ site_col = find_col(["nom du site"])
113
+ point_prelevement_col = find_col(["point de prélèvement"])
114
+ date_col = find_col(["date du prélèvement"])
115
+ heure_col = find_col(["heure du prélèvement", "heure"])
116
+ e_coli_col = find_col(["escherichia", "coli"])
117
+ entero_col = find_col(["entérocoques"])
118
+
119
+ # Vérification des colonnes requises
111
120
  if not all([site_col, point_prelevement_col, date_col, heure_col, e_coli_col, entero_col]):
112
121
  print(f"❌ Certaines colonnes requises n'ont pas été trouvées. Colonnes disponibles : {list(df.columns)}")
122
+ print(f"Colonnes nettoyées : {list(cleaned_columns.keys())}")
113
123
  return None
114
124
 
115
- # Select and rename columns to internal consistent names
125
+ # Sélection et renommage
116
126
  cleaned_df = df.loc[:, [site_col, point_prelevement_col, date_col, heure_col, e_coli_col, entero_col]].copy()
117
127
  cleaned_df.columns = [
118
128
  "site",
@@ -161,3 +171,6 @@ if __name__ == "__main__":
161
171
  "e_coli_npp_100ml",
162
172
  "enterocoques_npp_100ml"
163
173
  ]])
174
+ # Export CSV
175
+ detailed_df.to_csv("details_dernier_releve.csv", index=False)
176
+ print("\n✅ Export CSV : details_dernier_releve.csv")
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edb-noumea
3
- Version: 0.2.15
4
- Summary: Un scraper pour la qualité des eaux de baignade à Nouméa. (Bug fix release: improved PDF column detection and added jpype1 dependency)
3
+ Version: 0.3.0
4
+ Summary: Scraper robuste pour la qualité des eaux de baignade à Nouméa. Ajout export CSV automatique et détection améliorée des colonnes PDF.
5
5
  Project-URL: Homepage, https://github.com/adriens/edb-noumea
6
6
  Project-URL: Repository, https://github.com/adriens/edb-noumea
7
7
  Requires-Dist: requests
@@ -0,0 +1,7 @@
1
+ edb_noumea/__init__.py,sha256=G7WKTGLsr2wtW1E2jYpqq4miZLoSGhTifSE36CGNkLo,60
2
+ edb_noumea/details.py,sha256=8HYMPTcwcM66saOIFFiCMYrWpBB6iE4AN2PSstNK9uY,7731
3
+ edb_noumea/main.py,sha256=KWT0ZGrHlbhEsQxi_Rw0Mm1syDIxoY-Px1yab94IbJc,2115
4
+ edb_noumea-0.3.0.dist-info/METADATA,sha256=Uf87zUeSb-sVkS6NPz5ZwEAsvFZD1fWfIfPGMSVcfBQ,495
5
+ edb_noumea-0.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ edb_noumea-0.3.0.dist-info/top_level.txt,sha256=Dj3JusM0b5H9_f9yZeO-IwucCZzI1OHSjLMKtvRjq6k,11
7
+ edb_noumea-0.3.0.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- edb_noumea/__init__.py,sha256=G7WKTGLsr2wtW1E2jYpqq4miZLoSGhTifSE36CGNkLo,60
2
- edb_noumea/details.py,sha256=4MVAEzeBLhXZmI034sWGcgZ-vF92kCoK6mW1-3mIZx8,7394
3
- edb_noumea/main.py,sha256=KWT0ZGrHlbhEsQxi_Rw0Mm1syDIxoY-Px1yab94IbJc,2115
4
- edb_noumea-0.2.15.dist-info/METADATA,sha256=XKxMi19cWb7h3WOflI3mJFjMpR1K89_cpSJvZr2z5-k,495
5
- edb_noumea-0.2.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- edb_noumea-0.2.15.dist-info/top_level.txt,sha256=Dj3JusM0b5H9_f9yZeO-IwucCZzI1OHSjLMKtvRjq6k,11
7
- edb_noumea-0.2.15.dist-info/RECORD,,