Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate mandatory XLS forms programmatically #324

Merged
merged 5 commits into from
Dec 25, 2024
Merged

Conversation

Sujanadh
Copy link
Contributor

Summary

This pull request introduces a new feature to generate mandatory XLS forms directly within the codebase. It modularizes the workflow, making it easier to manage and scale form generation tasks.

Features

Added a modular structure to generate XLS forms:

  • mandatory_fields.py: Defines essential fields for all forms.
  • digitisation_fields.py: Includes specific fields for digitization and verification processes.
  • choice_fields.py: Handles choices required for mandatory fields.

Combined all components into a single pipeline to generate the final survey XLS form.

Key Improvements

Added submission_id caculation field to update entity property with latest submission_id.
Created a function standardize_xlsform_sheets which:

  • checks for the columns, converts them to lower case
  • removes any empty rows, and
  • mainly checks the language labels

and creates a standard language label for any kind of label present in the user-defined xls form consequently making a standard xls form.

@Sujanadh
Copy link
Contributor Author

Update:

Actually, there was a way to have multiple submission_ids in a single entity just by concatenating it with a previous submission_id.

  • updated the caculations of submission_ids to append previous submission_ids as well.

@spwoodcock
Copy link
Member

Update:

Actually, there was a way to have multiple submission_ids in a single entity just by concatenating it with a previous submission_id.

* updated the caculations of `submission_ids` to append previous `submission_ids` as well.

That's huge!!

We can easily have a disambiguation dialog to select the submission on the frontend then 🎉

💯 the workflow to choose - thanks for sticking to your guns and convincing me 😄

"list_name": "digitisation_problem",
"name": "lumped",
"label::english(en)": "Lumped - one polygon (more than one building digitized as one)",
"label::swahili(sw)": "Lumped - poligoni moja (zaidi ya jengo moja limewekwa dijiti kuwa moja)",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is perfect for now, but we should definitely consider moving all these translations out into a separate YAML or something, at some point.

This way users could update the translations via weblate or transifex (we will add this for UI translations soon anyway)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I also thought about that 👍

# along with OSM-Fieldwork. If not, see <https:#www.gnu.org/licenses/>.
#

"""This script generates an XLS form with mandatory fields.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely docstring 👍

"french": "fr",
"spanish": "es",
"swahili": "sw",
"nepali": "ne",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌😁

If you can translate the other columns into Nepali then feel free to add them! (might help Tokha I imagine)

@spwoodcock
Copy link
Member

Merge whenever 👍

You can make and push a new release too

cz bump --check-consistency
git push
git push --tag

#then release on github

@Sujanadh
Copy link
Contributor Author

I will get back to it sooner.

@Sujanadh Sujanadh merged commit bea5a1b into main Dec 25, 2024
4 of 5 checks passed
@Sujanadh Sujanadh deleted the feat/form-builder branch December 25, 2024 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants