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

Guarantee dataset properties in order in dataset-diff #708

Closed
ktuite opened this issue Nov 29, 2022 · 8 comments · Fixed by #933
Closed

Guarantee dataset properties in order in dataset-diff #708

ktuite opened this issue Nov 29, 2022 · 8 comments · Fixed by #933
Assignees
Labels
entities Multiple Encounter workflows

Comments

@ktuite
Copy link
Member

ktuite commented Nov 29, 2022

Dataset properties are returned and shown in alphabetical order on the frontend, but it might be clearer for form designers if these properties match the order in which they are found in the form.

Screen Shot 2022-11-29 at 11 00 44 AM

This is related to Issue #675 about guaranteeing property order in the CSV export. Whatever ordering we end up using there, we should use in the dataset-diff endpoint as well.

@ktuite ktuite added the entities Multiple Encounter workflows label Nov 29, 2022
@ktuite ktuite added this to the v2023.1 milestone Nov 29, 2022
@matthew-white matthew-white moved this to 🕒 backlog in ODK Central Dec 20, 2022
@matthew-white matthew-white removed this from the v2023.1 milestone Jan 24, 2023
@ktuite ktuite self-assigned this Jan 25, 2023
@sadiqkhoja
Copy link
Contributor

Have to fix it for Dataset Metadata endpoint as well

@ktuite ktuite changed the title Return dataset properties in order in dataset-diff Guarantee dataset properties in order in dataset-diff Feb 15, 2023
@ktuite ktuite self-assigned this Feb 21, 2023
@ktuite ktuite moved this from 🕒 backlog to ✏️ in progress in ODK Central Feb 21, 2023
@ktuite ktuite moved this from ✏️ in progress to 🕒 backlog in ODK Central Feb 23, 2023
@ktuite ktuite removed their assignment Apr 24, 2023
@lognaturel
Copy link
Member

How much does the actual order matter?

Could sorting first by publishedAt and then by database id work? Are properties inserted in form order currently?

@ktuite
Copy link
Member Author

ktuite commented Jul 3, 2023

See this comment about possibly removing schemaId from ds_property_fields in this refactor. Didn't remove it here but added it as an issue #943

@ktuite ktuite self-assigned this Jul 10, 2023
@ktuite ktuite moved this from 🕒 backlog to ✏️ in progress in ODK Central Jul 18, 2023
@github-project-automation github-project-automation bot moved this from ✏️ in progress to ✅ done in ODK Central Aug 2, 2023
@ktuite
Copy link
Member Author

ktuite commented Aug 2, 2023

@getodk/testers there is more detail about this issue in this PR: #933

the three places you'll see these properties in their new order (matching the order in which they appear in the form) are

  1. form draft tab
  2. form publish modal
  3. form detail page

The weird edge cases include:

  • moving fields around in your form
  • adding/removing or changing the property names of savetos to these fields
  • deleting a saveto from a field or deleting the field overall and having it not appear in the list of properties on the form, but having older versions of the form still able to create entities with those properties

Image
Image
Image

@dbemke
Copy link

dbemke commented Aug 18, 2023

I’m not sure what should be the expected result in those situations connected with moving fields in a form

  • if I moved a property field in a form (e.g it was the last property in the previous version of a form, then I moved it as the first one in the following version of the form) should the order of the properties change in the CSV of the dataset?
  • If I moved the property field should there be an information about the fact that the field was moved in the publish draft dialog?

@ktuite
Copy link
Member Author

ktuite commented Aug 21, 2023

if I moved a property field in a form (e.g it was the last property in the previous version of a form, then I moved it as the first one in the following version of the form) should the order of the properties change in the CSV of the dataset?

Overall, like in the CSV export and in the dataset property page, the order of the properties should not change if a property gets moved around in later versions of the form. We're trying to make the order of the properties as consistent over time as possible.

However... in this property list on a form status page, I'm trying to make it match the order in the current version form. It may not be the same order as the export order, but the properties here may not contain the full list of dataset properties anyway. Is that the right thing to do? I'm not sure, but feels better than alphabetical order, and I'm hoping it might help someone who is checking the properties in the latest version of the form.

If I moved the property field should there be an information about the fact that the field was moved in the publish draft dialog?

Because the properties within a dataset can come from multiple forms, it's more complex than fields within a form, and it doesn't really matter if the order changes in later versions of different forms. We'll order the properties by

  • order of how they were in the first published version of a form
  • additive, so forms that introduce new properties will have those added at the end, and forms that reference existing properties won't change the order of those properties
  • don't remove properties from the dataset even if they get removed from a form

@dbemke
Copy link

dbemke commented Aug 22, 2023

Testes with success!

1 similar comment
@srujner
Copy link

srujner commented Aug 22, 2023

Testes with success!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
entities Multiple Encounter workflows
Projects
Status: ✅ done
6 participants