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

Created a function to append mandatory fields into custom xls form #289

Merged
merged 3 commits into from
Aug 27, 2024

Conversation

Sujanadh
Copy link
Contributor

Description:

This PR introduces a new function update_xls_form that updates a custom XLS form by integrating mandatory fields at the start (calculation fields) and appending additional fields (digitization fields) at the end. The function processes all sheets within the provided Excel files, ensuring that any common fields between the custom, mandatory, and append forms are handled correctly.

Key Features:

  • Multiple Sheets Handling: The function iterates through all sheets in the custom form, updating them with corresponding sheets from the mandatory and append forms.
  • Custom Fields Preservation: The function ensures that any fields present in the custom form are preserved in their original order, with mandatory fields placed at the beginning and additional fields appended afterward.
  • Common Fields Management: The function identifies common fields across all three forms, retaining the custom form's version of these fields and excluding them from the mandatory and digitisation forms to prevent duplication.
  • Efficient Memory Usage: The function returns the updated Excel form directly as a BytesIO object without writing to a file, optimizing memory usage and improving efficiency.

@spwoodcock
Copy link
Member

Love this PR!

@spwoodcock spwoodcock merged commit b6955bf into main Aug 27, 2024
4 of 5 checks passed
@spwoodcock spwoodcock deleted the feat/update-xls-form branch August 27, 2024 20:16
@Sujanadh
Copy link
Contributor Author

Yet to implement:

  • 'Does this building exist'? Yes/no answer. If no, then we mark as invalid and abort the survey
  • include packages python-calamine, XlsxWriter

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
Development

Successfully merging this pull request may close these issues.

2 participants