Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

User Story Description:
Anchor
top
top

As a Submitter, I want to be able to create & save a pre-populated template for a given form. This can be done in two different ways:

A Submitter submits the form once

generate a new submission from a previous one:

  • A Submitter submits the form once which generates a submission that they can go back to whenever they want. The new feature would be that if they want to submit the form again (i.e. for a new quarter) then they can start from the previously completed submission to have the field pre-populated from that previous submission

  • A Submitter simply generates an actual “template” type submission which can then be used to create a new submission which would be pre-populated with the values set in the template.

At this point, both solutions should be explored, as they can both serve their own purpose.Potential future enhancements (Post MVP):

  • Ability to select which fields can have their values propagated from one submission to another (In Scope)

  • Making this functionality available from the Form Submission page directly. (Currently only available from the “Submissions“ page)

Business Rationale:

top page

Priority: Could HaveSome forms are filled out on a regular basis and some data points will have the same value from one submission to another. Having them pre-filled can simplify the user experience and help with data consistency by limiting the load on the userCritical (MVP)

Facility operators and Health Authorities are all form submitters. For the 4 Health program areas that we are serving (HCC, MHSU, AIMS and LTC), submitters will need to re-submit the same form every reporting period or ad-hoc.

AIMS for example will be an intake/discharge form that Health Authorities can submit at any time. They would first submit the Form as “Intake“ for a specific person being enrolled in a Program. Then once the program is completed, the person will be discharged and the Health Authority will submit the form for the same person but as “Discharge“.

For MHSU, LTC and HCC, a lot of values will be the same from one reporting period to another (i.e. facility information, annual plan)

Manually re-entering the data every new submission period can lead to errors and is very time consuming.

Dependencies:

top page

[List potential dependencies with other User Stories or Tasks]

#

Task or User Story

Type of Dependency

31

#3FORMS-321: (Submitters) Field Pre-population from previous Form Designer) define which field can have their value re-used in a new submission

 Child

23 

 #23: (Submitter) Assign External/Custom Validation Rules to Forms  Parent

 

 

 

 

Technical Details:

When the submitter clicks on the copy button the system will send him to a new page and we copy the data of this old submission form to this new form but nothing saves yet on the server after making the change the submitter can save the draft , submit or cancel the copy.

How to send the submitter to the new page ?

The URL must contain the [ID] of the submission form clicked. On the new page we catch the [ID] from the URL and we make a call to the server to get the submission form .

What’s happen on the server ?

First we check if the [ID] of the submission exist, next we check if this submission form is for the logged user. If every thing is OK, now we can send the data to the client .

Remember :
A form has list of version , the pre-populated template must be create from the last version of the form.

the The form is store in the database as a jsonb using this format :

Code Block
languagejson
{
  "type": "form",
  "display": "form",
  "components": [
    {
      "id": "eyipb8",
      "key": "nomname",
      "case": "",
      "mask": false,
      "type": "simpletextfield",
      "input": true,
      "label": "Nom",
      "addons": [],
      "hidden": false,
      "prefix": "",
      "suffix": "",
      "unique": false,
      "widget": {
        "type": "input"
      },
      "dbIndex": false,
      "overlay": {
        "top": "",
        "left": "",
        "style": "",
        "width": "",
        "height": ""
      },
      "tooltip": "",
      "disabled": false,
      "multiple": false,
      "redrawOn": "",
      "tabindex": "",
      "validate": {
        "custom": "",
        "unique": false,
        "pattern": "",
        "multiple": false,
        "required": false,
        "maxLength": "",
        "minLength": "",
        "customMessage": "",
        "customPrivate": false,
        "strictDateValidation": false
      },
      "autofocus": false,
      "encrypted": false,
      "hideLabel": false,
      "inputMask": "",
      "inputType": "text",
      "modalEdit": false,
      "protected": false,
      "refreshOn": "",
      "tableView": false,
      "attributes": {},
      "errorLabel": "",
      "labelWidth": "",
      "persistent": true,
      "properties": {},
      "spellcheck": true,
      "validateOn": "change",
      "clearOnHide": true,
      "conditional": {
        "eq": "",
        "json": "",
        "show": null,
        "when": null
      },
      "customClass": "",
      "description": "",
      "displayMask": "",
      "inputFormat": "plain",
      "labelMargin": "",
      "placeholder": "",
      "defaultValue": "",
      "dataGridLabel": false,
      "labelPosition": "top",
      "showCharCount": false,
      "showWordCount": false,
      "calculateValue": "",
      "calculateServer": false,
      "customConditional": "",
      "allowMultipleMasks": false,
      "customDefaultValue": "",
      "allowCalculateOverride": false,
      "truncateMultipleSpaces": false
    },
    {
      "id": "enq9jmv",
      "key": "submit",
      "size": "md",
      "type": "button",
      "block": false,
      "input": true,
      "label": "Submit",
      "theme": "primary",
      "action": "submit",
      "addons": [],
      "hidden": false,
      "prefix": "",
      "suffix": "",
      "unique": false,
      "widget": {
        "type": "input"
      },
      "dbIndex": false,
      "overlay": {
        "top": "",
        "left": "",
        "style": "",
        "width": "",
        "height": ""
      },
      "tooltip": "",
      "disabled": false,
      "leftIcon": "",
      "multiple": false,
      "redrawOn": "",
      "tabindex": "",
      "validate": {
        "custom": "",
        "unique": false,
        "multiple": false,
        "required": false,
        "customPrivate": false,
        "strictDateValidation": false
      },
      "autofocus": false,
      "encrypted": false,
      "hideLabel": false,
      "modalEdit": false,
      "protected": false,
      "refreshOn": "",
      "rightIcon": "",
      "tableView": false,
      "attributes": {},
      "errorLabel": "",
      "persistent": false,
      "properties": {},
      "validateOn": "change",
      "clearOnHide": true,
      "conditional": {
        "eq": "",
        "show": null,
        "when": null
      },
      "customClass": "",
      "description": "",
      "placeholder": "",
      "defaultValue": null,
      "dataGridLabel": true,
      "labelPosition": "top",
      "showCharCount": false,
      "showWordCount": false,
      "calculateValue": "",
      "calculateServer": false,
      "disableOnInvalid": true,
      "allowMultipleMasks": false,
      "customDefaultValue": "",
      "allowCalculateOverride": false
    }
  ]
}

