Update phase/ingestion.py
Browse filesmodified validation for required column; changed from "barangay" to "group"
- phase/ingestion.py +4 -3
phase/ingestion.py
CHANGED
|
@@ -32,9 +32,10 @@ def ingest_adoption(file):
|
|
| 32 |
return {}
|
| 33 |
|
| 34 |
# handle missing required column
|
| 35 |
-
|
| 36 |
-
|
|
|
|
| 37 |
|
| 38 |
-
participants_by_group = adoption_df.groupby("
|
| 39 |
|
| 40 |
return participants_by_group
|
|
|
|
| 32 |
return {}
|
| 33 |
|
| 34 |
# handle missing required column
|
| 35 |
+
# there must be a "group" column in the adoption dataset
|
| 36 |
+
if "group" not in adoption_df.columns:
|
| 37 |
+
raise ValueError("Adoption data must contain \"group\" column.")
|
| 38 |
|
| 39 |
+
participants_by_group = adoption_df.groupby("group").size().to_dict()
|
| 40 |
|
| 41 |
return participants_by_group
|