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 button to 'Validate this feature' when clicking a feature on the map #1946

Open
spwoodcock opened this issue Dec 4, 2024 · 18 comments
Open
Assignees
Labels
backend Related to backend code effort:medium Likely a day or two enhancement New feature or request frontend Related to frontend code priority:high Should be addressed as a priority

Comments

@spwoodcock
Copy link
Member

Is your feature request related to a problem? Please describe.

  • We have a button to 'Map in ODK' currently.
  • In a future release this will be removed.

Image

  • But, we also want a button to 'validate this feature now'.
  • It should simply open the feature detail page, to allow for the validation to happen.
@spwoodcock spwoodcock added effort:high Broader scope task with unclear timeline (consider splitting) effort:low Likely a few hours enhancement New feature or request frontend Related to frontend code labels Dec 4, 2024
@spwoodcock spwoodcock added priority:high Should be addressed as a priority and removed effort:high Broader scope task with unclear timeline (consider splitting) labels Dec 4, 2024
@NSUWAL123
Copy link
Contributor

The problem here is we need the submission instance ID to redirect user to submission instance page (feature detail page).
Image

But from the project page, there's no way to access the submission instance id. Is it possible to attach the submission instance ID to the/status API?

CC: @spwoodcock , @Sujanadh

@NSUWAL123 NSUWAL123 added the backend Related to backend code label Dec 6, 2024
@spwoodcock
Copy link
Member Author

Damn, I hoped this would be a simple addition until we do the large validation workflow refactor, but you are completely right!

For now, when the user clicks validate now, could we:

  • Redirect to the submission table, but filter by the associated entity id (can we do that?)
  • Allow the user to click on the details page button and validate from there.

The reason I suggest this is that there could be multiple submissions for a feature!

@Sujanadh
Copy link
Contributor

Sujanadh commented Dec 6, 2024

Doing that wouldn't follow our discussion to validate features by using the next button to validate another feature consequently. Creating another API to list the submission instances along with the entity ID might solve this?

c.c: @ramyaragupathy @manjitapandey

@spwoodcock
Copy link
Member Author

I think the 'next' based validation would only be on a task level, if the user clicks on a task then 'Validate Task'. On the feature level we wanted to go straight to the submission page, but I realise that's not possible as there may be multiple submissions per feature.

Two options:

  • The first is as you say, have a new API. It should take an entity ID, and return the submissions present for that entity. The question remains how to we decide which submission to redirect to, if multiple are present. There could be a selector popup if two are present, so allow the user to choose. Else redirect automatically if only one submission is present.

  • Redirect to the submission table, but filter down by entity id field (should be in the submission). The user can click through to the validation page for the submission (not perfect UX if there is only one submission - most cases - but I can't think of an easier solution for now)

@NSUWAL123
Copy link
Contributor

Yeah I was thinking about the first approach too!

@Sujanadh
Copy link
Contributor

I was thinking about linking submission_id(instance_id) to entity after submission by adding properties submission_id in the entities and dataset and automatically populating it when submissions are made. So I tried adding column submission_id in the entities sheet, but it is not supported, I went through your discussions in odk forum where you had talked about adding notes in the entity sheet.

What I think would work for us is updating the entity ID of that feature to the submission id, so that we can use that entity id which will be same to submission id, to filter the submission table and view the submission detail directly.
@spwoodcock

@Sujanadh
Copy link
Contributor

But if a single entity has multiple submissions, it might not work.

@spwoodcock
Copy link
Member Author

I love the idea! But as you say, the major drawback is if we have multiple submissions.

The use case we imagine normally does only have one submission, but we could imagine a mapping campaign for say street level imagery collection, where the user might make multiple submissions for a single POI.

If ODK supports it, then we should probably too!

@spwoodcock
Copy link
Member Author

Plus that's a really tricky thing to do by the sounds of it!

I think with any other field we could probably update an entity property on submission, but I imagine the submission uuid is generated on insert into the ODK database, so its not known at the point of submission. Its only after the submission is made it will have an id/uuid, so we may not be able to trigger the entity property update

@Sujanadh
Copy link
Contributor

Actually, we can access the submission id in the form. Instance id is generated when the form is processed, so we can access it using /data/meta/instanceID.

@Sujanadh
Copy link
Contributor

I will start it all in python, from mandatory xls files to python.

@spwoodcock
Copy link
Member Author

spwoodcock commented Dec 13, 2024

You mean we can make a calculated field to extract the submission ID and update an entity property on submit?

What about the scenario of two submissions for one entity though?

I noticed my message above was a but unclear! By 'if ODK supports it, we should to' I was referring to having multiple submissions for a single entity. Its not necessarily a 1:1 relationship

@spwoodcock
Copy link
Member Author

spwoodcock commented Dec 13, 2024

I'm also scouring docs to find any way to reverse lookup submissions using the entity id!

But it seems its not possible, outside of the approach you mention for linking 1:1 via form submission (injecting submission id into an entity property).

Instead, is it not possible to go the other way and get the entity id from the submissions?

Ideally the odata submission endpoint allows for filtering by entity id property, but I'm not sure if this is supported yet? We could get all submissions, then filter down, but that's a bit slow and not very elegant 😅

edit: double checked the docs and odata filter for user defined fields is still not possible

@spwoodcock
Copy link
Member Author

I was about to comment and say: this could be an unsolvable problem, and we could reject doing this until there is a solution.

But I think the solution you propose via the form submission linking is good enough, although not perfect.

Workflow:

  1. User clicks to 'validate this feature', linking to the most recent submission. If multiple submissions were made, then we don't support finding them all / selecting between them. We can only validate the most recent submission.

  2. On the 'validate task' screen, where we go through all submissions via next and previous buttons, we will show all submissions. As we load them all, we could flag to the user on this screen 'multiple submissions made for same feature', then have them choose which one to take (or merge them together somehow).

I can't think of an alternative! Let me know if I missed anything! 🙏

@spwoodcock
Copy link
Member Author

If making a new entity property, should it reflect the above by being named something like latest_submission_id?

@Sujanadh
Copy link
Contributor

I tested creating submission_id as a property in entity, and populated submission_id . I tried making two submissions on same feature, it resulted into conflict with latest submission_id.

Image

@manjitapandey manjitapandey removed the effort:low Likely a few hours label Dec 16, 2024
@spwoodcock spwoodcock added the effort:medium Likely a day or two label Dec 16, 2024
@spwoodcock
Copy link
Member Author

I tested creating submission_id as a property in entity, and populated submission_id . I tried making two submissions on same feature, it resulted into conflict with latest submission_id.

Image

Damn! This is very useful info.

The question is what is the final value if you get the entity from the API?

Soft conflicts are just an indication for review, but the values are still updated to the latest submitted.

This looks like a hard conflict though, which may cause an error and prevent the entity properties being updated.

In the end, if the properties are updated to the values we need (despite the conflicts, which we can ignore), then everything should be fine. But if not, we need to go another route!

@Sujanadh
Copy link
Contributor

The final value we get is the latest submission id 👍, and properties are updated too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend code effort:medium Likely a day or two enhancement New feature or request frontend Related to frontend code priority:high Should be addressed as a priority
Projects
Development

No branches or pull requests

4 participants