in In the snippet above we have the JSON for a form with one field call name “name” its a input . in the one bellow we have the snippets for a submission for this form .

code

the data section contain an object this object is the submission data .

Code Block
languagejson
{
  "data": {
    "nomname": "test",
    "submit": true
  },
  "state": "submitted",
  "metadata": {
    "offset": -240,
    "onLine": true,
    "origin": "http://localhost:8083",
    "pathName": "/app/form/submit",
    "referrer": "",
    "timezone": "America/Toronto",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
    "browserName": "Netscape"
  }
}

Dont forget our goal its to create a copy of old submission form. Data section contain the value of each field, dont forget to change the state and the metadata section.

we also need to check if there is no new field to remove or add in this version and to add/remove it in the data section .

Helper :

By example if the new version of the form has a new field added you can find it and add it to the data section but to do that i propose a way but you can do it anyway you think its better .

Code Block
languagejs
var data =  {
    "nomname": " test",
    "submit": true
  },

We can convert this object above to 2 arrays one for keys and one for values :

code
Code Block
language
js
const propertyNames = Object.keys(data);

console.log(propertyNames);

// ['nomname', 'submit']

const propertyValues = Object.values(data);

console.log(propertyValues);
// ['test', 'true']

Now if there are some new field you want to add them to the key name to the key array and a empty value to the values array in the same index.

After creating those to 2 array arrays , we merge can manipulate them to create one array with key->value , in this new array we can add or remove value add an remove field and we can create an object from this those array like bellow .

Code Block
languagejs

propertyNames.unshift("gender");
propertyValues.unshift("");

// now we create a map.
const entries = new Map([
  ['nom', 'submit'],
  ['test', true]propertyNames,
  propertyValues
]);

const obj = Object.fromEntries(entries);
console.log(obj);
// expected output: Object { nom gender: "", name: "test", submit: true }

We just added a new field to this form submission called gender, so now we can save this new submission form and use it.

Acceptance Criteria:

top page

[List the Acceptance Criteria]

#

Description

Notes

1

As a submitter, I can see a button to copy a form I submitted that has a completed status.

 

2

 As As a submitter, when i I click on the copy button i redirect to second page where i have a form fill with the previous data of the old submission form I am redirected to a new form submission page where the form is filled with the data from the submission I selected.

 

3

 As As a submitter, i I can change data from this new form and save it as a draft or submit it.

 

4

 As As submitter, i I can cancel cancel the copy new submission and nothing will be persisted.

 

5 

The new submission uses the latest published version of the form and only the common fields between the previous version and new version will be copied.

 

Prototype/Mockups

top page

Provide high fidelity prototype or mockup Attach prototype of first version

Out of Scope:

 

Contact(s):

top page

Table of Contents

Table of Contents
minLevel1
maxLevel7

Code Block