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

saving tge current form before replacing it #506

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

Conversation

bamatic
Copy link

@bamatic bamatic commented Sep 13, 2022

When performing upload-app-forms, and if the form to upload exists in the database

  1. The current form is saved with it's attachments to a new doc of type="old-form" and doc_id="form:form_id"
  2. All version of a given form can be obtained now getting all dos of type:"old-form" and doc_id="form:form_id"
  3. attached xml files with the form definition are avaliable for each form version

This is related to #505

Is your feature request related to a problem? Please describe.
the cht-conf version 10 add the xml_version json key to the form doc when the action upload-app-forms is executed, but the new form of a given form._id replaces the old one and the old xml file is overwritten.
The cht add the form version of the form doc to its data_records.
If a data analyst found a trouble with a current form, he can always learn about collected data using the form, but if the problem is with historical old data, he knows fields sent into the data_record but he is not able to investigate data collection processus and for example, learn about how such a value is possible in a variable;

Describe the solution you'd like
We propose that upload-app-forms does not replace old version but :

before to the replacing, the old form is copied to a new doc but with type: "old-form" and the _id of replaced form is stored in the doc with type "old-form" using the key "doc-id";=:"form:formId", attachements, xml, form_html and model are saved to this type:"old-form" new doc
the form is replaced as now
Additional context
some endpoints could be added to the cht-core forms API to retrieve all versions of a given form:formID; and to get the xml file of a given form version something like GET api/v1/forms/{formid}.{format]/{sha1}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant