Skip to content

Commit 2ba7cc5

Browse files
author
nazarfil
committed
fix: dhis org_units and iaso org_units overlap
1 parent 1d51228 commit 2ba7cc5

3 files changed

Lines changed: 30 additions & 4 deletions

File tree

examples/pipelines/logistic_stats/pipeline.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ def model(dhis2_data: dict[str, typing.Any], gadm_data, worldpop_data):
113113
population_df = pd.Series(data=[stat["sum"] for stat in stats], index=administrative_areas.index)
114114
population_df = pd.DataFrame({"District": administrative_areas["NAME_2"], "Population": population_df})
115115
corrected_population_df = population_df.copy()
116-
corrected_population_df.loc[
117-
corrected_population_df["District"].str.startswith("Western"), "District"
118-
] = "Western Area"
116+
corrected_population_df.loc[corrected_population_df["District"].str.startswith("Western"), "District"] = (
117+
"Western Area"
118+
)
119119

120120
corrected_population_df = corrected_population_df.groupby("District").sum()
121121

openhexa/sdk/pipelines/parameter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class IASOWidget(StrEnum):
363363
"""Enum for IASO widgets."""
364364

365365
FORMS = "IASO_FORMS"
366-
ORG_UNITS = "IASO_ORG_UNITS"
366+
IASO_ORG_UNITS = "IASO_ORG_UNITS"
367367
PROJECTS = "IASO_PROJECTS"
368368

369369

tests/test_ast.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,8 @@ def test_pipeline_with_connection_parameter_for_iaso(self):
496496
"from openhexa.sdk.pipelines.widgets import IASOWidget",
497497
"",
498498
"@parameter('iaso_con', name='IASO Connection', type=IASOConnection, required=True)",
499+
"@parameter('org_units', name='OrgUnits', type=str, widget=IASOWidget.IASO_ORG_UNITS, connection='iaso_con', required=True)",
500+
"@parameter('projects', name='Projects', type=str, widget=IASOWidget.PROJECTS, connection='iaso_con', required=True)",
499501
"@parameter('forms', name='Forms', type=str, widget=IASOWidget.FORMS, connection='iaso_con', required=True)",
500502
"@pipeline('Test pipeline')",
501503
"def test_pipeline():",
@@ -525,6 +527,30 @@ def test_pipeline_with_connection_parameter_for_iaso(self):
525527
"help": None,
526528
"required": True,
527529
},
530+
{
531+
"code": "org_units",
532+
"type": "str",
533+
"name": "OrgUnits",
534+
"widget": IASOWidget.IASO_ORG_UNITS.value,
535+
"connection": "iaso_con",
536+
"default": None,
537+
"multiple": False,
538+
"choices": None,
539+
"help": None,
540+
"required": True,
541+
},
542+
{
543+
"code": "projects",
544+
"type": "str",
545+
"name": "Projects",
546+
"widget": IASOWidget.PROJECTS.value,
547+
"connection": "iaso_con",
548+
"default": None,
549+
"multiple": False,
550+
"choices": None,
551+
"help": None,
552+
"required": True,
553+
},
528554
{
529555
"code": "forms",
530556
"type": "str",

0 commit comments

Comments
 (0)