Skip to content

Commit 596cb49

Browse files
author
nazarfil
committed
fix: prefix iaso widget with IASO_
1 parent 670fe92 commit 596cb49

3 files changed

Lines changed: 26 additions & 10 deletions

File tree

examples/pipelines/iaso/pipeline.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,39 @@
99
@parameter("iaso_con", type=IASOConnection, required=True)
1010
@parameter(
1111
"forms",
12-
type=str,
12+
type=int,
1313
required=True,
14-
widget=IASOWidget.FORMS,
14+
widget=IASOWidget.IASO_FORMS,
1515
multiple=True,
1616
connection="iaso_con",
1717
)
18-
def iaso(iaso_con, forms):
18+
@parameter(
19+
"projects",
20+
type=int,
21+
required=True,
22+
widget=IASOWidget.IASO_PROJECTS,
23+
multiple=True,
24+
connection="iaso_con",
25+
)
26+
@parameter(
27+
"org_units",
28+
type=int,
29+
required=True,
30+
widget=IASOWidget.IASO_ORG_UNITS,
31+
multiple=True,
32+
connection="iaso_con",
33+
)
34+
def iaso(iaso_con, forms, org_units, projects):
1935
"""Get forms from IASO."""
20-
print_forms(iaso_con, forms)
36+
print_forms(iaso_con, forms, org_units, projects)
2137

2238

2339
@iaso.task
24-
def print_forms(iaso_con, forms):
40+
def print_forms(iaso_con, forms, org_units, projects):
2541
"""Print forms."""
2642
current_run.log_info("Printing forms")
2743

28-
current_run.log_info(f"Forms: {forms}")
44+
current_run.log_info(f"Forms: {forms}, Org Units: {org_units}, Projects: {projects}")
2945

3046

3147
if __name__ == "__main__":

openhexa/sdk/pipelines/parameter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ def validate(self, value: typing.Any | None) -> Dataset:
362362
class IASOWidget(StrEnum):
363363
"""Enum for IASO widgets."""
364364

365-
FORMS = "IASO_FORMS"
365+
IASO_FORMS = "IASO_FORMS"
366366
IASO_ORG_UNITS = "IASO_ORG_UNITS"
367-
PROJECTS = "IASO_PROJECTS"
367+
IASO_PROJECTS = "IASO_PROJECTS"
368368

369369

370370
class DHIS2Widget(StrEnum):

tests/test_ast.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def test_pipeline_with_connection_parameter_for_iaso(self):
543543
"code": "projects",
544544
"type": "str",
545545
"name": "Projects",
546-
"widget": IASOWidget.PROJECTS.value,
546+
"widget": IASOWidget.IASO_PROJECTS.value,
547547
"connection": "iaso_con",
548548
"default": None,
549549
"multiple": False,
@@ -555,7 +555,7 @@ def test_pipeline_with_connection_parameter_for_iaso(self):
555555
"code": "forms",
556556
"type": "str",
557557
"name": "Forms",
558-
"widget": IASOWidget.FORMS.value,
558+
"widget": IASOWidget.IASO_FORMS.value,
559559
"connection": "iaso_con",
560560
"default": None,
561561
"multiple": False,

0 commit comments

Comments
 (0)