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

Add row to calculate coordinates of additional entity #312

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Sujanadh
Copy link
Contributor

Description:

This feature introduces functionality to calculate and retrieve the coordinates of an additional entity selected in a survey form.

  • Adds a new calculate row that retrieves the coordinates of the selected entity. This is done using an instance reference for the entity and retrieves the geometry field using the following XPath expression:
"calculation": [f"instance('{entity_name}')/root/item[name=${entity_name}]/geometry"]

Issue:

  • Unable to view the geometry of additional features in the map in submission detail due to missing coordinates.
  • Visualise additional features on submission details page fmtm#1882
  • Fixes loading issue of additional entities in odk collect due to unmatch name with additional features uploaded to odk central; removed code that removes trailing 's' letter from the entity name to make it singular.

@@ -175,10 +171,22 @@ def append_select_one_from_file_row(df: pd.DataFrame, entity_name: str) -> pd.Da
}
)

# Prepare the row for calculating coordinates based on the additional entity
coordinates_row = pd.DataFrame(
Copy link
Member

Choose a reason for hiding this comment

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

It's quite nice having the field in code like this.

It's verbose, but we can then use source control.

Do you think we should remove the mandatory fields xls file and build the dataframe here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we tried that initially when we were writing this function to append fields. But it looked so messy and complex so we decided to use a file instead, updating the form seemed easier during that time.

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