Skip to content

Commit

Permalink
feat: updated xls form to include building_exists condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Sujanadh committed Sep 3, 2024
1 parent fb96a83 commit f3dc5fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion osm_fieldwork/update_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,22 @@ def merge_sheets(mandatory_df, custom_df, digitisation_df):
mandatory_df_filtered = mandatory_df[~mandatory_df["name"].isin(common_fields)]
digitisation_df_filtered = digitisation_df[~digitisation_df["name"].isin(common_fields)]

group_row = pd.DataFrame({
"type": ["begin group"],
"name": ["survey_questions"],
"label": ["Survey Form"],
"relevant": ["${building_exists} = 'yes'"] # Add the relevant condition to display this group only if "Yes" is selected
})

end_group_row = pd.DataFrame({
"type": ["end group"],
"name": ["end_survey_questions"],
"label": ["End Survey Form"]
})

# Concatenate: mandatory fields at the top, custom common fields, remaining custom fields, and finally append form fields
merged_df = pd.concat(
[custom_common_df, mandatory_df_filtered, custom_non_common_df, digitisation_df_filtered], ignore_index=True
[custom_common_df, mandatory_df_filtered, group_row, custom_non_common_df, digitisation_df_filtered, end_group_row], ignore_index=True
)

return merged_df
Expand Down
Binary file modified osm_fieldwork/xlsforms/fmtm/mandatory_fields.xls
Binary file not shown.

0 comments on commit f3dc5fc

Please sign in to comment.