Skip to content
New issue

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

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

Already on GitHub? # to your account

Add client.submissions.edit to edit an existing submission #8

Closed
lognaturel opened this issue Sep 16, 2022 · 2 comments · Fixed by #19
Closed

Add client.submissions.edit to edit an existing submission #8

lognaturel opened this issue Sep 16, 2022 · 2 comments · Fixed by #19
Labels
enhancement New feature or request

Comments

@lognaturel
Copy link
Member

lognaturel commented Sep 16, 2022

Use cases

Building block for a data cleaning pipeline that treats Central as the source of truth. User realizes one systematic error was made, they script identifying all of those errors and confirming them, then building updated submissions and submitting them using this method. They also specify a comment that looks something like "Scripted fix for fields foo, bar, baz".

Some kinds of issues I've fixed using similar building blocks:

  • bad character encoding in CSV attachment (so you have F�� in your submissions)
  • systematic place name misspellings (open field for administrative region, you want to normalize "Banaadir", "Bandir" to "Banadir")
  • error in select underlying value that was fixed in later form version (so submissions from early form version have ff for female instead of f).

Proposed inputs

instance_id: str
form_id: str
comment: str
xml: str - a string representation of the new XML to submit. Must have the correct deprecatedID and a new instanceID

project_id: Optional[int] = None

Proposed output

Exception in case of any error state.

None in case of success. It could be an object representing the submission metadata after the update but I expect this would generally be ignored.

@lognaturel lognaturel added this to the Next milestone Sep 21, 2022
@lognaturel lognaturel added the enhancement New feature or request label Sep 21, 2022
@lindsay-stevens
Copy link
Contributor

@ln could you please share any more details on the intended use cases?

It seems to imply modifying a Submission and a Comment, so Central will return the updated data and there would be two different data types (one from each call). What would you expect to receive back from this method? e.g.

  1. A tuple of the data like (Submission, Comment)
  2. A generic complex type for the relationship like SubmissionComments, (since there can be many comments per submission, possibly even listing all comments on the submission) like
class SubmissionComments:
    submission: Submission
    comments: Set[Comment]
  1. Nothing
  2. Something else?

@lognaturel
Copy link
Member Author

Ah yes, thank you for those questions.

more details on the intended use cases?

This would be a building block for a data cleaning pipeline that treats Central as the source of truth. So maybe a user realizes one systematic error was made, they script identifying all of those errors and confirming them, then building updated submissions and submitting them using this method. They also specify a comment that looks something like "Scripted fix for fields foo, bar, baz".

Some kinds of issues I've fixed using similar building blocks:

  • bad character encoding in CSV attachment (so you have F�� in your submissions)
  • systematic place name misspellings (open field for administrative region, you want to normalize "Banaadir", "Bandir" to "Banadir")
  • error in select underlying value that was fixed in later form version (so submissions from early form version have ff for female instead of f).

I think over time we could look into helping users e.g. generate updated submissions from edits made in pandas. For now this method would help build these pipelines even if the hardest part is still updating the submission (but examples will help).

What would you expect to receive back from this method?

I would expect nothing back in case of success and an exception if anything goes wrong. My sense is that in this kind of scripting context mutators generally don't need to return the result of their mutations. The script may do follow-up work but it's more likely to be in the context of the full dataset rather than with the submission that was just mutated.

Does this seem valuable to you?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants